Skip to content

[duplicate-code] Duplicate Code Analysis Report #2257

@github-actions

Description

@github-actions

Analysis of commit 2ccc405

Summary

Semantic analysis of the Go codebase found 2 significant duplication patterns meeting the reporting threshold (>10 lines or 3+ similar patterns). Both are in core packages and affect maintainability.

Detected Patterns

  1. Case-Insensitive String Slice Normalization — Severity: Medium — See sub-issue [duplicate-code] Duplicate Code Pattern: Case-Insensitive String Slice Normalization in guard_policy.go #2258
  2. SecrecyLabel / IntegrityLabel Parallel Structure — Severity: Low — See sub-issue [duplicate-code] Duplicate Code Pattern: SecrecyLabel/IntegrityLabel Parallel Wrapper Structure in difc/labels.go #2259

Overall Impact

  • Total Duplicated Lines: ~40 lines across both patterns
  • Affected Files: 2 (internal/config/guard_policy.go, internal/difc/labels.go)
  • Maintainability Risk: Medium — bug fixes in normalisation logic need to be applied in multiple places
  • Refactoring Priority: Low-to-Medium — both are self-contained and low-risk to fix

Next Steps

  1. Review individual pattern sub-issues for detailed analysis
  2. Prioritize the guard_policy.go normalisation extraction (pattern Configure as a Go CLI tool #1) — highest ROI
  3. Consider the DIFC label wrapper pattern only if new label types are planned

Analysis Metadata

  • Analyzed Files: ~55 non-test Go files in internal/
  • Detection Method: Semantic code analysis (symbol/pattern search)
  • Commit: 2ccc4055bb9a9a7b51c8d326d9242ae81ecf484a
  • Analysis Date: 2026-03-21

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