Monthly code quality tracking issue for April 2026. Based on automated analysis of the azlin Python codebase.
Overall Health Score: 78/100 (C+)
The codebase is in generally good shape, with excellent docstring coverage and low technical debt. The main areas for improvement are function length and the extreme complexity of doc_sync.py::main.
Module Quality Scorecard
| Module |
Avg Complexity |
MI Score |
Grade |
Notes |
src/azlin/__init__.py |
1.0 |
100 |
A |
Perfect |
src/azlin/rust_bridge.py |
5.3 |
49.8 |
B- |
One long/complex function |
scripts/audit_key_operations.py |
5.0 |
62.2 |
B |
Good structure |
scripts/doc_sync.py |
38.0 |
62.7 |
D |
main() needs splitting |
scripts/extract_help.py |
3.1 |
43.4 |
C |
Long functions |
scripts/generate_docs.py |
2.5 |
49.4 |
C |
Very long functions |
scripts/validate_documentation.py |
5.6 |
42.8 |
C- |
Complex comparisons |
scripts/cli_documentation/extractor.py |
4.2 |
60.1 |
B- |
Some complexity |
scripts/cli_documentation/generator.py |
3.7 |
63.2 |
B- |
Acceptable |
scripts/cli_documentation/sync_manager.py |
3.1 |
67.4 |
B |
Good |
scripts/cli_documentation/validator.py |
2.1 |
73.7 |
B+ |
Good |
scripts/cli_documentation/models.py |
1.8 |
66.4 |
B |
Good |
scripts/cli_documentation/hasher.py |
1.9 |
69.9 |
B |
Good |
scripts/cli_documentation/example_manager.py |
2.2 |
67.7 |
B |
Good |
Top Issues to Address
1. Critical: doc_sync.py::main — Complexity 38 (Grade E) 🔴
This single function has cyclomatic complexity of 38, which is nearly double the recommended maximum (20). It is also 165 lines long.
Before:
def main() -> None:
# 165 lines, 38 branches
...
After:
def main() -> None:
paths = _setup_paths()
commands = _discover_commands(paths)
_sync_documentation(commands, paths)
_report_results()
2. High: generate_docs.py — Extremely long functions 🟡
generate_first_vm(): 296 lines
generate_concepts(): 312 lines
These are generation functions that likely contain large blocks of static content. Consider:
3. Medium: rust_bridge.py::_download_from_release — Complexity 15 🟡
4. Medium: Deep nesting (113 lines at 5+ indent levels) 🟡
Across the scripts directory, 113 lines have 5+ levels of indentation. This indicates nested loops/conditionals that could be flattened.
5. Low: Type annotation coverage at 81% 🟢
20% of functions (20 of 105) lack type annotations. The project uses Pyright strict mode on src/, but scripts are not covered.
Strengths to Maintain 🎉
- Zero TODO/FIXME debt — clean codebase with no deferred tasks
- Excellent docstring coverage: 91.4% (96/105 functions documented)
- No functions with >10 parameters — clean API design
- Average cyclomatic complexity: 4.26 (Grade A) — healthy overall
- No circular imports detected
- All maintainability scores rated A by radon
Metrics Snapshot (2026-04-06)
{
"date": "2026-04-06",
"overall_score": 78,
"total_loc": 4122,
"total_sloc": 2354,
"total_functions": 105,
"avg_complexity": 4.26,
"max_complexity": 38,
"max_complexity_function": "doc_sync.py::main",
"docstring_coverage_pct": 91.4,
"type_hint_coverage_pct": 81.0,
"todo_count": 0,
"long_functions_count": 14,
"deeply_nested_lines": 113,
"magic_numbers": "minimal"
}
Progress Tracking
Generated by Code Quality Tracker bot on 2026-04-06
Generated by Code Quality Tracker
Monthly code quality tracking issue for April 2026. Based on automated analysis of the azlin Python codebase.
Overall Health Score: 78/100 (C+)
The codebase is in generally good shape, with excellent docstring coverage and low technical debt. The main areas for improvement are function length and the extreme complexity of
doc_sync.py::main.Module Quality Scorecard
src/azlin/__init__.pysrc/azlin/rust_bridge.pyscripts/audit_key_operations.pyscripts/doc_sync.pymain()needs splittingscripts/extract_help.pyscripts/generate_docs.pyscripts/validate_documentation.pyscripts/cli_documentation/extractor.pyscripts/cli_documentation/generator.pyscripts/cli_documentation/sync_manager.pyscripts/cli_documentation/validator.pyscripts/cli_documentation/models.pyscripts/cli_documentation/hasher.pyscripts/cli_documentation/example_manager.pyTop Issues to Address
1. Critical:
doc_sync.py::main— Complexity 38 (Grade E) 🔴This single function has cyclomatic complexity of 38, which is nearly double the recommended maximum (20). It is also 165 lines long.
_setup_paths(),_sync_commands(),_generate_reports())Before:
After:
2. High:
generate_docs.py— Extremely long functions 🟡generate_first_vm(): 296 linesgenerate_concepts(): 312 linesThese are generation functions that likely contain large blocks of static content. Consider:
3. Medium:
rust_bridge.py::_download_from_release— Complexity 15 🟡68 lines, C-rated complexity
Handles multiple platforms, architectures, and error paths
Extract platform-selection logic into a
_select_asset()helperTarget: reduce to complexity ≤8
4. Medium: Deep nesting (113 lines at 5+ indent levels) 🟡
Across the scripts directory, 113 lines have 5+ levels of indentation. This indicates nested loops/conditionals that could be flattened.
extract_help.pyandvalidate_documentation.pyfor guard-clause opportunities5. Low: Type annotation coverage at 81% 🟢
20% of functions (20 of 105) lack type annotations. The project uses Pyright strict mode on
src/, but scripts are not covered.scripts/as wellStrengths to Maintain 🎉
Metrics Snapshot (2026-04-06)
{ "date": "2026-04-06", "overall_score": 78, "total_loc": 4122, "total_sloc": 2354, "total_functions": 105, "avg_complexity": 4.26, "max_complexity": 38, "max_complexity_function": "doc_sync.py::main", "docstring_coverage_pct": 91.4, "type_hint_coverage_pct": 81.0, "todo_count": 0, "long_functions_count": 14, "deeply_nested_lines": 113, "magic_numbers": "minimal" }Progress Tracking
doc_sync.py::main(complexity 38 → target ≤8 per sub-function)generate_docs.py::generate_concepts(312 lines → target <50)generate_docs.py::generate_first_vm(296 lines → target <50)rust_bridge.py::_download_from_releasecomplexity (15 → ≤8)Generated by Code Quality Tracker bot on 2026-04-06