Building with Cursor, Claude, or ChatGPT? pyscn performs structural analysis to keep your codebase maintainable.
# Run analysis without installation
uvx pyscn analyze .
# or
pipx run pyscn analyze .pyscn_20251005.mov
- π CFG-based dead code detection β Find unreachable code after exhaustive if-elif-else chains
- π Clone detection with APTED + LSH β Identify refactoring opportunities with tree edit distance
- π Coupling metrics (CBO) β Track architecture quality and module dependencies
- π Cyclomatic complexity analysis β Spot functions that need breaking down
100,000+ lines/sec β’ Built with Go + tree-sitter
# Install with pipx (recommended)
pipx install pyscn
# Or with uv
uv tool install pyscnAlternative installation methods
git clone https://github.com/ludo-technologies/pyscn.git
cd pyscn
make buildgo install github.com/ludo-technologies/pyscn/cmd/pyscn@latestRun comprehensive analysis with HTML report
pyscn analyze . # All analyses with HTML report
pyscn analyze --json . # Generate JSON report
pyscn analyze --select complexity . # Only complexity analysis
pyscn analyze --select deps . # Only dependency analysis
pyscn analyze --select complexity,deps,deadcode . # Multiple analysesFast CI-friendly quality gate
pyscn check . # Quick pass/fail check
pyscn check --max-complexity 15 . # Custom thresholdsCreate configuration file
pyscn init # Generate .pyscn.tomlπ‘ Run
pyscn --helporpyscn <command> --helpfor complete options
Create a .pyscn.toml file or add [tool.pyscn] to your pyproject.toml:
# .pyscn.toml
[complexity]
max_complexity = 15
[dead_code]
min_severity = "warning"
[output]
directory = "reports"βοΈ Run
pyscn initto generate a full configuration file with all available options
# .github/workflows/code-quality.yml
name: Code Quality
on: [push, pull_request]
jobs:
quality-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install pyscn
- name: Quick quality check
run: pyscn check .
- name: Generate detailed report
run: pyscn analyze --json --select complexity,deadcode,deps src/
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: code-quality-report
path: .pyscn/reports/π Development Guide β’ Architecture β’ Testing
For commercial support, custom integrations, or consulting services, contact us at contact@ludo-tech.org
MIT License β see LICENSE
Built with β€οΈ using Go and tree-sitter