Skip to main content

Huatuo

Dr. Huatuo

Code Quality Diagnosis Toolkit

5-dimension quality profiling for Python and TypeScript. Named after the legendary physician Hua Tuo (华佗) — it diagnoses code health.

PyPI CI Python 3.11+ MIT License


What is dr-huatuo?

dr-huatuo orchestrates static analysis tools into a unified quality profile with 5 independent dimensions. No single aggregate score — each dimension gets its own grade so you know exactly what to fix.

  • Multi-Language — Python (ruff, radon, bandit, mypy, pylint, complexipy) and TypeScript (eslint, tsc, escomplex)
  • 5-Dimension Quality Profile — Maintainability, Complexity, Code Style, Documentation, Security
  • CI Quality Gate — --fail-on D exits non-zero for CI/CD integration
  • Multiple Output Formats — Terminal (rich), HTML (interactive with Chart.js), JSON, Markdown
  • Plugin Architecture — Language-agnostic protocol, register new analyzers with one line

Quick Start

pip install dr-huatuo
# or
pipx install dr-huatuo

# Check a Python file
ht check myfile.py

# Check a TypeScript project
ht check frontend/src/ --language typescript

# Check a mixed project (auto-detects Python + TypeScript)
ht check src/ --fail-on D

# Generate interactive HTML report
ht report src/ -f html -o report.html

# Show version and tool status
ht version

Screenshots

Terminal Report (ht report src/)

Terminal report showing file scores, complexity, and suggested actions

HTML Report (ht report src/ -f html)

Interactive HTML report with complexity hotspots and security issues

Quality Dimensions

Dimension Metrics Grades
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 Lint violations (ruff) + linter score (pylint) A: 0 violations + ≥9.0
Documentation Docstring + comment density A: ≥80% docstrings + 10-30% comments
Security Bandit HIGH/MEDIUM findings PASS / WARN / FAIL gate

Type safety (mypy errors) is reported as informational — not rated.

CLI Reference

# Quality check (5-dimension profile)
ht check <path>                          # analyze file or directory
ht check src/ --fail-on D               # CI gate: fail on D or F
ht check src/ --fail-on C               # stricter: fail on C, D, or F
ht check src/ --fail-on WARN            # fail on any security warning
ht check src/ --fail-on D --dimension Security  # gate single dimension
ht check src/ -e .venv tests docs       # exclude directories
ht check src/ --language typescript     # filter by language

# Project reports
ht report <path>                         # terminal output (default)
ht report src/ -f html -o report.html   # interactive HTML with Chart.js
ht report src/ -f json -o report.json   # machine-readable JSON
ht report src/ -f markdown -o report.md # markdown for docs

# Info
ht version                               # show version + tool status

Scoring System

Score starts at 100, with deductions per category:

Category Deduction Cap
Lint violations -2 each -30
Complexity >10 (cc-10) × 5 -20
Security HIGH -15 each -30
Security MEDIUM -5 each -15
Type errors -1 each -10

Grades: A (90+) Excellent, B (80+) Good, C (70+) Fair, D (60+) Pass, F (<60) Fail

Tools Orchestrated

Python

Tool What it checks
ruff Lint violations (fast Python linter)
radon Cyclomatic complexity, maintainability index, Halstead metrics
bandit Security vulnerabilities
mypy Type errors
pylint Code quality score
complexipy Cognitive complexity

Python tools are installed automatically as pip dependencies.

TypeScript

Tool What it checks
eslint Lint violations, security rules (eslint-plugin-security)
tsc Type errors (via tsconfig.json)
escomplex Cyclomatic complexity, maintainability index

TypeScript tools require Node.js. Install locally: npm install --save-dev eslint typescript typhonjs-escomplex

Roadmap

  • Foundation — single-file analyzer, project reporter, tests, CI/CD, PyPI
  • Quality Profile & CLI — 5-dimension profile, ht CLI, quality gate, HTML drilldown
  • Scoring Consistency — unified scoring formula, tool detection fix
  • Analyzer Unification — plugin protocol, PythonAnalyzer, generic field names
  • Multi-Language — TypeScript analyzer, mixed-project support
  • Research Pipeline — dataset annotation, deduplication, BugsInPy validation

License

MIT

Metadata

Release files for dr-huatuo 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dr-huatuo 0.5.0
File Size Uploaded Provenance Actions
dr_huatuo-0.5.0.tar.gz 895.9 kB With provenance Details for dr_huatuo-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dr-huatuo 0.5.0
File Interpreter ABI Platform Actions
dr_huatuo-0.5.0-py3-none-any.whl Python 3 none any Details for dr_huatuo-0.5.0-py3-none-any.whl

Total release size: 974.2 kB

Release files / dr_huatuo-0.5.0.tar.gz

Download URL dr_huatuo-0.5.0.tar.gz
Size 895.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a87335db69e9303b73bfdf5c1790fb2a760e6bb5b5b3d5171428cbc0ea2c3b64
BLAKE2b-256 checksum
How to use checksums
f4778dd644d0c9a61e4253355d678150e8f166bc85eddbba5d724d87e14735fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.

Transparency log

Release files / dr_huatuo-0.5.0-py3-none-any.whl

Download URL dr_huatuo-0.5.0-py3-none-any.whl
Size 78.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bd99e8cc64d47626552e3e8e5f9694b868892dfb588f5c59c5beda5b0409a93
BLAKE2b-256 checksum
How to use checksums
666446fb3f13671a43edc0aefdf6a92704bd07e353342ad98246cb52ff61fd4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.

Transparency log

Security for dr-huatuo 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dr_huatuo-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page