A zero-dependency Python code analysis suite — complexity, security, style, and dependency checking.
- Cyclomatic Complexity — McCabe-style calculation for every function/method
- Security Audit — detects
eval,exec,subprocesswithshell=True, unsafepickle, hardcoded passwords, SQL injection patterns - Style Check — line length, naming conventions (snake_case, PascalCase, ALL_CAPS), docstring presence, trailing whitespace
- Dependency Analysis — categorises imports as stdlib / third-party / local
- All-in-One — run every check in a single pass
- TUI mode (
--tui) — interactive curses-based interface - Colour-coded output — red for security warnings, yellow for style warnings, green for OK
pip install -e /path/to/code-auditorOr from PyPI (future):
pip install code-auditor# Cyclomatic complexity
code-auditor complexity myfile.py
# Security audit
code-auditor security myproject/
# Style check
code-auditor style myfile.py
# Dependency analysis
code-auditor deps myproject/
# All checks at once
code-auditor all myproject/
# TUI mode (interactive curses interface)
code-auditor --tuipython -m code_auditor complexity myfile.py
python -m code_auditor --tui$ code-auditor all sample.py
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
code-auditor — all checks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[COMPLEXITY] ────────────────────────────────────────
calculate_score (line 23) complexity: 5 OK
process_data (line 42) complexity: 8 WARN (threshold: 10)
[SECURITY] ──────────────────────────────────────────
Line 15: WARNING Use of 'eval()' detected
Line 31: WARNING Hardcoded password pattern detected
[STYLE] ─────────────────────────────────────────────
Line 80: Line 81 exceeds 79 characters
Line 12: Missing docstring for function 'do_thing'
[DEPENDENCIES] ──────────────────────────────────────
stdlib: os, sys, json, re, hashlib
third-party: requests, numpy
local: mymodule.utils
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All checks complete.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0— all clear1— warnings found2— security issues found
MIT