Skip to content

feat: pre-commit checks for common code comment gaps #452

Description

@sonupreetam

Context

From PR #425 post-mortem. Several review findings (jq merge semantics, exit code 124 magic number, heredoc security rationale) could have been caught by lightweight automated checks before reaching the review council.

Proposed Checks

Add checks (as MegaLinter custom rules, shellcheck companions, or /uf.finale pre-commit items) that flag common comment gaps:

  1. jq merge semantics: Flag jq expressions using + for object merge without an inline comment explaining key-collision behavior
  2. Magic exit codes: Flag numeric comparisons against exit codes (e.g., -eq 124, -eq 143) without a comment explaining the sentinel value
  3. Heredoc security rationale: Flag quoted heredocs (<< 'DELIM') in scripts that process untrusted input without a comment explaining why expansion is suppressed\n4. Shell metacharacter validation: Flag regex-based input validation (=~ ^[...]$) in scripts without corresponding test coverage\n\n## Implementation Options\n\n- Lightweight: Add a "code comment checklist" step to /uf.finale that scans for these patterns and warns\n- Medium: Custom shellcheck rules or a companion linter\n- Heavy: MegaLinter custom descriptor\n\nThe lightweight option is probably sufficient — these are heuristic checks, not hard gates.\n\n## Priority\n\nLow. These are quality-of-life improvements that reduce review round-trips, not security or correctness issues.\n\nSource: feat: council-review-action runtime sandbox and review fixes #425
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions