codedoctor 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,4 +4,6 @@
4
4
  .pytest_cache/
5
5
  .codedoctor
6
6
  src/codedoctor/__pycache__/
7
- tests/__pycache__/
7
+ tests/__pycache__/
8
+
9
+ poetry.lock
@@ -0,0 +1,265 @@
1
+ Metadata-Version: 2.4
2
+ Name: codedoctor
3
+ Version: 0.2.0
4
+ Summary: Beginner-friendly codebase doctor: lint, format, type-check, security and tests.
5
+ Author-email: Patrick Faint <pattymayo3@icloud.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.12
9
+ Requires-Dist: bandit>=1.7
10
+ Requires-Dist: black>=24.0
11
+ Requires-Dist: mypy>=1.8
12
+ Requires-Dist: pytest>=8
13
+ Requires-Dist: ruff>=0.9
14
+ Provides-Extra: dev
15
+ Requires-Dist: bandit>=1.7.0; extra == 'dev'
16
+ Requires-Dist: black>=24.0.0; extra == 'dev'
17
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
18
+ Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
19
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
20
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
21
+ Description-Content-Type: text/markdown
22
+
23
+ # CodeDoctor
24
+
25
+ **CodeDoctor** is a beginner-friendly Python CLI that runs common quality checks
26
+ (linting, formatting, type checking, security scanning, and tests) against **any**
27
+ Python repository or folder you point it at, and produces a readable report.
28
+
29
+ It’s designed to be simple to run, easy to understand, and safe by default.
30
+
31
+ ---
32
+
33
+ ## Requirements
34
+
35
+ - Python **3.12+**
36
+ - (Recommended) `git` available on PATH for best `.gitignore` support
37
+
38
+ ---
39
+
40
+ ## Install
41
+
42
+ From PyPI:
43
+
44
+ ```bash
45
+ python -m pip install codedoctor
46
+ ```
47
+
48
+ Verify:
49
+
50
+ ```bash
51
+ codedoctor --help
52
+ codedoctor scan --help
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Setup (required)
58
+
59
+ Before running scans, initialize CodeDoctor once:
60
+
61
+ ```bash
62
+ codedoctor setup
63
+ ```
64
+
65
+ This creates a small config file in your user profile (JSON) that stores default
66
+ behavior (e.g., whether to respect `.gitignore`, default report directory, etc.).
67
+
68
+ ### CI / no-config environments
69
+
70
+ If you’re running in CI or you don’t want CodeDoctor to create a config file,
71
+ you can bypass the setup requirement with:
72
+
73
+ ```bash
74
+ codedoctor scan . --assume-defaults
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Quick Start
80
+
81
+ Scan the current folder:
82
+
83
+ ```bash
84
+ codedoctor scan .
85
+ ```
86
+
87
+ Scan a different path:
88
+
89
+ ```bash
90
+ codedoctor scan /path/to/repo
91
+ ```
92
+
93
+ On Windows:
94
+
95
+ ```powershell
96
+ codedoctor scan C:\path\to\repo
97
+ ```
98
+
99
+ Apply safe auto-fixes + formatting:
100
+
101
+ ```bash
102
+ codedoctor scan . --fix
103
+ ```
104
+
105
+ Skip tests:
106
+
107
+ ```bash
108
+ codedoctor scan . --skip-tests
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Commands
114
+
115
+ ### `codedoctor scan`
116
+
117
+ ```bash
118
+ codedoctor scan [PATH] [--fix] [--skip-tests] [--report-dir DIR] [--no-gitignore] \
119
+ [--no-update-check] [--assume-defaults]
120
+ ```
121
+
122
+ #### Options
123
+
124
+ - `PATH`
125
+ Repository/folder to scan (default: `.`)
126
+
127
+ - `--fix`
128
+ Apply safe auto-fixes (Ruff `--fix`) and format with Black.
129
+
130
+ - `--skip-tests`
131
+ Skip running `pytest`.
132
+
133
+ - `--report-dir DIR`
134
+ Directory (relative to the repo) to store reports. If omitted, uses the value
135
+ from your CodeDoctor config.
136
+
137
+ - `--no-gitignore`
138
+ Disable best-effort `.gitignore` handling (useful for debugging).
139
+
140
+ - `--no-update-check`
141
+ Disable the non-blocking “update available” notice during scans.
142
+
143
+ - `--assume-defaults`
144
+ Allow scanning without running `codedoctor setup` (useful for CI).
145
+
146
+ ---
147
+
148
+ ### `codedoctor setup`
149
+
150
+ ```bash
151
+ codedoctor setup [--force]
152
+ ```
153
+
154
+ Creates or updates the user config file.
155
+
156
+ - `--force` overwrites an existing config file.
157
+
158
+ ---
159
+
160
+ ### `codedoctor update`
161
+
162
+ ```bash
163
+ codedoctor update [--yes]
164
+ ```
165
+
166
+ Checks PyPI for the latest version and offers to upgrade CodeDoctor.
167
+
168
+ - `--yes` updates without prompting.
169
+
170
+ > Note: if CodeDoctor was installed into a locked or managed Python environment,
171
+ > `codedoctor update` may fail due to permissions. In that case, update using
172
+ > your environment’s normal package management approach (venv, pipx, etc.).
173
+
174
+ ---
175
+
176
+ ## What gets run during a scan
177
+
178
+ CodeDoctor invokes the following tools (when installed/available):
179
+
180
+ - `ruff check .` (and optionally `ruff check . --fix`)
181
+ - `black . --check` (and optionally `black .`)
182
+ - `mypy .`
183
+ - `bandit -r .`
184
+ - `pytest -q` (unless `--skip-tests`)
185
+
186
+ CodeDoctor runs tools in the target repo by setting `cwd` to the repo path.
187
+
188
+ ---
189
+
190
+ ## Reports
191
+
192
+ Reports are written under the repository (default `.codedoctor/`):
193
+
194
+ - `report-latest.txt` — newest scan
195
+ - `report-prev.txt` — previous scan (rotated)
196
+ - `report-YYYYMMDD-HHMMSS.txt` — timestamped snapshot
197
+
198
+ ---
199
+
200
+ ## `.gitignore` behavior (best effort)
201
+
202
+ Different tools treat ignore rules differently:
203
+
204
+ - **Ruff** and **Black** already respect `.gitignore` in typical setups.
205
+ - **MyPy** and **Bandit** do not consistently honor `.gitignore` the same way.
206
+
207
+ To provide consistent behavior, CodeDoctor will **attempt** to use git’s ignore
208
+ information when scanning a git repository by running:
209
+
210
+ ```bash
211
+ git ls-files -ci --exclude-standard
212
+ ```
213
+
214
+ Those ignored paths are then excluded from MyPy/Bandit runs.
215
+
216
+ If any of the following are true:
217
+ - the target folder is not a git repo
218
+ - `git` is not installed
219
+ - the git command fails
220
+
221
+ …CodeDoctor falls back to excluding common junk directories like `.venv`, `.git`,
222
+ caches, `build/`, and `dist/`.
223
+
224
+ ---
225
+
226
+ ## Exit Codes
227
+
228
+ CodeDoctor returns an exit code that matches the overall result:
229
+
230
+ - `0` — all checks passed
231
+ - `1` — warnings (non-fatal issues)
232
+ - `2` — failures (one or more checks failed)
233
+
234
+ Missing tools are treated as failures for that check (return code `127`) so the
235
+ report remains explicit and beginner-friendly.
236
+
237
+ ---
238
+
239
+ ## Development
240
+
241
+ Clone and install editable:
242
+
243
+ ```bash
244
+ git clone https://github.com/BigPattyOG/CodeDoctor.git
245
+ cd CodeDoctor
246
+ python -m pip install -e .
247
+ ```
248
+
249
+ Run setup:
250
+
251
+ ```bash
252
+ codedoctor setup
253
+ ```
254
+
255
+ Run a scan:
256
+
257
+ ```bash
258
+ codedoctor scan .
259
+ ```
260
+
261
+ ---
262
+
263
+ ## License
264
+
265
+ MIT License. See `LICENSE`.
@@ -0,0 +1,243 @@
1
+ # CodeDoctor
2
+
3
+ **CodeDoctor** is a beginner-friendly Python CLI that runs common quality checks
4
+ (linting, formatting, type checking, security scanning, and tests) against **any**
5
+ Python repository or folder you point it at, and produces a readable report.
6
+
7
+ It’s designed to be simple to run, easy to understand, and safe by default.
8
+
9
+ ---
10
+
11
+ ## Requirements
12
+
13
+ - Python **3.12+**
14
+ - (Recommended) `git` available on PATH for best `.gitignore` support
15
+
16
+ ---
17
+
18
+ ## Install
19
+
20
+ From PyPI:
21
+
22
+ ```bash
23
+ python -m pip install codedoctor
24
+ ```
25
+
26
+ Verify:
27
+
28
+ ```bash
29
+ codedoctor --help
30
+ codedoctor scan --help
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Setup (required)
36
+
37
+ Before running scans, initialize CodeDoctor once:
38
+
39
+ ```bash
40
+ codedoctor setup
41
+ ```
42
+
43
+ This creates a small config file in your user profile (JSON) that stores default
44
+ behavior (e.g., whether to respect `.gitignore`, default report directory, etc.).
45
+
46
+ ### CI / no-config environments
47
+
48
+ If you’re running in CI or you don’t want CodeDoctor to create a config file,
49
+ you can bypass the setup requirement with:
50
+
51
+ ```bash
52
+ codedoctor scan . --assume-defaults
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Quick Start
58
+
59
+ Scan the current folder:
60
+
61
+ ```bash
62
+ codedoctor scan .
63
+ ```
64
+
65
+ Scan a different path:
66
+
67
+ ```bash
68
+ codedoctor scan /path/to/repo
69
+ ```
70
+
71
+ On Windows:
72
+
73
+ ```powershell
74
+ codedoctor scan C:\path\to\repo
75
+ ```
76
+
77
+ Apply safe auto-fixes + formatting:
78
+
79
+ ```bash
80
+ codedoctor scan . --fix
81
+ ```
82
+
83
+ Skip tests:
84
+
85
+ ```bash
86
+ codedoctor scan . --skip-tests
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Commands
92
+
93
+ ### `codedoctor scan`
94
+
95
+ ```bash
96
+ codedoctor scan [PATH] [--fix] [--skip-tests] [--report-dir DIR] [--no-gitignore] \
97
+ [--no-update-check] [--assume-defaults]
98
+ ```
99
+
100
+ #### Options
101
+
102
+ - `PATH`
103
+ Repository/folder to scan (default: `.`)
104
+
105
+ - `--fix`
106
+ Apply safe auto-fixes (Ruff `--fix`) and format with Black.
107
+
108
+ - `--skip-tests`
109
+ Skip running `pytest`.
110
+
111
+ - `--report-dir DIR`
112
+ Directory (relative to the repo) to store reports. If omitted, uses the value
113
+ from your CodeDoctor config.
114
+
115
+ - `--no-gitignore`
116
+ Disable best-effort `.gitignore` handling (useful for debugging).
117
+
118
+ - `--no-update-check`
119
+ Disable the non-blocking “update available” notice during scans.
120
+
121
+ - `--assume-defaults`
122
+ Allow scanning without running `codedoctor setup` (useful for CI).
123
+
124
+ ---
125
+
126
+ ### `codedoctor setup`
127
+
128
+ ```bash
129
+ codedoctor setup [--force]
130
+ ```
131
+
132
+ Creates or updates the user config file.
133
+
134
+ - `--force` overwrites an existing config file.
135
+
136
+ ---
137
+
138
+ ### `codedoctor update`
139
+
140
+ ```bash
141
+ codedoctor update [--yes]
142
+ ```
143
+
144
+ Checks PyPI for the latest version and offers to upgrade CodeDoctor.
145
+
146
+ - `--yes` updates without prompting.
147
+
148
+ > Note: if CodeDoctor was installed into a locked or managed Python environment,
149
+ > `codedoctor update` may fail due to permissions. In that case, update using
150
+ > your environment’s normal package management approach (venv, pipx, etc.).
151
+
152
+ ---
153
+
154
+ ## What gets run during a scan
155
+
156
+ CodeDoctor invokes the following tools (when installed/available):
157
+
158
+ - `ruff check .` (and optionally `ruff check . --fix`)
159
+ - `black . --check` (and optionally `black .`)
160
+ - `mypy .`
161
+ - `bandit -r .`
162
+ - `pytest -q` (unless `--skip-tests`)
163
+
164
+ CodeDoctor runs tools in the target repo by setting `cwd` to the repo path.
165
+
166
+ ---
167
+
168
+ ## Reports
169
+
170
+ Reports are written under the repository (default `.codedoctor/`):
171
+
172
+ - `report-latest.txt` — newest scan
173
+ - `report-prev.txt` — previous scan (rotated)
174
+ - `report-YYYYMMDD-HHMMSS.txt` — timestamped snapshot
175
+
176
+ ---
177
+
178
+ ## `.gitignore` behavior (best effort)
179
+
180
+ Different tools treat ignore rules differently:
181
+
182
+ - **Ruff** and **Black** already respect `.gitignore` in typical setups.
183
+ - **MyPy** and **Bandit** do not consistently honor `.gitignore` the same way.
184
+
185
+ To provide consistent behavior, CodeDoctor will **attempt** to use git’s ignore
186
+ information when scanning a git repository by running:
187
+
188
+ ```bash
189
+ git ls-files -ci --exclude-standard
190
+ ```
191
+
192
+ Those ignored paths are then excluded from MyPy/Bandit runs.
193
+
194
+ If any of the following are true:
195
+ - the target folder is not a git repo
196
+ - `git` is not installed
197
+ - the git command fails
198
+
199
+ …CodeDoctor falls back to excluding common junk directories like `.venv`, `.git`,
200
+ caches, `build/`, and `dist/`.
201
+
202
+ ---
203
+
204
+ ## Exit Codes
205
+
206
+ CodeDoctor returns an exit code that matches the overall result:
207
+
208
+ - `0` — all checks passed
209
+ - `1` — warnings (non-fatal issues)
210
+ - `2` — failures (one or more checks failed)
211
+
212
+ Missing tools are treated as failures for that check (return code `127`) so the
213
+ report remains explicit and beginner-friendly.
214
+
215
+ ---
216
+
217
+ ## Development
218
+
219
+ Clone and install editable:
220
+
221
+ ```bash
222
+ git clone https://github.com/BigPattyOG/CodeDoctor.git
223
+ cd CodeDoctor
224
+ python -m pip install -e .
225
+ ```
226
+
227
+ Run setup:
228
+
229
+ ```bash
230
+ codedoctor setup
231
+ ```
232
+
233
+ Run a scan:
234
+
235
+ ```bash
236
+ codedoctor scan .
237
+ ```
238
+
239
+ ---
240
+
241
+ ## License
242
+
243
+ MIT License. See `LICENSE`.
@@ -4,13 +4,19 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "codedoctor"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Beginner-friendly codebase doctor: lint, format, type-check, security and tests."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
11
11
  license = "MIT"
12
12
  authors = [{ name = "Patrick Faint", email = "pattymayo3@icloud.com" }]
13
- dependencies = []
13
+ dependencies = [
14
+ "ruff>=0.9",
15
+ "black>=24.0",
16
+ "mypy>=1.8",
17
+ "bandit>=1.7",
18
+ "pytest>=8",
19
+ ]
14
20
 
15
21
  [project.optional-dependencies]
16
22
  dev = [