39 lines
1000 B
Markdown
39 lines
1000 B
Markdown
# Python File Analyzer (py_analyzer.py)
|
|
|
|
A quick, standalone Python utility that analyzes Python source files and extracts basic metrics: line counts, function counts, class counts, imports, docstrings, and an estimated cyclomatic complexity score.
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
python3 py_analyzer.py <file1.py> [file2.py] ...
|
|
```
|
|
|
|
## Output
|
|
|
|
For each file, reports:
|
|
- Total lines, code lines, comment lines, blank lines
|
|
- Number of functions, classes, imports, docstrings
|
|
- Estimated cyclomatic complexity (LOW/MODERATE/HIGH)
|
|
|
|
## Example
|
|
|
|
```
|
|
$ python3 py_analyzer.py py_analyzer.py
|
|
|
|
============================================================
|
|
Analysis: py_analyzer.py
|
|
============================================================
|
|
Total lines: 99
|
|
Code lines: 75
|
|
Comment lines: 5
|
|
Blank lines: 19
|
|
Functions: 2
|
|
Classes: 0
|
|
Imports: 3
|
|
Docstrings: 1
|
|
Cyclomatic est: 74 (HIGH complexity)
|
|
```
|
|
|
|
## Location
|
|
|
|
Created: /root/.hermes/wizard-outputs/spark/py_analyzer.py |