Skip to content

feat: reduce duplicate-code false positives - #2

Merged
dominicnunez merged 4 commits into
mainfrom
codex/reduce-gallow-clone-noise
Aug 12, 2026
Merged

dominicnunez merged 4 commits into
mainfrom
codex/reduce-gallow-clone-noise

Conversation

@dominicnunez

Copy link
Copy Markdown
Owner

Summary

  • report only larger, substantive duplicate blocks by default
  • ignore repeated single-return guard clauses common in Go error handling
  • add validated duplicateCode thresholds to .gallowrc.json
  • document the conservative defaults and configuration

Validation

  • gofmt clean
  • go test ./internal/settings passes locally
  • full local suite is blocked only because this environment cannot download Go module dependencies; GitHub CI will run the complete suite

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03fdb720ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/analyzer/duplicate.go Outdated
Comment on lines +355 to +357
startLine := tokens[i].line
endLine := tokens[end].line
if endLine-startLine+1 < duplicateTokenMinLines {
if endLine-startLine+1 < options.MinTokenLines || !duplicateWindowHasMeaningfulStatements(syntax, fset, startLine, endLine, options.MinStatements) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Count token-bearing lines for MinTokenLines

When duplicated tokens are separated by blank or comment-only lines, this checks the physical span rather than the number of lines containing tokens. For example, a 100-token sequence on three substantive lines spread across 12 physical lines passes the default MinTokenLines: 12; similarly, a configured higher threshold can be satisfied merely by adding whitespace. This defeats the newly documented token-line threshold and can preserve the false positives it is intended to suppress, so count distinct duplicateToken.line values in the candidate window instead.

Useful? React with 👍 / 👎.

@dominicnunez
dominicnunez merged commit 46597b4 into main Aug 12, 2026
5 checks passed
@dominicnunez
dominicnunez deleted the codex/reduce-gallow-clone-noise branch October 30, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant