codedoctor 0.1.1__tar.gz → 1.0.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.
Files changed (37) hide show
  1. codedoctor-1.0.0/.github/CODEOWNERS +1 -0
  2. codedoctor-1.0.0/.github/dependabot.yml +32 -0
  3. codedoctor-1.0.0/.github/pull_request_template.md +8 -0
  4. codedoctor-1.0.0/.github/workflows/ci.yml +49 -0
  5. codedoctor-1.0.0/.github/workflows/codeql.yml +36 -0
  6. codedoctor-1.0.0/.github/workflows/conventional-commits.yml +29 -0
  7. codedoctor-1.0.0/.github/workflows/gitleaks.yml +28 -0
  8. codedoctor-1.0.0/.github/workflows/release-please.yml +20 -0
  9. {codedoctor-0.1.1 → codedoctor-1.0.0}/.github/workflows/release.yml +5 -3
  10. {codedoctor-0.1.1 → codedoctor-1.0.0}/.gitignore +3 -1
  11. codedoctor-1.0.0/.pre-commit-config.yaml +25 -0
  12. codedoctor-1.0.0/CHANGELOG.md +12 -0
  13. {codedoctor-0.1.1 → codedoctor-1.0.0}/LICENSE +1 -1
  14. codedoctor-1.0.0/PKG-INFO +267 -0
  15. codedoctor-1.0.0/README.md +243 -0
  16. codedoctor-1.0.0/SECURITY.md +41 -0
  17. codedoctor-1.0.0/gitleaks.toml +13 -0
  18. {codedoctor-0.1.1 → codedoctor-1.0.0}/pyproject.toml +4 -2
  19. codedoctor-1.0.0/src/codedoctor/__init__.py +1 -0
  20. codedoctor-1.0.0/src/codedoctor/cli.py +410 -0
  21. codedoctor-1.0.0/src/codedoctor/config.py +67 -0
  22. codedoctor-1.0.0/src/codedoctor/runner.py +221 -0
  23. codedoctor-1.0.0/src/codedoctor/test_template.py +52 -0
  24. codedoctor-1.0.0/src/codedoctor/ui.py +61 -0
  25. codedoctor-1.0.0/src/codedoctor/updater.py +83 -0
  26. codedoctor-1.0.0/tests/test_smoke.py +9 -0
  27. codedoctor-0.1.1/.github/dependabot.yml +0 -12
  28. codedoctor-0.1.1/.github/workflows/ci.yml +0 -33
  29. codedoctor-0.1.1/.pre-commit-config.yaml +0 -12
  30. codedoctor-0.1.1/PKG-INFO +0 -172
  31. codedoctor-0.1.1/README.md +0 -150
  32. codedoctor-0.1.1/src/codedoctor/__init__.py +0 -0
  33. codedoctor-0.1.1/src/codedoctor/cli.py +0 -68
  34. codedoctor-0.1.1/src/codedoctor/runner.py +0 -107
  35. codedoctor-0.1.1/tests/test_smoke.py +0 -7
  36. {codedoctor-0.1.1 → codedoctor-1.0.0}/src/codedoctor/report.py +0 -0
  37. {codedoctor-0.1.1 → codedoctor-1.0.0}/src/codedoctor/storage.py +0 -0
@@ -0,0 +1 @@
1
+ * @BigPattyOG
@@ -0,0 +1,32 @@
1
+ version: 2
2
+
3
+ updates:
4
+ # Python dependencies (from pyproject.toml / requirements)
5
+ - package-ecosystem: "pip"
6
+ directory: "/"
7
+ target-branch: "main"
8
+ schedule:
9
+ interval: "weekly"
10
+ open-pull-requests-limit: 10
11
+ rebase-strategy: "auto"
12
+ labels:
13
+ - "dependencies"
14
+ groups:
15
+ python-dependencies:
16
+ patterns:
17
+ - "*"
18
+
19
+ # GitHub Actions used in .github/workflows/*.yml (including new workflows)
20
+ - package-ecosystem: "github-actions"
21
+ directory: "/"
22
+ target-branch: "main"
23
+ schedule:
24
+ interval: "weekly"
25
+ open-pull-requests-limit: 10
26
+ rebase-strategy: "auto"
27
+ labels:
28
+ - "dependencies"
29
+ groups:
30
+ github-actions:
31
+ patterns:
32
+ - "*"
@@ -0,0 +1,8 @@
1
+ ## Summary
2
+ <!-- What changed and why? -->
3
+
4
+ ## How to test
5
+ <!-- Commands or steps -->
6
+
7
+ ## Checklist
8
+ - [ ] PR title uses Conventional Commits (feat/fix/docs/chore/ci/etc.)
@@ -0,0 +1,49 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: ["main"]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ name: CI (Python 3.12)
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v6
20
+
21
+ - name: Setup Python
22
+ uses: actions/setup-python@v6
23
+ with:
24
+ python-version: "3.12"
25
+
26
+ - name: Install
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ python -m pip install -e ".[dev]"
30
+
31
+ - name: Ruff
32
+ run: ruff check .
33
+
34
+ - name: Black
35
+ run: black . --check
36
+
37
+ - name: MyPy
38
+ run: mypy . --pretty --show-error-codes
39
+
40
+ - name: Bandit (security)
41
+ run: bandit -r src -x tests
42
+
43
+ - name: Pytest
44
+ run: pytest -q
45
+
46
+ - name: Pip Audit (dependency vulnerabilities)
47
+ run: |
48
+ python -m pip install pip-audit
49
+ pip-audit
@@ -0,0 +1,36 @@
1
+ name: CodeQL
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+ branches: ["main"]
8
+ schedule:
9
+ - cron: "23 3 * * 1" # Weekly (Mon)
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ analyze:
16
+ name: Analyze (CodeQL)
17
+ runs-on: ubuntu-latest
18
+
19
+ permissions:
20
+ contents: read
21
+ security-events: write
22
+
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v6
26
+
27
+ - name: Initialize CodeQL
28
+ uses: github/codeql-action/init@v4
29
+ with:
30
+ languages: python
31
+
32
+ - name: Autobuild
33
+ uses: github/codeql-action/autobuild@v4
34
+
35
+ - name: Perform CodeQL Analysis
36
+ uses: github/codeql-action/analyze@v4
@@ -0,0 +1,29 @@
1
+ name: Conventional PR Title
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ semantic-pr-title:
12
+ name: Check Conventional Commits PR Title
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Validate PR title follows Conventional Commits
16
+ uses: amannn/action-semantic-pull-request@v6
17
+ env:
18
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19
+ with:
20
+ types: |
21
+ feat
22
+ fix
23
+ docs
24
+ chore
25
+ refactor
26
+ test
27
+ ci
28
+ build
29
+ requireScope: false
@@ -0,0 +1,28 @@
1
+ name: Gitleaks
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: ["main"]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ scan:
14
+ name: Secret scan (gitleaks)
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v6
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ - name: Run gitleaks
24
+ uses: gitleaks/gitleaks-action@v2
25
+ env:
26
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27
+ GITLEAKS_ENABLE_UPLOAD_ARTIFACT: "false"
28
+ GITLEAKS_ENABLE_SUMMARY: "true"
@@ -0,0 +1,20 @@
1
+ name: Release Please
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ release-please:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Release Please
17
+ uses: googleapis/release-please-action@v4
18
+ with:
19
+ release-type: python
20
+ package-name: codedoctor
@@ -14,10 +14,10 @@ jobs:
14
14
 
15
15
  steps:
16
16
  - name: Checkout
17
- uses: actions/checkout@v6
17
+ uses: actions/checkout@v4
18
18
 
19
19
  - name: Set up Python
20
- uses: actions/setup-python@v6
20
+ uses: actions/setup-python@v5
21
21
  with:
22
22
  python-version: "3.12"
23
23
 
@@ -43,6 +43,7 @@ jobs:
43
43
  environment: pypi
44
44
  permissions:
45
45
  id-token: write
46
+
46
47
  steps:
47
48
  - name: Download dist artifacts
48
49
  uses: actions/download-artifact@v4
@@ -59,6 +60,7 @@ jobs:
59
60
  runs-on: ubuntu-latest
60
61
  permissions:
61
62
  contents: write
63
+
62
64
  steps:
63
65
  - name: Download dist artifacts
64
66
  uses: actions/download-artifact@v4
@@ -69,4 +71,4 @@ jobs:
69
71
  - name: Create GitHub Release
70
72
  uses: softprops/action-gh-release@v2
71
73
  with:
72
- files: dist/*
74
+ files: dist/*
@@ -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,25 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: end-of-file-fixer
6
+ - id: trailing-whitespace
7
+ - id: check-yaml
8
+ - id: check-toml
9
+ - id: check-added-large-files
10
+
11
+ - repo: https://github.com/astral-sh/ruff-pre-commit
12
+ rev: v0.8.0
13
+ hooks:
14
+ - id: ruff
15
+ args: ["--fix"]
16
+
17
+ - repo: https://github.com/psf/black
18
+ rev: 26.1.0
19
+ hooks:
20
+ - id: black
21
+
22
+ - repo: https://github.com/gitleaks/gitleaks
23
+ rev: v8.18.4
24
+ hooks:
25
+ - id: gitleaks
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## [1.0.0](https://github.com/BigPattyOG/CodeDoctor/compare/v0.2.0...v1.0.0) (2026-02-23)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * Update to CodeDoctor and how it functions ([#16](https://github.com/BigPattyOG/CodeDoctor/issues/16))
9
+
10
+ ### Features
11
+
12
+ * Update to CodeDoctor and how it functions ([#16](https://github.com/BigPattyOG/CodeDoctor/issues/16)) ([e41c3e8](https://github.com/BigPattyOG/CodeDoctor/commit/e41c3e894984b671508411d608bfdedfbf628acd))
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: codedoctor
3
+ Version: 1.0.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: rich>=13.7
14
+ Requires-Dist: ruff>=0.9
15
+ Provides-Extra: dev
16
+ Requires-Dist: bandit>=1.7.0; extra == 'dev'
17
+ Requires-Dist: black>=24.0.0; extra == 'dev'
18
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
19
+ Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
20
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
21
+ Requires-Dist: rich>=13.7; extra == 'dev'
22
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # CodeDoctor
26
+
27
+ **CodeDoctor** is a beginner-friendly Python CLI that runs common quality checks
28
+ (linting, formatting, type checking, security scanning, and tests) against **any**
29
+ Python repository or folder you point it at, and produces a readable report.
30
+
31
+ It’s designed to be simple to run, easy to understand, and safe by default.
32
+
33
+ ---
34
+
35
+ ## Requirements
36
+
37
+ - Python **3.12+**
38
+ - (Recommended) `git` available on PATH for best `.gitignore` support
39
+
40
+ ---
41
+
42
+ ## Install
43
+
44
+ From PyPI:
45
+
46
+ ```bash
47
+ python -m pip install codedoctor
48
+ ```
49
+
50
+ Verify:
51
+
52
+ ```bash
53
+ codedoctor --help
54
+ codedoctor scan --help
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Setup (required)
60
+
61
+ Before running scans, initialize CodeDoctor once:
62
+
63
+ ```bash
64
+ codedoctor setup
65
+ ```
66
+
67
+ This creates a small config file in your user profile (JSON) that stores default
68
+ behavior (e.g., whether to respect `.gitignore`, default report directory, etc.).
69
+
70
+ ### CI / no-config environments
71
+
72
+ If you’re running in CI or you don’t want CodeDoctor to create a config file,
73
+ you can bypass the setup requirement with:
74
+
75
+ ```bash
76
+ codedoctor scan . --assume-defaults
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Quick Start
82
+
83
+ Scan the current folder:
84
+
85
+ ```bash
86
+ codedoctor scan .
87
+ ```
88
+
89
+ Scan a different path:
90
+
91
+ ```bash
92
+ codedoctor scan /path/to/repo
93
+ ```
94
+
95
+ On Windows:
96
+
97
+ ```powershell
98
+ codedoctor scan C:\path\to\repo
99
+ ```
100
+
101
+ Apply safe auto-fixes + formatting:
102
+
103
+ ```bash
104
+ codedoctor scan . --fix
105
+ ```
106
+
107
+ Skip tests:
108
+
109
+ ```bash
110
+ codedoctor scan . --skip-tests
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Commands
116
+
117
+ ### `codedoctor scan`
118
+
119
+ ```bash
120
+ codedoctor scan [PATH] [--fix] [--skip-tests] [--report-dir DIR] [--no-gitignore] \
121
+ [--no-update-check] [--assume-defaults]
122
+ ```
123
+
124
+ #### Options
125
+
126
+ - `PATH`
127
+ Repository/folder to scan (default: `.`)
128
+
129
+ - `--fix`
130
+ Apply safe auto-fixes (Ruff `--fix`) and format with Black.
131
+
132
+ - `--skip-tests`
133
+ Skip running `pytest`.
134
+
135
+ - `--report-dir DIR`
136
+ Directory (relative to the repo) to store reports. If omitted, uses the value
137
+ from your CodeDoctor config.
138
+
139
+ - `--no-gitignore`
140
+ Disable best-effort `.gitignore` handling (useful for debugging).
141
+
142
+ - `--no-update-check`
143
+ Disable the non-blocking “update available” notice during scans.
144
+
145
+ - `--assume-defaults`
146
+ Allow scanning without running `codedoctor setup` (useful for CI).
147
+
148
+ ---
149
+
150
+ ### `codedoctor setup`
151
+
152
+ ```bash
153
+ codedoctor setup [--force]
154
+ ```
155
+
156
+ Creates or updates the user config file.
157
+
158
+ - `--force` overwrites an existing config file.
159
+
160
+ ---
161
+
162
+ ### `codedoctor update`
163
+
164
+ ```bash
165
+ codedoctor update [--yes]
166
+ ```
167
+
168
+ Checks PyPI for the latest version and offers to upgrade CodeDoctor.
169
+
170
+ - `--yes` updates without prompting.
171
+
172
+ > Note: if CodeDoctor was installed into a locked or managed Python environment,
173
+ > `codedoctor update` may fail due to permissions. In that case, update using
174
+ > your environment’s normal package management approach (venv, pipx, etc.).
175
+
176
+ ---
177
+
178
+ ## What gets run during a scan
179
+
180
+ CodeDoctor invokes the following tools (when installed/available):
181
+
182
+ - `ruff check .` (and optionally `ruff check . --fix`)
183
+ - `black . --check` (and optionally `black .`)
184
+ - `mypy .`
185
+ - `bandit -r .`
186
+ - `pytest -q` (unless `--skip-tests`)
187
+
188
+ CodeDoctor runs tools in the target repo by setting `cwd` to the repo path.
189
+
190
+ ---
191
+
192
+ ## Reports
193
+
194
+ Reports are written under the repository (default `.codedoctor/`):
195
+
196
+ - `report-latest.txt` — newest scan
197
+ - `report-prev.txt` — previous scan (rotated)
198
+ - `report-YYYYMMDD-HHMMSS.txt` — timestamped snapshot
199
+
200
+ ---
201
+
202
+ ## `.gitignore` behavior (best effort)
203
+
204
+ Different tools treat ignore rules differently:
205
+
206
+ - **Ruff** and **Black** already respect `.gitignore` in typical setups.
207
+ - **MyPy** and **Bandit** do not consistently honor `.gitignore` the same way.
208
+
209
+ To provide consistent behavior, CodeDoctor will **attempt** to use git’s ignore
210
+ information when scanning a git repository by running:
211
+
212
+ ```bash
213
+ git ls-files -ci --exclude-standard
214
+ ```
215
+
216
+ Those ignored paths are then excluded from MyPy/Bandit runs.
217
+
218
+ If any of the following are true:
219
+ - the target folder is not a git repo
220
+ - `git` is not installed
221
+ - the git command fails
222
+
223
+ …CodeDoctor falls back to excluding common junk directories like `.venv`, `.git`,
224
+ caches, `build/`, and `dist/`.
225
+
226
+ ---
227
+
228
+ ## Exit Codes
229
+
230
+ CodeDoctor returns an exit code that matches the overall result:
231
+
232
+ - `0` — all checks passed
233
+ - `1` — warnings (non-fatal issues)
234
+ - `2` — failures (one or more checks failed)
235
+
236
+ Missing tools are treated as failures for that check (return code `127`) so the
237
+ report remains explicit and beginner-friendly.
238
+
239
+ ---
240
+
241
+ ## Development
242
+
243
+ Clone and install editable:
244
+
245
+ ```bash
246
+ git clone https://github.com/BigPattyOG/CodeDoctor.git
247
+ cd CodeDoctor
248
+ python -m pip install -e .
249
+ ```
250
+
251
+ Run setup:
252
+
253
+ ```bash
254
+ codedoctor setup
255
+ ```
256
+
257
+ Run a scan:
258
+
259
+ ```bash
260
+ codedoctor scan .
261
+ ```
262
+
263
+ ---
264
+
265
+ ## License
266
+
267
+ MIT License. See `LICENSE`.