All Topics
All Topics
Technology
Technology
AI
AI
Business
Business
Entertainment
Entertainment
News
News
Programming
Programming
Science
Science
Design
Design
Environment
Environment
Finance
Finance
Crypto
Crypto
Politics
Politics
Sports
Sports
Education
Education
Gaming
Gaming
Art
Art
Music
Music
Health
Health
Security
Security
Books
Books
Food
Food
Travel
Travel
Personal
Personal
Bluesky
Twitter

Ask HN: Distinguishing intentional test boilerplate from real code duplication in duplicate-code detectors

By

rafaepta

20d ago· 1 min readenInsight

Summary

A maintainer of a deterministic open-source duplicate-code detector discusses a challenging feature request: how to distinguish intentional test boilerplate (repetitive test setups) from actual code duplication that should be refactored. The core problem is that tests deliberately repeat scenarios, which structural detectors flag as duplication, but users don't want to delete these repetitions. The maintainer considers a human-in-the-loop approach as a potential solution but lacks a clear implementation path.

Source

Hacker NewsAsk HN: Distinguishing intentional test boilerplate from real code duplication in duplicate-code detectorsnews.ycombinator.com

Key quotes

· 4 pulled
Tests repeat the same scenario. For a structural detector, this flags as repetition (duplication).
However, tests are not something people want to delete from the codebases.
The repetitions from tests (on purpose) end up looking like undesired code duplication and the tools cannot tell which is which.
One way to solve this would be something like a human in the loop (kind of how l
Snippet from the RSS feed
I am maintaining an open-source project (deterministic open source duplicate-code detector) and a user asked for a feature which I don’t have a clear answer on how to implement.

You might also wanna read

Comments

Sign in to join the conversation.

No comments yet. Be the first.