Skip to content

[duplicate-code] Duplicate Code Pattern: Non-standard Logger Variable Names (var log, var debugLog) #9174

Description

@github-actions

🔍 Duplicate Code Pattern: Non-standard Logger Variable Names

Part of duplicate code analysis: #aw_parent001abc12

Summary

Three files use logger variable names (var log or var debugLog) that deviate from the project-wide logXxx naming convention documented in AGENTS.md. The new logConnLogging variable added in commit d600b1b correctly follows the convention, highlighting the inconsistency in these older files.

Duplication Details

Pattern: Generic / non-standard logger variable name

  • Severity: Low

  • Occurrences: 3 instances

  • Locations:

    • internal/guard/context.go (line 29): var log = logger.New("guard:context") — used 6 times in this file
    • internal/auth/header.go (line 47): var log = logger.New("auth:header") — used 11 times in this file
    • internal/guard/registry.go (line 11): var debugLog = logger.New("guard:registry") — used 14 times in this file
  • Code Samples:

    // internal/guard/context.go:29
    var log = logger.New("guard:context")
    
    // internal/auth/header.go:47
    var log = logger.New("auth:header")
    
    // internal/guard/registry.go:11
    var debugLog = logger.New("guard:registry")

    Expected (per convention):

    // internal/guard/context.go
    var logContext = logger.New("guard:context")
    
    // internal/auth/header.go
    var logHeader = logger.New("auth:header")
    
    // internal/guard/registry.go
    var logRegistry = logger.New("guard:registry")

Impact Analysis

  • Maintainability: var log shadows the standard library log package name, which can cause confusion. var debugLog implies a different kind of logger than what is actually there.
  • Bug Risk: Low — primarily a naming convention issue, not a logic bug.
  • Code Bloat: Minimal.

Refactoring Recommendations

  1. Rename var logvar logContext in internal/guard/context.go and update all call sites
  2. Rename var logvar logHeader in internal/auth/header.go and update all call sites
  3. Rename var debugLogvar logRegistry in internal/guard/registry.go and update all call sites

All three renames are mechanical (search-and-replace within the file). Tests pass as-is since the rename has no functional change.

Implementation Checklist

  • Rename loglogContext in internal/guard/context.go
  • Rename loglogHeader in internal/auth/header.go
  • Rename debugLoglogRegistry in internal/guard/registry.go
  • Run make test to verify no regressions

Parent Issue

See parent analysis report: #aw_parent001abc12

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Duplicate Code Detector · 56.7 AIC · ⊞ 7.7K ·

  • expires on Jul 19, 2026, 3:40 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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