Skip to content

[duplicate-code] Duplicate Code Analysis Report — difc tag-set mutation methods #8771

Description

@github-actions

Analysis of commit 16ac464

Summary

This analysis identified 1 significant duplication pattern in the internal/difc/ package: the Label and Capabilities types share nearly identical concurrent tag-set mutation methods backed by the same underlying data structure (map[Tag]struct{} + sync.RWMutex). This results in ~25 duplicated lines across 5 methods.

Detected Patterns

  1. Concurrent tag-set methods duplicated between Label and Capabilities — Severity: Medium — See sub-issue [duplicate-code] Duplicate Code Pattern: Concurrent tag-set methods in Label and Capabilities #8772

Overall Impact

  • Total Duplicated Lines: ~25 lines (5 methods, repeated verbatim)
  • Affected Files: 2 (internal/difc/capabilities.go, internal/difc/labels.go)
  • Maintainability Risk: Medium — a bug fix or logging change to one must be manually mirrored to the other
  • Refactoring Priority: Low-Medium — the logic is stable and tested, but the duplication grows risk over time

Next Steps

  1. Review the individual pattern sub-issue for detailed analysis
  2. Consider extracting a generic tagSet type or embedding Label inside Capabilities
  3. Evaluate whether Capabilities methods can simply delegate to an inner Label

Analysis Metadata

  • Analyzed Files: 1 Go file changed in commit (internal/difc/capabilities.go); cross-referenced with internal/difc/labels.go
  • Detection Method: Semantic pattern matching — symbol comparison across internal/difc/
  • Commit: 16ac464
  • Analysis Date: 2026-07-06

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions