← Back to Pull requests

feat(lint): add namelen rule for overlong names #99

Open
unknown opened this pull request with 325 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 22, 2026 20:14 UTC
Author

<!-- claude-projects-attribution: {"github_login":"miru-agents"} -->
_Requested by bens-agent · project thread_

Summary


  • Add a namelen rule flagging names over 20 chars (locals, params), 50 (test funcs) or 30 (all others).

  • Limits were measured on core, cli-private and backend (18, 32, 247 names over); those repos are unchanged here.

  • Shorten gotools' test names so its self-lint passes.
  • Decisions


    Names


  • namelen/RuleNameLen over namelength: matches funclen, filelen, linelen.

  • MaxTestNameLen over MaxTestFuncLen: MaxFuncLen means length in lines.

  • MaxNameLen/MaxLocalNameLen: mirror varname's MinNameLen.
  • Precedent


  • linter/namelen/*.go mirrors linter/varname/: checker/visitor, redeclared skip, constants not flags, rune count, nolint on declaring line.
  • Open questions


  • rules.go hit filelen's 300 lines, so runChecks' two continue guards were merged. Keep, or first move fixer helpers out of rules.go in their own PR? Default: keep.

  • Test renames abbreviate (Pkg, Ptr, Decls, BOM). OK? Default: keep.
  • <!--

    Left out


  • Receivers (rcvrname covers them), type params, labels, import names, func-type param names.

  • namelen tests and .covgate: ready step.

  • Follow-up: share redeclared (varname, namelen) via analysis.

  • -->

    ---
    _Generated by Claude Code_

    <!-- codesmith:footer -->
    ---
    <a href="https://dashboardbackend.blacksmith.sh/track/run-proof?expires=1797970461&installation_model_id=425273&pr_number=99&ref=codesmith_pr_footer&repository=mirurobotics%2Fgotools&return_to=https%3A%2F%2Fgithub.com%2Fmirurobotics%2Fgotools%2Fpull%2F99&variant=proof_this_pr&signature=0d965acf8c95b969378bbfac131ee7dfab0468af4798e25905e8f892e0a793df"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-proof-this-pr-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-proof-this-pr-v2-light.svg"><img alt="Proof this PR" src="https://pr-comments-assets.blacksmith.sh/codesmith/proof-proof-this-pr-v2-dark-3x.png" width="121" height="28"></picture></a>
    <sup><a href="https://app.blacksmith.sh/mirurobotics/codesmith/gotools/pr/99?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>

    <!-- codesmith:autofix:disabled -->
    <!-- /codesmith:footer -->

    Diff: 325 lines (+243 / -82) across 4 files Reviewer: github-actions[bot] Review duration: 8m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 325 lines diff across 4 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.346
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #99"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47% (MEDIUM) · Higher = larger blast radius
    47%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.1% · Safe to merge
    25.1%