Metadata-Version: 2.4
Name: dr-huatuo
Version: 0.3.0
Summary: Code quality diagnosis toolkit — 5-dimension maintainability profiling for Python
Project-URL: Homepage, https://github.com/frankyxhl/dr-huatuo
Project-URL: Repository, https://github.com/frankyxhl/dr-huatuo
Project-URL: Issues, https://github.com/frankyxhl/dr-huatuo/issues
Author-email: Frank <franky.xhl@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: code-quality,complexity,linting,maintainability,static-analysis
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Requires-Dist: bandit
Requires-Dist: complexipy
Requires-Dist: mypy
Requires-Dist: pylint
Requires-Dist: radon
Requires-Dist: rich
Requires-Dist: ruff
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Provides-Extra: full
Requires-Dist: lcom; extra == 'full'
Provides-Extra: research
Requires-Dist: datasketch; extra == 'research'
Requires-Dist: scikit-learn; extra == 'research'
Requires-Dist: scipy; extra == 'research'
Description-Content-Type: text/markdown

# dr-huatuo

Code quality diagnosis toolkit for Python. Named after the legendary Chinese physician Hua Tuo (华佗) — it diagnoses code health.

## Features

- **5-Dimension Quality Profile**: Maintainability, Complexity, Code Style, Documentation, Security
- **CI Quality Gate**: `--fail-on D` exits non-zero for CI/CD integration
- **Literature-Backed Thresholds**: McCabe, SonarSource, Microsoft/SEI, with evidence tagging
- **25 Static Metrics**: ruff, radon, bandit, mypy, pylint, complexipy
- **HTML Reports**: Interactive complexity drilldown with source code view

## Quick Start

```bash
pip install dr-huatuo

# Check a file
dr-huatuo check myfile.py

# Check a project with CI quality gate
dr-huatuo check src/ --fail-on D

# Generate HTML report
dr-huatuo report src/ -f html -o report.html
```

## Example Output

```
myfile.py
  Maintainability    A  (MI=65.3)
  Complexity         C  (cognitive_complexity=18 > 15)
  Code Style         A  (ruff=0, pylint=9.2)
  Documentation      B  (docstring_density=0.75)
  Security           PASS

  Action items:
    1. Reduce cognitive complexity (18 → ≤15 for B)
```

## Quality Dimensions

| Dimension | Metrics | Thresholds |
|---|---|---|
| Maintainability | Maintainability Index (MI) | A: ≥40, B: ≥20, C: ≥10, D: <10 |
| Complexity | Cognitive complexity + nesting depth | A: ≤5/≤2, D: >25/≥6 |
| Code Style | ruff violations + pylint score | A: 0 violations + ≥9.0 |
| Documentation | Docstring + comment density | A: ≥80% docstrings + 10-30% comments |
| Security | Bandit HIGH/MEDIUM findings | PASS/WARN/FAIL gate |

## License

MIT
