Skip to content

Bug: Pre-commit hooks not blocking print()/console.* violations #1082

Description

@mrveiss

Problem

The compliance audit found 685+ logging violations (print() in Python, console.* in TypeScript) across the codebase. The pre-commit hooks are supposed to block these but are clearly not enforcing the rule effectively.

Evidence

  • 70+ print() calls in production Python code
  • 200+ print() calls in monitoring/script Python code
  • 300+ print() calls in test files
  • 250+ console.* calls in TypeScript/Vue files

Discovered During

Compliance audit of core development rules (Feb 21, 2026)

Root Cause

Either:

  1. The pre-commit config doesn't include print/console checks
  2. Files/directories are excluded too broadly
  3. The hook regex doesn't match all patterns

Impact

High — Without enforcement, new violations accumulate with every commit. This is the root cause enabler for all logging violations.

Acceptance Criteria

  • Verify .pre-commit-config.yaml has print/console.* checks
  • Ensure no overly broad exclusions
  • Test that a commit with print() or console.log() is rejected
  • Document any intentional exceptions (e.g., debugUtils.ts)

Activity

  1. mrveiss commented on Feb 21, 2026

    @mrveiss
    OwnerAuthor

    ✅ Implemented in PR #1093

    Changes:

    • Created autobot-infrastructure/shared/scripts/hooks/pre-commit-no-print-console — bash hook script that scans staged Python files for print() and staged TypeScript/Vue files for console.* calls
    • Added hook entry to .pre-commit-config.yaml as no-print-console local hook
    • Smart exclusions: test files, debugUtils.ts, RumConsoleHelper.ts, infrastructure/, config files, .d.ts
    • Supports # noqa: print and // noqa: console inline exemptions
    • Regex avoids false positives (fingerprint(), pretty_print(), blueprint.print(), etc.)

    Verification:

    • ✅ Tests passing (hook catches violations correctly)
    • ✅ False positive prevention verified
    • ✅ All pre-commit hooks pass
    • ✅ Ready for review
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions