Something went wrong. Try again.
code complexity & repetition analysis tool
Something went wrong. Try again.
Quick Start #
This guide will get you analyzing code in minutes.
Basic Usage #
Analyze Everything #
Run a full analysis on a directory:
mccabre analyze ./src
This will show:
- Cyclomatic complexity per file
- Lines of code metrics
- Detected code clones
Complexity Only #
To check only complexity metrics:
mccabre complexity ./src
Clone Detection Only #
To find duplicated code:
mccabre clones ./src
Lines of Code Only #
To rank files by logical lines of code:
mccabre loc ./src
Coverage #
To summarize an LCOV file:
mccabre coverage report --from lcov.info
Understanding the Output #
Terminal Output #
Mccabre uses colors to highlight issues:
- Green: Low complexity (1-10)
- Yellow: Moderate complexity (11-20)
- Red: High complexity (21+)
Example output:
================================================================================
MCCABRE CODE ANALYSIS REPORT
================================================================================
SUMMARY
--------------------------------------------------------------------------------
Total files analyzed: 5
Total physical LOC: 450
Total logical LOC: 320
Average complexity: 8.50
Maximum complexity: 18
High complexity files: 2
Clone groups detected: 3
FILE METRICS
--------------------------------------------------------------------------------
FILE: src/utils.rs
Cyclomatic Complexity: 5 (low)
Physical LOC: 45
Logical LOC: 32
JSON #
mccabre analyze ./src --json > report.json
Next Steps #
- Learn about Cyclomatic Complexity
- Understand Clone Detection
- Read about Coverage
- Configure thresholds
- See more examples