codedoctor 0.1.4__tar.gz → 0.1.5__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.
- {codedoctor-0.1.4 → codedoctor-0.1.5}/.pre-commit-config.yaml +29 -29
- {codedoctor-0.1.4 → codedoctor-0.1.5}/CHANGELOG.md +16 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/PKG-INFO +27 -18
- {codedoctor-0.1.4 → codedoctor-0.1.5}/README.md +26 -17
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/assert_isinstance/unnecessary_assert_isinstance.py +14 -14
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/assert_isinstance/unnecessary_assert_isinstance_test.py +7 -7
- codedoctor-0.1.5/codedoctor/cli.py +128 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/cli_test.py +98 -8
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/install.py +116 -24
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/install_hooks.yaml +29 -29
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/install_test.py +215 -37
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/kernel_pins.py +2 -1
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/kernel_pins_test.py +4 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/pyproject_flags.py +9 -6
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/pyproject_flags_test.py +38 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/resources.py +5 -6
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lint/__main__.py +2 -2
- codedoctor-0.1.4/codedoctor/lint/houselint.py → codedoctor-0.1.5/codedoctor/lint/checker.py +73 -68
- codedoctor-0.1.4/codedoctor/lint/houselint_test.py → codedoctor-0.1.5/codedoctor/lint/checker_test.py +226 -228
- codedoctor-0.1.4/codedoctor/lint/houselint_types.py → codedoctor-0.1.5/codedoctor/lint/custom_types.py +1 -1
- codedoctor-0.1.4/codedoctor/lint/houselint_types_test.py → codedoctor-0.1.5/codedoctor/lint/custom_types_test.py +2 -2
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lint/house_ignore.py +10 -10
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lint/house_ignore_test.py +5 -5
- codedoctor-0.1.4/codedoctor/lint/houselint_rules.py → codedoctor-0.1.5/codedoctor/lint/rules.py +8 -8
- codedoctor-0.1.4/codedoctor/lint/houselint_rules_test.py → codedoctor-0.1.5/codedoctor/lint/rules_test.py +289 -175
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutated_test.py +0 -1
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/policy.py +9 -2
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/policy_test.py +50 -1
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/testing.py +12 -8
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/testing_test.py +7 -5
- {codedoctor-0.1.4 → codedoctor-0.1.5}/pyproject.toml +3 -3
- {codedoctor-0.1.4 → codedoctor-0.1.5}/tests/lib/testing/resources_test.py +1 -1
- {codedoctor-0.1.4 → codedoctor-0.1.5}/uv.lock +3 -3
- codedoctor-0.1.4/codedoctor/cli.py +0 -74
- {codedoctor-0.1.4 → codedoctor-0.1.5}/.gitignore +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/.python-version +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/AI_POLICY.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/CODE_OF_CONDUCT.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/CONTRIBUTING.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/LICENSE +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/RELEASING.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/SECURITY.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/affected.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/affected_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/backbone.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/backbone_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/codegraph_sync.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/affected/codegraph_sync_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/assert_isinstance/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/assert_isinstance/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/codegraph.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/codegraph_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/coverage_floor/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/coverage_floor/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/coverage_floor/coverage_floor.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/coverage_floor/coverage_floor_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/export_leaks/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/export_leaks/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/export_leaks/check_export_leaks.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/export_leaks/check_export_leaks_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/export_leaks/check_pr_text.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/export_leaks/check_pr_text_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/fakes.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/fakes_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/gate.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/gate_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/spool.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/gate/spool_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/glob.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/glob_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/grep.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/grep_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/owner_only.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/owner_only_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/source_version.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/source_version_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/tempclaim.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/tempclaim_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/walk.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/files/walk_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/sidecars.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/sidecars_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/basetemp.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/checks.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/checks_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/runner.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/runner_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/testing/wheel.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/userdirs.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/worker_count.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lib/worker_count_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/lint/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutated.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_dynamo.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_dynamo_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_kill_guard.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_kill_guard_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_outcome.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_outcome_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_param_ids.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_param_ids_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/nbstripout/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/nbstripout/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/nbstripout/nbstripout_hook.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/nbstripout/nbstripout_hook_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/py.typed +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/coverage_summary.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/coverage_summary_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/listing.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/listing_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/outcomes.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/outcomes_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/tiers.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/testing/tiers_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/typecheck/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/typecheck/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/typecheck/scope.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/typecheck/scope_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/typecheck/typecheck.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/typecheck/typecheck_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/yamlcheck/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/yamlcheck/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/yamlcheck/checker.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/yamlcheck/checker_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/conftest.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/tests/lib/testing/basetemp_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/tests/lib/testing/wheel_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/tests/lib/userdirs_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.5}/typings/.gitkeep +0 -0
|
@@ -176,7 +176,7 @@ repos:
|
|
|
176
176
|
name: check-yaml
|
|
177
177
|
stages: [pre-commit]
|
|
178
178
|
language: system
|
|
179
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
179
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor yamlcheck
|
|
180
180
|
|
|
181
181
|
- id: check-toml
|
|
182
182
|
name: check-toml
|
|
@@ -251,7 +251,7 @@ repos:
|
|
|
251
251
|
language: system
|
|
252
252
|
stages: [pre-commit]
|
|
253
253
|
types: [jupyter]
|
|
254
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
254
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor nbstripout
|
|
255
255
|
args:
|
|
256
256
|
- --drop-empty-cells
|
|
257
257
|
- --extra-keys
|
|
@@ -273,7 +273,7 @@ repos:
|
|
|
273
273
|
|(.*/)?third_party/
|
|
274
274
|
)
|
|
275
275
|
|
|
276
|
-
# Writes each notebook's paired `.py`, so it runs before
|
|
276
|
+
# Writes each notebook's paired `.py`, so it runs before codedoctor lint and
|
|
277
277
|
# ruff, which then lint and format that output in the same pass.
|
|
278
278
|
- id: jupytext-sync
|
|
279
279
|
name: jupytext-sync
|
|
@@ -296,7 +296,7 @@ repos:
|
|
|
296
296
|
# exactly once between them, so a hook per rule buys nothing and costs
|
|
297
297
|
# an interpreter startup each (measured, 120 files, 3 rules: 0.81s ->
|
|
298
298
|
# 0.45s). Which rules run, fix, and skip which paths lives in
|
|
299
|
-
# `[tool.
|
|
299
|
+
# `[tool.codedoctor.lint]` of pyproject.toml, so a bare `codedoctor lint
|
|
300
300
|
# FILES` behaves exactly as this hook does.
|
|
301
301
|
#
|
|
302
302
|
# `require_serial: true`: pre-commit's own partitioning would fork
|
|
@@ -307,13 +307,13 @@ repos:
|
|
|
307
307
|
# commit stays serial. Measured on the 128-thread server, best of 3: 5 files 0.16s
|
|
308
308
|
# serial vs 0.30s pooled; 50 files 0.92s vs 0.50s; the full tree (4094
|
|
309
309
|
# files) 21.8s serial vs 1.46s at 24 workers.
|
|
310
|
-
- id:
|
|
311
|
-
name:
|
|
310
|
+
- id: codedoctor-lint
|
|
311
|
+
name: codedoctor lint
|
|
312
312
|
language: system
|
|
313
313
|
stages: [pre-commit]
|
|
314
314
|
require_serial: true
|
|
315
315
|
types_or: [python, jupyter]
|
|
316
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
316
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor lint
|
|
317
317
|
|
|
318
318
|
- id: codespell
|
|
319
319
|
name: codespell
|
|
@@ -381,7 +381,7 @@ repos:
|
|
|
381
381
|
language: system
|
|
382
382
|
stages: [commit-msg]
|
|
383
383
|
always_run: true
|
|
384
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
384
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor check-pr-text
|
|
385
385
|
|
|
386
386
|
- repo: local
|
|
387
387
|
hooks:
|
|
@@ -478,7 +478,7 @@ repos:
|
|
|
478
478
|
types: [python]
|
|
479
479
|
pass_filenames: false
|
|
480
480
|
entry: >-
|
|
481
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
481
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor codegraph-sync
|
|
482
482
|
--caches /opt/scratch/caches/codegraph
|
|
483
483
|
|
|
484
484
|
# No official ty hook yet (https://github.com/astral-sh/ty/issues/269).
|
|
@@ -500,7 +500,7 @@ repos:
|
|
|
500
500
|
stages: [pre-commit]
|
|
501
501
|
require_serial: true
|
|
502
502
|
types_or: [python, pyi]
|
|
503
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
503
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool ty-check
|
|
504
504
|
|
|
505
505
|
- id: ty-check
|
|
506
506
|
name: ty-check
|
|
@@ -512,7 +512,7 @@ repos:
|
|
|
512
512
|
# See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
|
|
513
513
|
alias: superseded-at-pre-push
|
|
514
514
|
types_or: [python, pyi]
|
|
515
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
515
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck ty-check
|
|
516
516
|
# Resolved affected:N scopes read the index maintained above.
|
|
517
517
|
args: [--dependents, codedoctor.affected]
|
|
518
518
|
|
|
@@ -524,7 +524,7 @@ repos:
|
|
|
524
524
|
stages: [pre-commit]
|
|
525
525
|
require_serial: true
|
|
526
526
|
types_or: [python, pyi]
|
|
527
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
527
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool pyrefly-check
|
|
528
528
|
|
|
529
529
|
- id: pyrefly-check
|
|
530
530
|
name: pyrefly-check
|
|
@@ -536,7 +536,7 @@ repos:
|
|
|
536
536
|
# See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
|
|
537
537
|
alias: superseded-at-pre-push
|
|
538
538
|
types_or: [python, pyi]
|
|
539
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
539
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck pyrefly-check
|
|
540
540
|
# Widens on its own only when `ty-check` was skipped. The fixer is one
|
|
541
541
|
# pyrefly run that also deletes each unnecessary `assert isinstance`.
|
|
542
542
|
args:
|
|
@@ -555,7 +555,7 @@ repos:
|
|
|
555
555
|
stages: [pre-commit]
|
|
556
556
|
require_serial: true
|
|
557
557
|
types_or: [python, pyi]
|
|
558
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
558
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool basedpyright
|
|
559
559
|
exclude: |
|
|
560
560
|
(?x)^(
|
|
561
561
|
typings/
|
|
@@ -577,7 +577,7 @@ repos:
|
|
|
577
577
|
types_or: [python, pyi]
|
|
578
578
|
entry: >-
|
|
579
579
|
env NODE_OPTIONS=--max-old-space-size=2048
|
|
580
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
580
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck
|
|
581
581
|
basedpyright
|
|
582
582
|
# Widens as `ty-check` does; the fixer is one basedpyright run that
|
|
583
583
|
# also deletes each unnecessary `assert isinstance`.
|
|
@@ -606,7 +606,7 @@ repos:
|
|
|
606
606
|
language: system
|
|
607
607
|
stages: [pre-commit]
|
|
608
608
|
require_serial: true
|
|
609
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
609
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool check-export-leaks
|
|
610
610
|
|
|
611
611
|
- id: check-export-leaks
|
|
612
612
|
name: check-export-leaks
|
|
@@ -614,7 +614,7 @@ repos:
|
|
|
614
614
|
stages: [pre-commit]
|
|
615
615
|
require_serial: true
|
|
616
616
|
pass_filenames: false
|
|
617
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
617
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate run check-export-leaks -- codedoctor.export_leaks
|
|
618
618
|
|
|
619
619
|
# Runs the tests PAIRED with each changed file (`x_test.py`, `test_x.py`,
|
|
620
620
|
# beside it or under `tests/`), then applies `fail_under` to the changed
|
|
@@ -645,7 +645,7 @@ repos:
|
|
|
645
645
|
stages: [pre-commit]
|
|
646
646
|
require_serial: true
|
|
647
647
|
types: [python]
|
|
648
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
648
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool pytest
|
|
649
649
|
|
|
650
650
|
- id: pytest
|
|
651
651
|
name: pytest
|
|
@@ -659,7 +659,7 @@ repos:
|
|
|
659
659
|
# See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
|
|
660
660
|
alias: superseded-at-pre-push
|
|
661
661
|
types: [python]
|
|
662
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
662
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing pytest
|
|
663
663
|
args: [--dependents, codedoctor.affected]
|
|
664
664
|
|
|
665
665
|
# Disable with SKIP=mutation. Findings fail the hook. Over 741 commits,
|
|
@@ -679,7 +679,7 @@ repos:
|
|
|
679
679
|
|(.*/)?\.export/typings/
|
|
680
680
|
|(.*/)?third_party/
|
|
681
681
|
)
|
|
682
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
682
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool mutation
|
|
683
683
|
|
|
684
684
|
- id: mutation
|
|
685
685
|
name: mutation
|
|
@@ -693,7 +693,7 @@ repos:
|
|
|
693
693
|
types: [python]
|
|
694
694
|
exclude: *mutation-exclude
|
|
695
695
|
entry: >-
|
|
696
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
696
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor gate
|
|
697
697
|
run mutation -- codedoctor.mutation
|
|
698
698
|
--function-sample-rate 0.05 --max-functions-sampled 4 --timeout-sec 900
|
|
699
699
|
--explain --prefer-changed-in-pre-commit
|
|
@@ -712,7 +712,7 @@ repos:
|
|
|
712
712
|
stages: [pre-commit]
|
|
713
713
|
require_serial: true
|
|
714
714
|
types: [python]
|
|
715
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
715
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool coverage-floor
|
|
716
716
|
|
|
717
717
|
- id: coverage-floor
|
|
718
718
|
name: coverage-floor
|
|
@@ -722,7 +722,7 @@ repos:
|
|
|
722
722
|
types: [python]
|
|
723
723
|
require_serial: true
|
|
724
724
|
pass_filenames: false
|
|
725
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
725
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing coverage-floor
|
|
726
726
|
|
|
727
727
|
# === Pre-Push Gates =========================================================
|
|
728
728
|
#
|
|
@@ -765,7 +765,7 @@ repos:
|
|
|
765
765
|
stages: [manual]
|
|
766
766
|
entry: >-
|
|
767
767
|
env NODE_OPTIONS=--max-old-space-size=2048
|
|
768
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
768
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor gate
|
|
769
769
|
threaded basedpyright-global -- basedpyright --threads={workers}
|
|
770
770
|
|
|
771
771
|
- id: pyrefly-check-global
|
|
@@ -775,7 +775,7 @@ repos:
|
|
|
775
775
|
pass_filenames: false
|
|
776
776
|
stages: [pre-push]
|
|
777
777
|
entry: >-
|
|
778
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
778
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor gate
|
|
779
779
|
threaded pyrefly-check-global -- pyrefly check --threads={workers}
|
|
780
780
|
|
|
781
781
|
- id: pytest-global
|
|
@@ -785,7 +785,7 @@ repos:
|
|
|
785
785
|
pass_filenames: false
|
|
786
786
|
stages: [pre-push]
|
|
787
787
|
verbose: true
|
|
788
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
788
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-global
|
|
789
789
|
args: [--plugin, codedoctor.testing.listing]
|
|
790
790
|
|
|
791
791
|
- id: pytest-slow-global
|
|
@@ -795,7 +795,7 @@ repos:
|
|
|
795
795
|
pass_filenames: false
|
|
796
796
|
stages: [pre-push]
|
|
797
797
|
verbose: true
|
|
798
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
798
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-slow-global
|
|
799
799
|
args: [--plugin, codedoctor.testing.listing]
|
|
800
800
|
|
|
801
801
|
- id: pytest-ci-smoke-global
|
|
@@ -805,7 +805,7 @@ repos:
|
|
|
805
805
|
pass_filenames: false
|
|
806
806
|
stages: [pre-push]
|
|
807
807
|
verbose: true
|
|
808
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
808
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-ci-smoke-global
|
|
809
809
|
args: [--plugin, codedoctor.testing.listing]
|
|
810
810
|
|
|
811
811
|
- id: pytest-integration-global
|
|
@@ -815,7 +815,7 @@ repos:
|
|
|
815
815
|
pass_filenames: false
|
|
816
816
|
stages: [pre-push]
|
|
817
817
|
verbose: true
|
|
818
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
818
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-integration-global
|
|
819
819
|
args: [--plugin, codedoctor.testing.listing]
|
|
820
820
|
|
|
821
821
|
|
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable codedoctor changes are documented here. This project follows
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
5
|
|
|
6
|
+
## 0.1.5 - 2026-11-08
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- Run every stage through `codedoctor <stage>`.
|
|
11
|
+
- Rename houselint to `codedoctor lint` and migrate its configuration.
|
|
12
|
+
- Require `codedoctor install --notebooks` to add notebook tooling.
|
|
13
|
+
- Install only the pre-commit Git hook by default; pre-push remains opt-in.
|
|
14
|
+
- Let OpenBLAS detect the host's usable CPU instructions.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Preserve long hook commands, block scalars, arguments, and YAML aliases
|
|
19
|
+
during command migration.
|
|
20
|
+
- Cover projects with dynamic names when generating checker policy.
|
|
21
|
+
|
|
6
22
|
## 0.1.4 - 2026-11-07
|
|
7
23
|
|
|
8
24
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: codedoctor
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Pre-commit gates that run each heavy check once, sized to the machine.
|
|
5
5
|
Project-URL: Homepage, https://www.rekursiv.ai
|
|
6
6
|
Project-URL: Repository, https://github.com/rekursiv-ai/codedoctor
|
|
@@ -89,9 +89,13 @@ uv run --group pre-commit pre-commit run --all-files
|
|
|
89
89
|
## Repository setup
|
|
90
90
|
|
|
91
91
|
`codedoctor install` adds a locked `pre-commit` dependency group and installs
|
|
92
|
-
pre-commit
|
|
92
|
+
the pre-commit Git hook. It creates missing configuration and preserves
|
|
93
93
|
existing hooks, comments, hook arguments, and the project's Python support range.
|
|
94
94
|
Running it again does not duplicate hooks.
|
|
95
|
+
Notebook tooling is opt-in: `codedoctor install --notebooks` adds the notebook
|
|
96
|
+
extra and the `nbstripout` and `jupytext-sync` hooks. Default installs add
|
|
97
|
+
neither. Existing hooks are preserved, including previously added notebook
|
|
98
|
+
hooks.
|
|
95
99
|
|
|
96
100
|
The installer writes Ruff, ty, basedpyright, and pyrefly settings from the
|
|
97
101
|
package's bundled policy into `pyproject.toml`. It also configures pytest,
|
|
@@ -102,15 +106,16 @@ settings remain overrides; installation reports their names.
|
|
|
102
106
|
Codedoctor is development tooling, not an application dependency. Applications
|
|
103
107
|
can use their own user-directory helpers or inline XDG handling. The installer
|
|
104
108
|
uses the project name for `userdirs-namespace.namespace`; set it explicitly in
|
|
105
|
-
`[tool.
|
|
109
|
+
`[tool.codedoctor.lint]` to choose another namespace. `xdg-literal.helper` is unset
|
|
106
110
|
unless the project requires a shared helper.
|
|
107
111
|
|
|
108
112
|
Setup uses the same hook configuration as this repository, without its
|
|
109
113
|
package-export and Rust-only checks. Commits autofix whitespace, spelling,
|
|
110
|
-
|
|
114
|
+
Codedoctor lint, and Ruff formatting; check types with ty, pyrefly, and
|
|
111
115
|
basedpyright; and run paired tests, coverage checks, and sampled mutation tests.
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
Pre-push checks are opt-in: install them with `pre-commit install --hook-type
|
|
117
|
+
pre-push` to run repository-wide type checks and all test tiers.
|
|
118
|
+
Dependency-graph setup precedes affected-file checks.
|
|
114
119
|
|
|
115
120
|
Tests may use either `test_*.py` or `*_test.py`; existing discovery settings and
|
|
116
121
|
coverage thresholds are preserved. Hooks that rewrite files abort that attempt;
|
|
@@ -171,14 +176,14 @@ repos:
|
|
|
171
176
|
language: system
|
|
172
177
|
require_serial: true
|
|
173
178
|
types_or: [python, pyi]
|
|
174
|
-
entry: uv run
|
|
179
|
+
entry: uv run codedoctor gate spool ty-check
|
|
175
180
|
- id: ty-check
|
|
176
181
|
name: ty-check
|
|
177
182
|
language: system
|
|
178
183
|
require_serial: true
|
|
179
184
|
pass_filenames: false
|
|
180
185
|
types_or: [python, pyi]
|
|
181
|
-
entry: uv run
|
|
186
|
+
entry: uv run codedoctor typecheck ty-check
|
|
182
187
|
```
|
|
183
188
|
|
|
184
189
|
This repository's own [`.pre-commit-config.yaml`](.pre-commit-config.yaml) wires
|
|
@@ -186,17 +191,21 @@ every gate and is the fullest example.
|
|
|
186
191
|
|
|
187
192
|
## Gates
|
|
188
193
|
|
|
189
|
-
|
|
|
194
|
+
| Command | Runs |
|
|
190
195
|
|---|---|
|
|
191
|
-
| `codedoctor
|
|
192
|
-
| `codedoctor
|
|
193
|
-
| `codedoctor
|
|
194
|
-
| `codedoctor
|
|
195
|
-
| `codedoctor
|
|
196
|
-
| `codedoctor
|
|
197
|
-
| `codedoctor
|
|
198
|
-
| `codedoctor
|
|
199
|
-
| `codedoctor
|
|
196
|
+
| `codedoctor gate` | `spool`, `run` and `threaded`: the shared machinery |
|
|
197
|
+
| `codedoctor typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
|
|
198
|
+
| `codedoctor testing` | paired tests and whole-suite tiers |
|
|
199
|
+
| `codedoctor coverage-floor` | per-source coverage from the pytest gate |
|
|
200
|
+
| `codedoctor mutation` | changed-function mutation tests (`codedoctor[mutation]`) |
|
|
201
|
+
| `codedoctor lint` | AST rules configured in `[tool.codedoctor.lint]` |
|
|
202
|
+
| `codedoctor assert-isinstance` | redundant `assert isinstance` removal |
|
|
203
|
+
| `codedoctor affected` | files and tests reached through CodeGraph |
|
|
204
|
+
| `codedoctor nbstripout` | notebook output stripping |
|
|
205
|
+
| `codedoctor yamlcheck` | YAML validation, including Compose tags |
|
|
206
|
+
| `codedoctor export-leaks` | exported-package leak checks |
|
|
207
|
+
| `codedoctor codegraph-sync` | dependency-graph refresh |
|
|
208
|
+
| `codedoctor check-pr-text` | pull-request text validation |
|
|
200
209
|
|
|
201
210
|
Worker counts: `WORKERS_<HOOK_ID>` wins, then `WORKERS_DEFAULT`, then a count
|
|
202
211
|
derived from the machine's cores and free memory.
|
|
@@ -21,9 +21,13 @@ uv run --group pre-commit pre-commit run --all-files
|
|
|
21
21
|
## Repository setup
|
|
22
22
|
|
|
23
23
|
`codedoctor install` adds a locked `pre-commit` dependency group and installs
|
|
24
|
-
pre-commit
|
|
24
|
+
the pre-commit Git hook. It creates missing configuration and preserves
|
|
25
25
|
existing hooks, comments, hook arguments, and the project's Python support range.
|
|
26
26
|
Running it again does not duplicate hooks.
|
|
27
|
+
Notebook tooling is opt-in: `codedoctor install --notebooks` adds the notebook
|
|
28
|
+
extra and the `nbstripout` and `jupytext-sync` hooks. Default installs add
|
|
29
|
+
neither. Existing hooks are preserved, including previously added notebook
|
|
30
|
+
hooks.
|
|
27
31
|
|
|
28
32
|
The installer writes Ruff, ty, basedpyright, and pyrefly settings from the
|
|
29
33
|
package's bundled policy into `pyproject.toml`. It also configures pytest,
|
|
@@ -34,15 +38,16 @@ settings remain overrides; installation reports their names.
|
|
|
34
38
|
Codedoctor is development tooling, not an application dependency. Applications
|
|
35
39
|
can use their own user-directory helpers or inline XDG handling. The installer
|
|
36
40
|
uses the project name for `userdirs-namespace.namespace`; set it explicitly in
|
|
37
|
-
`[tool.
|
|
41
|
+
`[tool.codedoctor.lint]` to choose another namespace. `xdg-literal.helper` is unset
|
|
38
42
|
unless the project requires a shared helper.
|
|
39
43
|
|
|
40
44
|
Setup uses the same hook configuration as this repository, without its
|
|
41
45
|
package-export and Rust-only checks. Commits autofix whitespace, spelling,
|
|
42
|
-
|
|
46
|
+
Codedoctor lint, and Ruff formatting; check types with ty, pyrefly, and
|
|
43
47
|
basedpyright; and run paired tests, coverage checks, and sampled mutation tests.
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
Pre-push checks are opt-in: install them with `pre-commit install --hook-type
|
|
49
|
+
pre-push` to run repository-wide type checks and all test tiers.
|
|
50
|
+
Dependency-graph setup precedes affected-file checks.
|
|
46
51
|
|
|
47
52
|
Tests may use either `test_*.py` or `*_test.py`; existing discovery settings and
|
|
48
53
|
coverage thresholds are preserved. Hooks that rewrite files abort that attempt;
|
|
@@ -103,14 +108,14 @@ repos:
|
|
|
103
108
|
language: system
|
|
104
109
|
require_serial: true
|
|
105
110
|
types_or: [python, pyi]
|
|
106
|
-
entry: uv run
|
|
111
|
+
entry: uv run codedoctor gate spool ty-check
|
|
107
112
|
- id: ty-check
|
|
108
113
|
name: ty-check
|
|
109
114
|
language: system
|
|
110
115
|
require_serial: true
|
|
111
116
|
pass_filenames: false
|
|
112
117
|
types_or: [python, pyi]
|
|
113
|
-
entry: uv run
|
|
118
|
+
entry: uv run codedoctor typecheck ty-check
|
|
114
119
|
```
|
|
115
120
|
|
|
116
121
|
This repository's own [`.pre-commit-config.yaml`](.pre-commit-config.yaml) wires
|
|
@@ -118,17 +123,21 @@ every gate and is the fullest example.
|
|
|
118
123
|
|
|
119
124
|
## Gates
|
|
120
125
|
|
|
121
|
-
|
|
|
126
|
+
| Command | Runs |
|
|
122
127
|
|---|---|
|
|
123
|
-
| `codedoctor
|
|
124
|
-
| `codedoctor
|
|
125
|
-
| `codedoctor
|
|
126
|
-
| `codedoctor
|
|
127
|
-
| `codedoctor
|
|
128
|
-
| `codedoctor
|
|
129
|
-
| `codedoctor
|
|
130
|
-
| `codedoctor
|
|
131
|
-
| `codedoctor
|
|
128
|
+
| `codedoctor gate` | `spool`, `run` and `threaded`: the shared machinery |
|
|
129
|
+
| `codedoctor typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
|
|
130
|
+
| `codedoctor testing` | paired tests and whole-suite tiers |
|
|
131
|
+
| `codedoctor coverage-floor` | per-source coverage from the pytest gate |
|
|
132
|
+
| `codedoctor mutation` | changed-function mutation tests (`codedoctor[mutation]`) |
|
|
133
|
+
| `codedoctor lint` | AST rules configured in `[tool.codedoctor.lint]` |
|
|
134
|
+
| `codedoctor assert-isinstance` | redundant `assert isinstance` removal |
|
|
135
|
+
| `codedoctor affected` | files and tests reached through CodeGraph |
|
|
136
|
+
| `codedoctor nbstripout` | notebook output stripping |
|
|
137
|
+
| `codedoctor yamlcheck` | YAML validation, including Compose tags |
|
|
138
|
+
| `codedoctor export-leaks` | exported-package leak checks |
|
|
139
|
+
| `codedoctor codegraph-sync` | dependency-graph refresh |
|
|
140
|
+
| `codedoctor check-pr-text` | pull-request text validation |
|
|
132
141
|
|
|
133
142
|
Worker counts: `WORKERS_<HOOK_ID>` wins, then `WORKERS_DEFAULT`, then a count
|
|
134
143
|
derived from the machine's cores and free memory.
|
{codedoctor-0.1.4 → codedoctor-0.1.5}/codedoctor/assert_isinstance/unnecessary_assert_isinstance.py
RENAMED
|
@@ -21,9 +21,9 @@ than ``--checker`` (default: pyrefly), run once over copies with every
|
|
|
21
21
|
candidate replaced by ``pass``, report nothing new on those files. Those runs
|
|
22
22
|
happen only when the checker flagged something, and a crash fails the run.
|
|
23
23
|
|
|
24
|
-
Findings follow
|
|
24
|
+
Findings follow checker's contract: each is rule ``unnecessary-assert-isinstance``,
|
|
25
25
|
a ``house-ignore`` marker naming it suppresses it (and is reported once it
|
|
26
|
-
suppresses nothing), and ``[tool.
|
|
26
|
+
suppresses nothing), and ``[tool.codedoctor.lint] exclude`` entries naming it or every
|
|
27
27
|
rule skip the file. Exits 1 on any diagnostic, as basedpyright does; with
|
|
28
28
|
``--fix`` the unnecessary asserts are deleted, and the run still fails so the
|
|
29
29
|
fix gets reviewed.
|
|
@@ -56,8 +56,8 @@ from treekle import from_plain, json_loads
|
|
|
56
56
|
from codedoctor.lib import pyproject_flags
|
|
57
57
|
from codedoctor.lib.files import walk
|
|
58
58
|
from codedoctor.lib.worker_count import default_workers, worker_count
|
|
59
|
-
from codedoctor.lint import
|
|
60
|
-
from codedoctor.lint.
|
|
59
|
+
from codedoctor.lint import checker, house_ignore
|
|
60
|
+
from codedoctor.lint.custom_types import Finding, Unit
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
if TYPE_CHECKING:
|
|
@@ -511,8 +511,8 @@ def _unchanged(snapshots: dict[Path, str]) -> None:
|
|
|
511
511
|
raise SourceChangedError(f"{path} changed during type checking; rerun.")
|
|
512
512
|
|
|
513
513
|
|
|
514
|
-
# Read through
|
|
515
|
-
# to every
|
|
514
|
+
# Read through checker's own loader, so the excludes mean here what they mean
|
|
515
|
+
# to every checker rule: an entry naming this rule, or naming none, skips it.
|
|
516
516
|
def _honor_house_ignore(
|
|
517
517
|
candidates: Sequence[Finding],
|
|
518
518
|
*,
|
|
@@ -521,18 +521,18 @@ def _honor_house_ignore(
|
|
|
521
521
|
) -> list[Finding]:
|
|
522
522
|
"""Drop excluded and marker-suppressed findings; report markers that rotted."""
|
|
523
523
|
parser = argparse.ArgumentParser()
|
|
524
|
-
|
|
525
|
-
# From the cwd, as
|
|
524
|
+
checker._add_arguments(parser) # noqa: SLF001 -- one ``[tool.codedoctor.lint]`` reader.
|
|
525
|
+
# From the cwd, as checker itself reads it.
|
|
526
526
|
namespace, config_root = pyproject_flags.parse_args(
|
|
527
527
|
parser,
|
|
528
|
-
tool="
|
|
528
|
+
tool="codedoctor.lint",
|
|
529
529
|
argv=[],
|
|
530
530
|
)
|
|
531
|
-
known = {r.name for r in
|
|
531
|
+
known = {r.name for r in checker.default_rules()} | {rule}
|
|
532
532
|
exclude = [
|
|
533
533
|
entry
|
|
534
534
|
for spec in cast("list[str]", namespace.exclude)
|
|
535
|
-
if not (entry :=
|
|
535
|
+
if not (entry := checker.parse_exclusion(spec, known=known)).rules
|
|
536
536
|
or rule in entry.rules
|
|
537
537
|
]
|
|
538
538
|
kept: list[Finding] = []
|
|
@@ -542,10 +542,10 @@ def _honor_house_ignore(
|
|
|
542
542
|
# can yield a finding, and a marker names it literally.
|
|
543
543
|
if path.absolute() not in flagged and rule not in path.read_text():
|
|
544
544
|
continue
|
|
545
|
-
relative =
|
|
545
|
+
relative = checker._relative(path, config_root) # noqa: SLF001 -- same path view.
|
|
546
546
|
if any(entry.matches(relative) for entry in exclude):
|
|
547
547
|
continue
|
|
548
|
-
unit =
|
|
548
|
+
unit = checker.read_unit(path)
|
|
549
549
|
if not isinstance(unit, Unit):
|
|
550
550
|
continue
|
|
551
551
|
absolute = path.absolute()
|
|
@@ -823,7 +823,7 @@ def _check(flags: Flags) -> int:
|
|
|
823
823
|
for finding in findings:
|
|
824
824
|
if finding.rule == rule:
|
|
825
825
|
hits.setdefault(finding.path, []).append(finding.line)
|
|
826
|
-
# Repo-relative, as
|
|
826
|
+
# Repo-relative, as checker prints a finding.
|
|
827
827
|
sys.stdout.writelines(
|
|
828
828
|
f"{dataclasses.replace(f, path=f.path.absolute().relative_to(root))}\n"
|
|
829
829
|
for f in findings
|
|
@@ -499,7 +499,7 @@ def test_a_marker_that_suppresses_nothing_is_reported(
|
|
|
499
499
|
assert _main(monkeypatch, "m.py") == 1
|
|
500
500
|
|
|
501
501
|
assert capsys.readouterr().out == (
|
|
502
|
-
"m.py:1: [
|
|
502
|
+
"m.py:1: [codedoctor lint] superfluous inline ignore: "
|
|
503
503
|
"'unnecessary-assert-isinstance' reports nothing on this statement; "
|
|
504
504
|
"remove it from house-ignore[...]\n" + _SUMMARY
|
|
505
505
|
)
|
|
@@ -514,14 +514,14 @@ def test_a_marker_that_suppresses_nothing_is_reported(
|
|
|
514
514
|
],
|
|
515
515
|
ids=["names-rule", "every-rule", "other-rule"],
|
|
516
516
|
)
|
|
517
|
-
def
|
|
517
|
+
def test_lint_excludes_skip_the_file(
|
|
518
518
|
tmp_path: Path,
|
|
519
519
|
monkeypatch: pytest.MonkeyPatch,
|
|
520
520
|
capsys: pytest.CaptureFixture[str],
|
|
521
521
|
entry: str,
|
|
522
522
|
skipped: bool,
|
|
523
523
|
) -> None:
|
|
524
|
-
_project(tmp_path, monkeypatch=monkeypatch,
|
|
524
|
+
_project(tmp_path, monkeypatch=monkeypatch, lint=f"exclude = [{entry}]\n")
|
|
525
525
|
_replay(monkeypatch, flagged=True)
|
|
526
526
|
|
|
527
527
|
assert _main(monkeypatch, "m.py") == int(not skipped)
|
|
@@ -881,7 +881,7 @@ def test_excluded_and_unlintable_sources_do_not_end_the_scan(
|
|
|
881
881
|
monkeypatch: pytest.MonkeyPatch,
|
|
882
882
|
capsys: pytest.CaptureFixture[str],
|
|
883
883
|
) -> None:
|
|
884
|
-
_project(tmp_path, monkeypatch=monkeypatch,
|
|
884
|
+
_project(tmp_path, monkeypatch=monkeypatch, lint='exclude = ["a.py"]\n')
|
|
885
885
|
(tmp_path / "a.py").write_text("x = 1\n")
|
|
886
886
|
(tmp_path / "notes.txt").write_text("x\n")
|
|
887
887
|
_replay(monkeypatch, flagged=True)
|
|
@@ -1695,12 +1695,12 @@ def _project(
|
|
|
1695
1695
|
root: Path,
|
|
1696
1696
|
*,
|
|
1697
1697
|
monkeypatch: pytest.MonkeyPatch,
|
|
1698
|
-
|
|
1698
|
+
lint: str = "",
|
|
1699
1699
|
) -> None:
|
|
1700
1700
|
"""Make ``root`` the cwd: a basedpyright project holding ``m.py``."""
|
|
1701
1701
|
(root / "pyproject.toml").write_text(
|
|
1702
1702
|
'[tool.basedpyright]\ntypeCheckingMode = "recommended"\n'
|
|
1703
|
-
+ (f"[tool.
|
|
1703
|
+
+ (f"[tool.codedoctor.lint]\n{lint}" if lint else ""),
|
|
1704
1704
|
)
|
|
1705
1705
|
(root / "m.py").write_text(_SOURCE)
|
|
1706
1706
|
monkeypatch.chdir(root)
|
|
@@ -1988,7 +1988,7 @@ def test_marker_prefilter_does_not_end_the_scan_before_later_asserts(
|
|
|
1988
1988
|
monkeypatch: pytest.MonkeyPatch,
|
|
1989
1989
|
first: str,
|
|
1990
1990
|
) -> None:
|
|
1991
|
-
_project(tmp_path, monkeypatch=monkeypatch,
|
|
1991
|
+
_project(tmp_path, monkeypatch=monkeypatch, lint='exclude = ["a.py"]\n')
|
|
1992
1992
|
marker = "x = 1 # house-ignore[unnecessary-assert-isinstance] -- Kept.\n"
|
|
1993
1993
|
(tmp_path / first).write_text(marker)
|
|
1994
1994
|
_replay(monkeypatch, flagged=True)
|