Skip to content

[duplicate-code] Duplicate Code Analysis Report #2049

@github-actions

Description

@github-actions

Analysis of commit a774683

Summary

Two significant duplication patterns were detected in the Go codebase. Both exceed the reporting threshold (>10 lines duplicated or 3+ similar patterns).

Detected Patterns

  1. Identical failure-check blocks in parseLabelAgentResponse — Severity: Medium — See sub-issue [duplicate-code] Duplicate Code Pattern: Identical WASM failure-check blocks in parseLabelAgentResponse #2050
  2. String deduplication/normalization pattern repeated 3× across packages — Severity: Low — See sub-issue [duplicate-code] Duplicate Code Pattern: String deduplication/normalization repeated in 3 packages #2051

Overall Impact

  • Total Duplicated Lines: ~30 (14 exact + ~16 structural)
  • Affected Files: 3 (internal/guard/wasm.go, internal/difc/sink_server_ids.go, internal/cmd/flags_difc.go)
  • Maintainability Risk: Medium — wasm.go blocks must be updated in sync; deduplication logic diverges silently
  • Refactoring Priority: Low-to-Medium; neither path is hot, but the wasm.go pattern is error-prone

Next Steps

  1. Review sub-issues for detailed analysis and refactoring recommendations
  2. Prioritize wasm.go helper extraction (small, self-contained change)
  3. Optionally consolidate string deduplication into a strutil helper

Analysis Metadata

  • Analyzed Files: ~75 Go files (non-test, non-workflow)
  • Detection Method: Static pattern analysis (grep, structural comparison)
  • Commit: a774683
  • Analysis Date: 2026-03-17

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions