Beginner-friendly codebase doctor: lint, format, type-check, security and tests.
Project description
CodeDoctor
CodeDoctor is a beginner-friendly Python CLI that runs common quality checks (linting, formatting, type checking, security scanning, and tests) against any Python repository or folder you point it at, and produces a readable report.
It’s designed to be simple to run, easy to understand, and safe by default.
Requirements
- Python 3.12+
- (Recommended)
gitavailable on PATH for best.gitignoresupport
Install
From PyPI:
python -m pip install codedoctor
Verify:
codedoctor --help
codedoctor scan --help
Setup (required)
Before running scans, initialize CodeDoctor once:
codedoctor setup
This creates a small config file in your user profile (JSON) that stores default
behavior (e.g., whether to respect .gitignore, default report directory, etc.).
CI / no-config environments
If you’re running in CI or you don’t want CodeDoctor to create a config file, you can bypass the setup requirement with:
codedoctor scan . --assume-defaults
Quick Start
Scan the current folder:
codedoctor scan .
Scan a different path:
codedoctor scan /path/to/repo
On Windows:
codedoctor scan C:\path\to\repo
Apply safe auto-fixes + formatting:
codedoctor scan . --fix
Skip tests:
codedoctor scan . --skip-tests
Commands
codedoctor scan
codedoctor scan [PATH] [--fix] [--skip-tests] [--report-dir DIR] [--no-gitignore] \
[--no-update-check] [--assume-defaults]
Options
-
PATHRepository/folder to scan (default:.) -
--fixApply safe auto-fixes (Ruff--fix) and format with Black. -
--skip-testsSkip runningpytest. -
--report-dir DIRDirectory (relative to the repo) to store reports. If omitted, uses the value from your CodeDoctor config. -
--no-gitignoreDisable best-effort.gitignorehandling (useful for debugging). -
--no-update-checkDisable the non-blocking “update available” notice during scans. -
--assume-defaultsAllow scanning without runningcodedoctor setup(useful for CI).
codedoctor setup
codedoctor setup [--force]
Creates or updates the user config file.
--forceoverwrites an existing config file.
codedoctor update
codedoctor update [--yes]
Checks PyPI for the latest version and offers to upgrade CodeDoctor.
--yesupdates without prompting.
Note: if CodeDoctor was installed into a locked or managed Python environment,
codedoctor updatemay fail due to permissions. In that case, update using your environment’s normal package management approach (venv, pipx, etc.).
What gets run during a scan
CodeDoctor invokes the following tools (when installed/available):
ruff check .(and optionallyruff check . --fix)black . --check(and optionallyblack .)mypy .bandit -r .pytest -q(unless--skip-tests)
CodeDoctor runs tools in the target repo by setting cwd to the repo path.
Reports
Reports are written under the repository (default .codedoctor/):
report-latest.txt— newest scanreport-prev.txt— previous scan (rotated)report-YYYYMMDD-HHMMSS.txt— timestamped snapshot
.gitignore behavior (best effort)
Different tools treat ignore rules differently:
- Ruff and Black already respect
.gitignorein typical setups. - MyPy and Bandit do not consistently honor
.gitignorethe same way.
To provide consistent behavior, CodeDoctor will attempt to use git’s ignore information when scanning a git repository by running:
git ls-files -ci --exclude-standard
Those ignored paths are then excluded from MyPy/Bandit runs.
If any of the following are true:
- the target folder is not a git repo
gitis not installed- the git command fails
…CodeDoctor falls back to excluding common junk directories like .venv, .git,
caches, build/, and dist/.
Exit Codes
CodeDoctor returns an exit code that matches the overall result:
0— all checks passed1— warnings (non-fatal issues)2— failures (one or more checks failed)
Missing tools are treated as failures for that check (return code 127) so the
report remains explicit and beginner-friendly.
Development
Clone and install editable:
git clone https://github.com/BigPattyOG/CodeDoctor.git
cd CodeDoctor
python -m pip install -e .
Run setup:
codedoctor setup
Run a scan:
codedoctor scan .
License
MIT License. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codedoctor-1.0.0.tar.gz.
File metadata
- Download URL: codedoctor-1.0.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7d67c13a6cd8f0dfadba558e511d97ff13e014c4700cdd851a64ba4250fb54a
|
|
| MD5 |
523822dda50f163ea72f398117a819ef
|
|
| BLAKE2b-256 |
f7b0880f0e8b763a647556fab61017acd9e51e6dcfe496f9fcde4a375a9652d2
|
Provenance
The following attestation bundles were made for codedoctor-1.0.0.tar.gz:
Publisher:
release.yml on BigPattyOG/CodeDoctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codedoctor-1.0.0.tar.gz -
Subject digest:
a7d67c13a6cd8f0dfadba558e511d97ff13e014c4700cdd851a64ba4250fb54a - Sigstore transparency entry: 979564165
- Sigstore integration time:
-
Permalink:
BigPattyOG/CodeDoctor@8d38a4ba71bb7b560d6a4df80d18766a6e7105b0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/BigPattyOG
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8d38a4ba71bb7b560d6a4df80d18766a6e7105b0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codedoctor-1.0.0-py3-none-any.whl.
File metadata
- Download URL: codedoctor-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3de5e4d660de364a985959188f173589243c69606be3e74b60b79b37bff1b8da
|
|
| MD5 |
b90cd4a78a7be91e8ed67044e0474e3c
|
|
| BLAKE2b-256 |
361cf0a280005f84d66a663f4693487fcfb47c819227aebc8727ce8d78501695
|
Provenance
The following attestation bundles were made for codedoctor-1.0.0-py3-none-any.whl:
Publisher:
release.yml on BigPattyOG/CodeDoctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codedoctor-1.0.0-py3-none-any.whl -
Subject digest:
3de5e4d660de364a985959188f173589243c69606be3e74b60b79b37bff1b8da - Sigstore transparency entry: 979564226
- Sigstore integration time:
-
Permalink:
BigPattyOG/CodeDoctor@8d38a4ba71bb7b560d6a4df80d18766a6e7105b0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/BigPattyOG
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8d38a4ba71bb7b560d6a4df80d18766a6e7105b0 -
Trigger Event:
push
-
Statement type: