Skip to main content

Error Handling Auditor

A CLI tool that scans codebases for error handling issues across Python, JavaScript/TypeScript, Go, and Rust. Designed for CLI use, CI pipelines, and LLM-based PR review workflows.

Installation

pip install error-auditor

Or install from source:

git clone https://github.com/example/error-auditor
cd error-auditor
pip install -e .

Usage

Full Repository Scan

Scan an entire codebase for error handling issues:

# Scan a directory
error-auditor scan ./src

# Scan multiple paths
error-auditor scan ./src ./lib ./pkg

# Scan specific languages only
error-auditor scan . --lang python,go

# Exclude directories
error-auditor scan . -e "**/test/**" -e "**/vendor/**" -e "**/__pycache__/**"

PR Review Mode (Diff Scanning)

Scan only changed lines from a git diff - ideal for PR reviews:

# Pipe git diff directly
git diff main..HEAD | error-auditor diff

# Compare against origin
git diff origin/main | error-auditor diff

# Use a patch file
error-auditor diff --diff changes.patch

# Specify base path for file resolution
git diff HEAD~1 | error-auditor diff --base-path ./src

CI Integration

# Exit with code 1 if errors found
error-auditor scan ./src --ci

# Fail on warnings or higher
error-auditor scan ./src --ci --fail-on warning

# PR check - only fail on new issues
git diff $BASE_SHA..$HEAD_SHA | error-auditor diff --ci --fail-on error

Output Formats

# Human-readable text (default)
error-auditor scan ./src

# JSON for LLM consumption or programmatic use
error-auditor scan ./src -f json

# JSON to file
error-auditor scan ./src -f json -o report.json

# SARIF for IDE/GitHub Code Scanning integration
error-auditor scan ./src -f sarif -o results.sarif

# Compact JSON (no pretty printing)
error-auditor scan ./src -f json --compact

Filtering

# Only show errors (hide warnings and info)
error-auditor scan ./src --min-severity error

# Only show warnings and above
error-auditor scan ./src --min-severity warning

Stdin Mode

Check code snippets directly:

# Pipe code directly
echo 'try:
    risky()
except:
    pass' | error-auditor check -l python

# Check with specific filename for language detection
cat myfile.go | error-auditor check -n myfile.go

List Available Rules

error-auditor rules

Detected Issues

Python

Rule Severity Description
bare-except error Bare except: catches all exceptions including KeyboardInterrupt
broad-except warning Catching broad Exception without re-raise or logging
pass-in-except warning Empty except block with just pass

JavaScript/TypeScript

Rule Severity Description
empty-catch warning Empty catch block in try/catch
empty-catch-callback warning Empty .catch() callback on promises

Go

Rule Severity Description
ignored-error warning Error return explicitly ignored with _
unchecked-error warning Error assigned but never checked

Rust

Rule Severity Description
unwrap-used warning .unwrap() can panic at runtime
poor-expect-message info .expect() with non-descriptive message
unwrap-or-default info .unwrap_or_default() may hide errors
unused-result warning Result value not used or checked

Output Examples

Text Output

src/api.py:42:5 error[bare-except]: Bare except clause catches all exceptions
   |
42 | except:
   |     ^^^
   = suggestion: Specify exception type: `except Exception as e:`

Found 1 issue(s): 1 error(s), 0 warning(s)

JSON Output

{
  "summary": {
    "total": 1,
    "errors": 1,
    "warnings": 0,
    "info": 0,
    "files_scanned": 5
  },
  "issues": [
    {
      "file": "src/api.py",
      "line": 42,
      "column": 5,
      "severity": "error",
      "rule": "bare-except",
      "message": "Bare except clause catches all exceptions including KeyboardInterrupt and SystemExit",
      "code_snippet": "except:",
      "suggestion": "Specify exception type: `except Exception as e:`",
      "language": "python"
    }
  ]
}

GitHub Actions Example

name: Error Handling Check

on: [pull_request]

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install error-auditor
        run: pip install error-auditor

      - name: Full scan (informational)
        run: error-auditor scan . -f json -o full-report.json
        continue-on-error: true

      - name: Check changed files only
        run: |
          git diff origin/${{ github.base_ref }}..HEAD | \
            error-auditor diff --ci --fail-on error

LLM PR Review Integration

The JSON output is designed for LLM consumption in PR review workflows:

# Generate report for LLM
git diff origin/main | error-auditor diff -f json > /tmp/issues.json

# Feed to your LLM review pipeline
cat /tmp/issues.json | your-llm-review-tool

The structured output includes:

  • File path, line, and column for precise location
  • Severity level for prioritization
  • Rule name for categorization
  • Code snippet for context
  • Actionable suggestion for fixes

Exit Codes

Code Meaning
0 No issues found (or below threshold)
1 Issues found at or above --fail-on severity
2 Configuration or runtime error

License

MIT

Release files for error-handling-check 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for error-handling-check 0.1.0
File Size Uploaded
error_handling_check-0.1.0.tar.gz 25.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for error-handling-check 0.1.0
File Interpreter ABI Platform
error_handling_check-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 54.6 kB

Release files / error_handling_check-0.1.0.tar.gz

Download URL error_handling_check-0.1.0.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
921885945acd8e80d62c7ce91aefabd43e04fb4f993995f2114231b94e785f7a
BLAKE2b-256 checksum
How to use checksums
0423e23eddd705b0b87a705c5709eb24878be1be3ea9e1556dc2e7c65d2711ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.

Transparency log

Release files / error_handling_check-0.1.0-py3-none-any.whl

Download URL error_handling_check-0.1.0-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f65c294ba2fef9235926a03ae8bfffdcca71f96af580d0fb9f19503d585aaa4b
BLAKE2b-256 checksum
How to use checksums
883956306b80bfa9964902ce93029b1011092dcc3aa8fdee268cdd484a749554
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page