codedoctor 0.1.4__tar.gz → 0.1.6__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.6}/.pre-commit-config.yaml +117 -49
- {codedoctor-0.1.4 → codedoctor-0.1.6}/CHANGELOG.md +28 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/PKG-INFO +33 -21
- {codedoctor-0.1.4 → codedoctor-0.1.6}/README.md +32 -20
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/affected.py +3 -3
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/affected_test.py +20 -12
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/assert_isinstance/unnecessary_assert_isinstance.py +42 -25
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/assert_isinstance/unnecessary_assert_isinstance_test.py +22 -11
- codedoctor-0.1.6/codedoctor/cargo/__init__.py +1 -0
- {codedoctor-0.1.4/codedoctor/lint → codedoctor-0.1.6/codedoctor/cargo}/__main__.py +2 -2
- codedoctor-0.1.6/codedoctor/cargo/cargo.py +81 -0
- codedoctor-0.1.6/codedoctor/cargo/cargo_test.py +135 -0
- codedoctor-0.1.6/codedoctor/cli.py +129 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/cli_test.py +99 -8
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/coverage_floor/coverage_floor_test.py +9 -4
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/export_leaks/check_export_leaks.py +212 -4
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/export_leaks/check_export_leaks_test.py +264 -13
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/gate.py +3 -3
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/install.py +187 -56
- codedoctor-0.1.6/codedoctor/install_biome.json +59 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/install_hooks.yaml +95 -185
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/install_test.py +394 -54
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/glob.py +153 -72
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/glob_test.py +150 -57
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/grep.py +290 -141
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/grep_test.py +387 -120
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/tempclaim.py +16 -2
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/tempclaim_test.py +30 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/kernel_pins.py +2 -1
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/kernel_pins_test.py +4 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/pyproject_flags.py +14 -7
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/pyproject_flags_test.py +38 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/resources.py +41 -15
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/wheel.py +14 -3
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/userdirs.py +1 -1
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/worker_count_test.py +1 -1
- codedoctor-0.1.6/codedoctor/lint/__main__.py +17 -0
- codedoctor-0.1.4/codedoctor/lint/houselint.py → codedoctor-0.1.6/codedoctor/lint/checker.py +210 -94
- codedoctor-0.1.4/codedoctor/lint/houselint_test.py → codedoctor-0.1.6/codedoctor/lint/checker_test.py +337 -232
- codedoctor-0.1.4/codedoctor/lint/houselint_types.py → codedoctor-0.1.6/codedoctor/lint/custom_types.py +1 -1
- codedoctor-0.1.4/codedoctor/lint/houselint_types_test.py → codedoctor-0.1.6/codedoctor/lint/custom_types_test.py +2 -2
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lint/house_ignore.py +38 -13
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lint/house_ignore_test.py +29 -5
- codedoctor-0.1.4/codedoctor/lint/houselint_rules.py → codedoctor-0.1.6/codedoctor/lint/rules.py +473 -73
- codedoctor-0.1.4/codedoctor/lint/houselint_rules_test.py → codedoctor-0.1.6/codedoctor/lint/rules_test.py +511 -201
- codedoctor-0.1.6/codedoctor/mutation/README.md +55 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutated.py +179 -128
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutated_test.py +1096 -415
- codedoctor-0.1.6/codedoctor/mutation/mutmut_adapter.py +627 -0
- codedoctor-0.1.6/codedoctor/mutation/mutmut_adapter_test.py +743 -0
- codedoctor-0.1.6/codedoctor/mutation/mutmut_cli.py +20 -0
- codedoctor-0.1.6/codedoctor/mutation/mutmut_cli_test.py +40 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_dynamo_test.py +63 -33
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_outcome_test.py +17 -35
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_param_ids_test.py +39 -42
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/policy.py +17 -8
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/policy_test.py +127 -2
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/listing_test.py +215 -289
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/outcomes.py +3 -3
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/outcomes_test.py +12 -6
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/testing.py +12 -8
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/testing_test.py +63 -56
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/typecheck/typecheck.py +5 -5
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/typecheck/typecheck_test.py +14 -1
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/yamlcheck/checker_test.py +22 -13
- {codedoctor-0.1.4 → codedoctor-0.1.6}/pyproject.toml +13 -9
- {codedoctor-0.1.4 → codedoctor-0.1.6}/tests/lib/testing/resources_test.py +143 -67
- {codedoctor-0.1.4 → codedoctor-0.1.6}/tests/lib/testing/wheel_test.py +20 -1
- {codedoctor-0.1.4 → codedoctor-0.1.6}/uv.lock +95 -74
- codedoctor-0.1.4/codedoctor/cli.py +0 -74
- {codedoctor-0.1.4 → codedoctor-0.1.6}/.gitignore +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/.python-version +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/AI_POLICY.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/CODE_OF_CONDUCT.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/CONTRIBUTING.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/LICENSE +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/RELEASING.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/SECURITY.md +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/backbone.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/backbone_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/codegraph_sync.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/affected/codegraph_sync_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/assert_isinstance/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/assert_isinstance/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/codegraph.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/codegraph_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/coverage_floor/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/coverage_floor/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/coverage_floor/coverage_floor.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/export_leaks/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/export_leaks/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/export_leaks/check_pr_text.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/export_leaks/check_pr_text_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/fakes.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/fakes_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/gate_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/spool.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/gate/spool_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/owner_only.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/owner_only_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/source_version.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/source_version_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/walk.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/files/walk_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/sidecars.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/sidecars_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/basetemp.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/checks.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/checks_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/runner.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/testing/runner_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lib/worker_count.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/lint/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_dynamo.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_kill_guard.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_kill_guard_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_outcome.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/mutation/mutmut_param_ids.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/nbstripout/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/nbstripout/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/nbstripout/nbstripout_hook.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/nbstripout/nbstripout_hook_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/py.typed +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/coverage_summary.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/coverage_summary_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/listing.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/tiers.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/testing/tiers_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/typecheck/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/typecheck/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/typecheck/scope.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/typecheck/scope_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/yamlcheck/__init__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/yamlcheck/__main__.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/codedoctor/yamlcheck/checker.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/conftest.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/tests/lib/testing/basetemp_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/tests/lib/userdirs_test.py +0 -0
- {codedoctor-0.1.4 → codedoctor-0.1.6}/typings/.gitkeep +0 -0
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
# scratch project). Name it anyway so the command does not depend on that
|
|
12
12
|
# chain staying intact.
|
|
13
13
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
14
|
+
# uvr --group pre-commit pre-commit install
|
|
15
|
+
# uvr --group pre-commit pre-commit autoupdate
|
|
16
|
+
# uvr --group pre-commit pre-commit run --all-files
|
|
17
17
|
#
|
|
18
18
|
# May need: git config --unset-all core.hooksPath
|
|
19
19
|
# if: [ERROR] Cowardly refusing to install hooks with `core.hooksPath` set.
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
# the pre-commit hooks; the heavy ones (ty-check-global, basedpyright-global,
|
|
23
23
|
# pytest*) declare `stages: [pre-push]` and need it named explicitly:
|
|
24
24
|
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
25
|
+
# uvr --group pre-commit pre-commit run --all-files
|
|
26
|
+
# uvr --group pre-commit pre-commit run --all-files --hook-stage pre-push
|
|
27
|
+
# uvr --group pre-commit pre-commit run --all-files --hook-stage commit-msg
|
|
28
28
|
#
|
|
29
29
|
# Always pass --files or --all-files. Bare `run` (and the hook `git commit`
|
|
30
30
|
# fires on a dirty tree) STASHES your changes -- a git mutation, and this
|
|
@@ -50,42 +50,47 @@
|
|
|
50
50
|
# arguments under `$(...)` or a bare `xargs`, and a rename record yields the
|
|
51
51
|
# name that no longer exists.
|
|
52
52
|
#
|
|
53
|
+
# # Run only the diffed files from the CWD (the AGENTS.md gate).
|
|
54
|
+
# { git --no-pager diff -z --name-only --relative --diff-filter=d --merge-base origin/main .
|
|
55
|
+
# git ls-files -z --others --exclude-standard .
|
|
56
|
+
# } | xargs -0 -r uvr --group pre-commit pre-commit run --files
|
|
57
|
+
#
|
|
53
58
|
# # Harvest all changed files from the perspective of CWD.
|
|
54
59
|
# git -C "$(git rev-parse --show-toplevel)" diff -z --name-only --diff-filter=d HEAD \
|
|
55
|
-
# | xargs -0 --no-run-if-empty
|
|
60
|
+
# | xargs -0 --no-run-if-empty uvr --group pre-commit pre-commit run --files
|
|
56
61
|
#
|
|
57
|
-
# # Run only the files from the CWD.
|
|
62
|
+
# # Run only the staged files from the CWD.
|
|
58
63
|
# git --no-pager diff -z --name-only --cached --relative \
|
|
59
|
-
# | xargs -0 --no-run-if-empty
|
|
64
|
+
# | xargs -0 --no-run-if-empty uvr --group pre-commit pre-commit run --files
|
|
60
65
|
#
|
|
61
66
|
# # Run all the files from CWD.
|
|
62
|
-
#
|
|
67
|
+
# git ls-files -z . | xargs -0 -r uvr --group pre-commit pre-commit run --files
|
|
63
68
|
#
|
|
64
69
|
# One hook at a time, by id (`ruff-check`, `ty-check`, `pytest-global`, ...):
|
|
65
|
-
#
|
|
66
|
-
#
|
|
70
|
+
# uvr --group pre-commit pre-commit run ruff-check --all-files
|
|
71
|
+
# uvr --group pre-commit pre-commit run pytest-global --hook-stage pre-push
|
|
67
72
|
#
|
|
68
73
|
# Force full pytest tiers despite testmon's warm dependency database:
|
|
69
|
-
# PYTEST_FORCE_ALL=1
|
|
74
|
+
# PYTEST_FORCE_ALL=1 uvr --group pre-commit pre-commit run pytest-global --hook-stage pre-push
|
|
70
75
|
#
|
|
71
76
|
# Individual tests: the pytest hooks take no test selector, so call pytest
|
|
72
77
|
# directly.
|
|
73
78
|
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
79
|
+
# uvr --group pre-commit pytest path/to/thing_test.py
|
|
80
|
+
# uvr --group pre-commit pytest path/to/thing_test.py::test_name
|
|
81
|
+
# uvr --group pre-commit pytest -k some_substring path/to/
|
|
82
|
+
# uvr --group pre-commit pytest -n 5 path/to/
|
|
78
83
|
#
|
|
79
84
|
# Marker tiers mirror the pytest-slow-global / -ci-smoke-global /
|
|
80
85
|
# -integration-global hooks; the
|
|
81
86
|
# default `-m` filter lives in pyproject addopts, so ask for them by name:
|
|
82
87
|
#
|
|
83
|
-
#
|
|
88
|
+
# uvr --group pre-commit pytest -m slow path/to/
|
|
84
89
|
#
|
|
85
90
|
# Skipping. SKIP takes hook ids, comma-separated, and reports "Skipped":
|
|
86
91
|
#
|
|
87
|
-
# SKIP=ruff-check
|
|
88
|
-
# SKIP=pytest-global,pytest-slow-global
|
|
92
|
+
# SKIP=ruff-check uvr --group pre-commit pre-commit run --all-files
|
|
93
|
+
# SKIP=pytest-global,pytest-slow-global uvr --group pre-commit pre-commit run --hook-stage pre-push --all-files
|
|
89
94
|
#
|
|
90
95
|
# `git commit --no-verify` / `git push --no-verify` bypass every hook. Both
|
|
91
96
|
# are a last resort, not a way past a red gate -- the gates are house rules
|
|
@@ -176,7 +181,7 @@ repos:
|
|
|
176
181
|
name: check-yaml
|
|
177
182
|
stages: [pre-commit]
|
|
178
183
|
language: system
|
|
179
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
184
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor yamlcheck
|
|
180
185
|
|
|
181
186
|
- id: check-toml
|
|
182
187
|
name: check-toml
|
|
@@ -251,7 +256,7 @@ repos:
|
|
|
251
256
|
language: system
|
|
252
257
|
stages: [pre-commit]
|
|
253
258
|
types: [jupyter]
|
|
254
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
259
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor nbstripout
|
|
255
260
|
args:
|
|
256
261
|
- --drop-empty-cells
|
|
257
262
|
- --extra-keys
|
|
@@ -273,7 +278,7 @@ repos:
|
|
|
273
278
|
|(.*/)?third_party/
|
|
274
279
|
)
|
|
275
280
|
|
|
276
|
-
# Writes each notebook's paired `.py`, so it runs before
|
|
281
|
+
# Writes each notebook's paired `.py`, so it runs before codedoctor lint and
|
|
277
282
|
# ruff, which then lint and format that output in the same pass.
|
|
278
283
|
- id: jupytext-sync
|
|
279
284
|
name: jupytext-sync
|
|
@@ -296,7 +301,7 @@ repos:
|
|
|
296
301
|
# exactly once between them, so a hook per rule buys nothing and costs
|
|
297
302
|
# an interpreter startup each (measured, 120 files, 3 rules: 0.81s ->
|
|
298
303
|
# 0.45s). Which rules run, fix, and skip which paths lives in
|
|
299
|
-
# `[tool.
|
|
304
|
+
# `[tool.codedoctor.lint]` of pyproject.toml, so a bare `codedoctor lint
|
|
300
305
|
# FILES` behaves exactly as this hook does.
|
|
301
306
|
#
|
|
302
307
|
# `require_serial: true`: pre-commit's own partitioning would fork
|
|
@@ -307,13 +312,13 @@ repos:
|
|
|
307
312
|
# commit stays serial. Measured on the 128-thread server, best of 3: 5 files 0.16s
|
|
308
313
|
# serial vs 0.30s pooled; 50 files 0.92s vs 0.50s; the full tree (4094
|
|
309
314
|
# files) 21.8s serial vs 1.46s at 24 workers.
|
|
310
|
-
- id:
|
|
311
|
-
name:
|
|
315
|
+
- id: codedoctor-lint
|
|
316
|
+
name: codedoctor-lint
|
|
312
317
|
language: system
|
|
313
318
|
stages: [pre-commit]
|
|
314
319
|
require_serial: true
|
|
315
320
|
types_or: [python, jupyter]
|
|
316
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
321
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor lint
|
|
317
322
|
|
|
318
323
|
- id: codespell
|
|
319
324
|
name: codespell
|
|
@@ -381,7 +386,7 @@ repos:
|
|
|
381
386
|
language: system
|
|
382
387
|
stages: [commit-msg]
|
|
383
388
|
always_run: true
|
|
384
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
389
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor check-pr-text
|
|
385
390
|
|
|
386
391
|
- repo: local
|
|
387
392
|
hooks:
|
|
@@ -478,7 +483,7 @@ repos:
|
|
|
478
483
|
types: [python]
|
|
479
484
|
pass_filenames: false
|
|
480
485
|
entry: >-
|
|
481
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
486
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor codegraph-sync
|
|
482
487
|
--caches /opt/scratch/caches/codegraph
|
|
483
488
|
|
|
484
489
|
# No official ty hook yet (https://github.com/astral-sh/ty/issues/269).
|
|
@@ -500,7 +505,7 @@ repos:
|
|
|
500
505
|
stages: [pre-commit]
|
|
501
506
|
require_serial: true
|
|
502
507
|
types_or: [python, pyi]
|
|
503
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
508
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool ty-check
|
|
504
509
|
|
|
505
510
|
- id: ty-check
|
|
506
511
|
name: ty-check
|
|
@@ -512,7 +517,7 @@ repos:
|
|
|
512
517
|
# See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
|
|
513
518
|
alias: superseded-at-pre-push
|
|
514
519
|
types_or: [python, pyi]
|
|
515
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
520
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck ty-check
|
|
516
521
|
# Resolved affected:N scopes read the index maintained above.
|
|
517
522
|
args: [--dependents, codedoctor.affected]
|
|
518
523
|
|
|
@@ -524,7 +529,7 @@ repos:
|
|
|
524
529
|
stages: [pre-commit]
|
|
525
530
|
require_serial: true
|
|
526
531
|
types_or: [python, pyi]
|
|
527
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
532
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool pyrefly-check
|
|
528
533
|
|
|
529
534
|
- id: pyrefly-check
|
|
530
535
|
name: pyrefly-check
|
|
@@ -536,7 +541,7 @@ repos:
|
|
|
536
541
|
# See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
|
|
537
542
|
alias: superseded-at-pre-push
|
|
538
543
|
types_or: [python, pyi]
|
|
539
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
544
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck pyrefly-check
|
|
540
545
|
# Widens on its own only when `ty-check` was skipped. The fixer is one
|
|
541
546
|
# pyrefly run that also deletes each unnecessary `assert isinstance`.
|
|
542
547
|
args:
|
|
@@ -555,7 +560,7 @@ repos:
|
|
|
555
560
|
stages: [pre-commit]
|
|
556
561
|
require_serial: true
|
|
557
562
|
types_or: [python, pyi]
|
|
558
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
563
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool basedpyright
|
|
559
564
|
exclude: |
|
|
560
565
|
(?x)^(
|
|
561
566
|
typings/
|
|
@@ -577,7 +582,7 @@ repos:
|
|
|
577
582
|
types_or: [python, pyi]
|
|
578
583
|
entry: >-
|
|
579
584
|
env NODE_OPTIONS=--max-old-space-size=2048
|
|
580
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
585
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck
|
|
581
586
|
basedpyright
|
|
582
587
|
# Widens as `ty-check` does; the fixer is one basedpyright run that
|
|
583
588
|
# also deletes each unnecessary `assert isinstance`.
|
|
@@ -587,6 +592,69 @@ repos:
|
|
|
587
592
|
- --fixer
|
|
588
593
|
- codedoctor.assert_isinstance
|
|
589
594
|
|
|
595
|
+
# TypeScript, JavaScript and CSS: `biome check --write` formats, applies the
|
|
596
|
+
# safe lint fixes, and fails on any lint error left. Settings and exclusions
|
|
597
|
+
# live in biome.json. `files` narrows upstream's list, which also covers JSON
|
|
598
|
+
# goldens and OpenAPI schemas that drift tests compare byte for byte. HTML
|
|
599
|
+
# stays out: Biome cannot parse the Liquid and Python templates most of it
|
|
600
|
+
# holds. An export's `biome_format` transform re-wraps what its rewrites
|
|
601
|
+
# changed.
|
|
602
|
+
#
|
|
603
|
+
# Rules biome.json turns off, each wrong for this code:
|
|
604
|
+
# noDescendingSpecificity stylesheets group rules by component; a later,
|
|
605
|
+
# more specific rule is a deliberate override.
|
|
606
|
+
# useOptionalChain `x && x.y` keeps x's falsy value (0, "", false),
|
|
607
|
+
# which `x?.y` turns into undefined.
|
|
608
|
+
# noImportantStyles `!important` beats the inline styles libraries
|
|
609
|
+
# (xterm, d3, resizable panels) set.
|
|
610
|
+
# useSemanticElements the native twin cannot hold the content: an
|
|
611
|
+
# <option> holds only text, an <hr> no children.
|
|
612
|
+
# A package's own settings live in a nested biome.json beside it, which its
|
|
613
|
+
# export ships: the React packages' react domain, and where these are off:
|
|
614
|
+
# noRedundantUseStrict classic scripts, where "use strict" is not implied.
|
|
615
|
+
# useDomNodeTextContent e2e specs read innerText: the text a reader sees.
|
|
616
|
+
# noComponentHookFactories tests and router/lazy.ts build components on purpose.
|
|
617
|
+
# useExhaustiveDependencies keeps a listed dependency it finds unneeded: such
|
|
618
|
+
# a dependency re-runs the effect when it changes, by design.
|
|
619
|
+
# Installed from npm's registry, not as upstream's hook repo: pre-commit
|
|
620
|
+
# installs a hook repo as `git+file://` its clone, and npm 11.12 refuses that
|
|
621
|
+
# (EALLOWGIT), so the hook could not install and every commit failed, on any
|
|
622
|
+
# file. The version lives in `additional_dependencies`; bump it there.
|
|
623
|
+
- repo: local
|
|
624
|
+
hooks:
|
|
625
|
+
- id: biome-check
|
|
626
|
+
name: biome-check
|
|
627
|
+
language: node
|
|
628
|
+
additional_dependencies: ["@biomejs/biome@2.6.7"]
|
|
629
|
+
entry: biome check --write --files-ignore-unknown=true --no-errors-on-unmatched
|
|
630
|
+
types: [text]
|
|
631
|
+
require_serial: true
|
|
632
|
+
stages: [pre-commit]
|
|
633
|
+
files: \.(tsx?|[cm]ts|jsx?|[cm]js|css)$
|
|
634
|
+
args: [--reporter=concise]
|
|
635
|
+
|
|
636
|
+
# rustfmt rewrites in place, then clippy denies every warning, each once per
|
|
637
|
+
# crate a change touches: the nearest `Cargo.toml` above each file.
|
|
638
|
+
- repo: local
|
|
639
|
+
hooks:
|
|
640
|
+
- id: cargo-fmt
|
|
641
|
+
name: cargo-fmt
|
|
642
|
+
language: system
|
|
643
|
+
stages: [pre-commit]
|
|
644
|
+
require_serial: true
|
|
645
|
+
files: (\.rs|(^|/)Cargo\.toml)$
|
|
646
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor cargo fmt
|
|
647
|
+
|
|
648
|
+
- id: cargo-clippy
|
|
649
|
+
name: cargo-clippy
|
|
650
|
+
language: system
|
|
651
|
+
stages: [pre-commit]
|
|
652
|
+
require_serial: true
|
|
653
|
+
files: (\.rs|(^|/)Cargo\.(toml|lock))$
|
|
654
|
+
entry: >-
|
|
655
|
+
nice -n 19 uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
656
|
+
cargo clippy
|
|
657
|
+
|
|
590
658
|
- repo: local
|
|
591
659
|
hooks:
|
|
592
660
|
# Each heavy hook below is a `-spool` twin, which collects pre-commit's
|
|
@@ -606,7 +674,7 @@ repos:
|
|
|
606
674
|
language: system
|
|
607
675
|
stages: [pre-commit]
|
|
608
676
|
require_serial: true
|
|
609
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
677
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool check-export-leaks
|
|
610
678
|
|
|
611
679
|
- id: check-export-leaks
|
|
612
680
|
name: check-export-leaks
|
|
@@ -614,7 +682,7 @@ repos:
|
|
|
614
682
|
stages: [pre-commit]
|
|
615
683
|
require_serial: true
|
|
616
684
|
pass_filenames: false
|
|
617
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
685
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate run check-export-leaks -- codedoctor.export_leaks
|
|
618
686
|
|
|
619
687
|
# Runs the tests PAIRED with each changed file (`x_test.py`, `test_x.py`,
|
|
620
688
|
# beside it or under `tests/`), then applies `fail_under` to the changed
|
|
@@ -645,7 +713,7 @@ repos:
|
|
|
645
713
|
stages: [pre-commit]
|
|
646
714
|
require_serial: true
|
|
647
715
|
types: [python]
|
|
648
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
716
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool pytest
|
|
649
717
|
|
|
650
718
|
- id: pytest
|
|
651
719
|
name: pytest
|
|
@@ -659,7 +727,7 @@ repos:
|
|
|
659
727
|
# See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
|
|
660
728
|
alias: superseded-at-pre-push
|
|
661
729
|
types: [python]
|
|
662
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
730
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing pytest
|
|
663
731
|
args: [--dependents, codedoctor.affected]
|
|
664
732
|
|
|
665
733
|
# Disable with SKIP=mutation. Findings fail the hook. Over 741 commits,
|
|
@@ -679,7 +747,7 @@ repos:
|
|
|
679
747
|
|(.*/)?\.export/typings/
|
|
680
748
|
|(.*/)?third_party/
|
|
681
749
|
)
|
|
682
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
750
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool mutation
|
|
683
751
|
|
|
684
752
|
- id: mutation
|
|
685
753
|
name: mutation
|
|
@@ -693,7 +761,7 @@ repos:
|
|
|
693
761
|
types: [python]
|
|
694
762
|
exclude: *mutation-exclude
|
|
695
763
|
entry: >-
|
|
696
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
764
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor gate
|
|
697
765
|
run mutation -- codedoctor.mutation
|
|
698
766
|
--function-sample-rate 0.05 --max-functions-sampled 4 --timeout-sec 900
|
|
699
767
|
--explain --prefer-changed-in-pre-commit
|
|
@@ -712,7 +780,7 @@ repos:
|
|
|
712
780
|
stages: [pre-commit]
|
|
713
781
|
require_serial: true
|
|
714
782
|
types: [python]
|
|
715
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
783
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool coverage-floor
|
|
716
784
|
|
|
717
785
|
- id: coverage-floor
|
|
718
786
|
name: coverage-floor
|
|
@@ -722,7 +790,7 @@ repos:
|
|
|
722
790
|
types: [python]
|
|
723
791
|
require_serial: true
|
|
724
792
|
pass_filenames: false
|
|
725
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
793
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing coverage-floor
|
|
726
794
|
|
|
727
795
|
# === Pre-Push Gates =========================================================
|
|
728
796
|
#
|
|
@@ -765,7 +833,7 @@ repos:
|
|
|
765
833
|
stages: [manual]
|
|
766
834
|
entry: >-
|
|
767
835
|
env NODE_OPTIONS=--max-old-space-size=2048
|
|
768
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
836
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor gate
|
|
769
837
|
threaded basedpyright-global -- basedpyright --threads={workers}
|
|
770
838
|
|
|
771
839
|
- id: pyrefly-check-global
|
|
@@ -775,7 +843,7 @@ repos:
|
|
|
775
843
|
pass_filenames: false
|
|
776
844
|
stages: [pre-push]
|
|
777
845
|
entry: >-
|
|
778
|
-
uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
846
|
+
uv --quiet run --frozen --group pre-commit python -m codedoctor gate
|
|
779
847
|
threaded pyrefly-check-global -- pyrefly check --threads={workers}
|
|
780
848
|
|
|
781
849
|
- id: pytest-global
|
|
@@ -785,7 +853,7 @@ repos:
|
|
|
785
853
|
pass_filenames: false
|
|
786
854
|
stages: [pre-push]
|
|
787
855
|
verbose: true
|
|
788
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
856
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-global
|
|
789
857
|
args: [--plugin, codedoctor.testing.listing]
|
|
790
858
|
|
|
791
859
|
- id: pytest-slow-global
|
|
@@ -795,7 +863,7 @@ repos:
|
|
|
795
863
|
pass_filenames: false
|
|
796
864
|
stages: [pre-push]
|
|
797
865
|
verbose: true
|
|
798
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
866
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-slow-global
|
|
799
867
|
args: [--plugin, codedoctor.testing.listing]
|
|
800
868
|
|
|
801
869
|
- id: pytest-ci-smoke-global
|
|
@@ -805,7 +873,7 @@ repos:
|
|
|
805
873
|
pass_filenames: false
|
|
806
874
|
stages: [pre-push]
|
|
807
875
|
verbose: true
|
|
808
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
876
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-ci-smoke-global
|
|
809
877
|
args: [--plugin, codedoctor.testing.listing]
|
|
810
878
|
|
|
811
879
|
- id: pytest-integration-global
|
|
@@ -815,7 +883,7 @@ repos:
|
|
|
815
883
|
pass_filenames: false
|
|
816
884
|
stages: [pre-push]
|
|
817
885
|
verbose: true
|
|
818
|
-
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor
|
|
886
|
+
entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-integration-global
|
|
819
887
|
args: [--plugin, codedoctor.testing.listing]
|
|
820
888
|
|
|
821
889
|
|
|
@@ -3,6 +3,34 @@
|
|
|
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.6 - 2026-11-18
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- `biome-check` hook formats and lints TypeScript, JavaScript and CSS;
|
|
11
|
+
`codedoctor install` writes a `biome.json` when the project has none.
|
|
12
|
+
- `codedoctor cargo` stage for Rust projects.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Update lint rules, mutation testing, typecheck, and affected-file selection.
|
|
17
|
+
|
|
18
|
+
## 0.1.5 - 2026-11-08
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Run every stage through `codedoctor <stage>`.
|
|
23
|
+
- Rename houselint to `codedoctor lint` and migrate its configuration.
|
|
24
|
+
- Require `codedoctor install --notebooks` to add notebook tooling.
|
|
25
|
+
- Install only the pre-commit Git hook by default; pre-push remains opt-in.
|
|
26
|
+
- Let OpenBLAS detect the host's usable CPU instructions.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Preserve long hook commands, block scalars, arguments, and YAML aliases
|
|
31
|
+
during command migration.
|
|
32
|
+
- Cover projects with dynamic names when generating checker policy.
|
|
33
|
+
|
|
6
34
|
## 0.1.4 - 2026-11-07
|
|
7
35
|
|
|
8
36
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: codedoctor
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
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,18 @@ 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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
basedpyright;
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
The hooks come from the package's `install_hooks.yaml`. Commits autofix
|
|
113
|
+
whitespace, spelling, Codedoctor lint, Ruff formatting, Biome formatting of
|
|
114
|
+
TypeScript, JavaScript and CSS, and rustfmt; check types with ty, pyrefly, and
|
|
115
|
+
basedpyright; run clippy once per touched crate; and run paired tests, coverage
|
|
116
|
+
checks, and sampled mutation tests. A project without `biome.json` gets the
|
|
117
|
+
package's Biome settings; an existing one is left alone.
|
|
118
|
+
Pre-push checks are opt-in: install them with `pre-commit install --hook-type
|
|
119
|
+
pre-push` to run repository-wide type checks and all test tiers.
|
|
120
|
+
Dependency-graph setup precedes affected-file checks.
|
|
114
121
|
|
|
115
122
|
Tests may use either `test_*.py` or `*_test.py`; existing discovery settings and
|
|
116
123
|
coverage thresholds are preserved. Hooks that rewrite files abort that attempt;
|
|
@@ -171,14 +178,14 @@ repos:
|
|
|
171
178
|
language: system
|
|
172
179
|
require_serial: true
|
|
173
180
|
types_or: [python, pyi]
|
|
174
|
-
entry: uv run
|
|
181
|
+
entry: uv run codedoctor gate spool ty-check
|
|
175
182
|
- id: ty-check
|
|
176
183
|
name: ty-check
|
|
177
184
|
language: system
|
|
178
185
|
require_serial: true
|
|
179
186
|
pass_filenames: false
|
|
180
187
|
types_or: [python, pyi]
|
|
181
|
-
entry: uv run
|
|
188
|
+
entry: uv run codedoctor typecheck ty-check
|
|
182
189
|
```
|
|
183
190
|
|
|
184
191
|
This repository's own [`.pre-commit-config.yaml`](.pre-commit-config.yaml) wires
|
|
@@ -186,17 +193,22 @@ every gate and is the fullest example.
|
|
|
186
193
|
|
|
187
194
|
## Gates
|
|
188
195
|
|
|
189
|
-
|
|
|
196
|
+
| Command | Runs |
|
|
190
197
|
|---|---|
|
|
191
|
-
| `codedoctor
|
|
192
|
-
| `codedoctor
|
|
193
|
-
| `codedoctor
|
|
194
|
-
| `codedoctor
|
|
195
|
-
| `codedoctor
|
|
196
|
-
| `codedoctor
|
|
197
|
-
| `codedoctor
|
|
198
|
-
| `codedoctor
|
|
199
|
-
| `codedoctor
|
|
198
|
+
| `codedoctor gate` | `spool`, `run` and `threaded`: the shared machinery |
|
|
199
|
+
| `codedoctor typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
|
|
200
|
+
| `codedoctor testing` | paired tests and whole-suite tiers |
|
|
201
|
+
| `codedoctor coverage-floor` | per-source coverage from the pytest gate |
|
|
202
|
+
| `codedoctor mutation` | changed-function mutation tests (`codedoctor[mutation]`) |
|
|
203
|
+
| `codedoctor lint` | AST rules configured in `[tool.codedoctor.lint]`; `--explain RULE` says why a rule exists; `--suppressions` counts the `house-ignore` markers for each rule |
|
|
204
|
+
| `codedoctor assert-isinstance` | redundant `assert isinstance` removal |
|
|
205
|
+
| `codedoctor affected` | files and tests reached through CodeGraph |
|
|
206
|
+
| `codedoctor nbstripout` | notebook output stripping |
|
|
207
|
+
| `codedoctor yamlcheck` | YAML validation, including Compose tags |
|
|
208
|
+
| `codedoctor cargo` | `cargo fmt` or `cargo clippy` once per touched crate |
|
|
209
|
+
| `codedoctor export-leaks` | exported-package leak checks |
|
|
210
|
+
| `codedoctor codegraph-sync` | dependency-graph refresh |
|
|
211
|
+
| `codedoctor check-pr-text` | pull-request text validation |
|
|
200
212
|
|
|
201
213
|
Worker counts: `WORKERS_<HOOK_ID>` wins, then `WORKERS_DEFAULT`, then a count
|
|
202
214
|
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,18 @@ 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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
basedpyright;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
The hooks come from the package's `install_hooks.yaml`. Commits autofix
|
|
45
|
+
whitespace, spelling, Codedoctor lint, Ruff formatting, Biome formatting of
|
|
46
|
+
TypeScript, JavaScript and CSS, and rustfmt; check types with ty, pyrefly, and
|
|
47
|
+
basedpyright; run clippy once per touched crate; and run paired tests, coverage
|
|
48
|
+
checks, and sampled mutation tests. A project without `biome.json` gets the
|
|
49
|
+
package's Biome settings; an existing one is left alone.
|
|
50
|
+
Pre-push checks are opt-in: install them with `pre-commit install --hook-type
|
|
51
|
+
pre-push` to run repository-wide type checks and all test tiers.
|
|
52
|
+
Dependency-graph setup precedes affected-file checks.
|
|
46
53
|
|
|
47
54
|
Tests may use either `test_*.py` or `*_test.py`; existing discovery settings and
|
|
48
55
|
coverage thresholds are preserved. Hooks that rewrite files abort that attempt;
|
|
@@ -103,14 +110,14 @@ repos:
|
|
|
103
110
|
language: system
|
|
104
111
|
require_serial: true
|
|
105
112
|
types_or: [python, pyi]
|
|
106
|
-
entry: uv run
|
|
113
|
+
entry: uv run codedoctor gate spool ty-check
|
|
107
114
|
- id: ty-check
|
|
108
115
|
name: ty-check
|
|
109
116
|
language: system
|
|
110
117
|
require_serial: true
|
|
111
118
|
pass_filenames: false
|
|
112
119
|
types_or: [python, pyi]
|
|
113
|
-
entry: uv run
|
|
120
|
+
entry: uv run codedoctor typecheck ty-check
|
|
114
121
|
```
|
|
115
122
|
|
|
116
123
|
This repository's own [`.pre-commit-config.yaml`](.pre-commit-config.yaml) wires
|
|
@@ -118,17 +125,22 @@ every gate and is the fullest example.
|
|
|
118
125
|
|
|
119
126
|
## Gates
|
|
120
127
|
|
|
121
|
-
|
|
|
128
|
+
| Command | Runs |
|
|
122
129
|
|---|---|
|
|
123
|
-
| `codedoctor
|
|
124
|
-
| `codedoctor
|
|
125
|
-
| `codedoctor
|
|
126
|
-
| `codedoctor
|
|
127
|
-
| `codedoctor
|
|
128
|
-
| `codedoctor
|
|
129
|
-
| `codedoctor
|
|
130
|
-
| `codedoctor
|
|
131
|
-
| `codedoctor
|
|
130
|
+
| `codedoctor gate` | `spool`, `run` and `threaded`: the shared machinery |
|
|
131
|
+
| `codedoctor typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
|
|
132
|
+
| `codedoctor testing` | paired tests and whole-suite tiers |
|
|
133
|
+
| `codedoctor coverage-floor` | per-source coverage from the pytest gate |
|
|
134
|
+
| `codedoctor mutation` | changed-function mutation tests (`codedoctor[mutation]`) |
|
|
135
|
+
| `codedoctor lint` | AST rules configured in `[tool.codedoctor.lint]`; `--explain RULE` says why a rule exists; `--suppressions` counts the `house-ignore` markers for each rule |
|
|
136
|
+
| `codedoctor assert-isinstance` | redundant `assert isinstance` removal |
|
|
137
|
+
| `codedoctor affected` | files and tests reached through CodeGraph |
|
|
138
|
+
| `codedoctor nbstripout` | notebook output stripping |
|
|
139
|
+
| `codedoctor yamlcheck` | YAML validation, including Compose tags |
|
|
140
|
+
| `codedoctor cargo` | `cargo fmt` or `cargo clippy` once per touched crate |
|
|
141
|
+
| `codedoctor export-leaks` | exported-package leak checks |
|
|
142
|
+
| `codedoctor codegraph-sync` | dependency-graph refresh |
|
|
143
|
+
| `codedoctor check-pr-text` | pull-request text validation |
|
|
132
144
|
|
|
133
145
|
Worker counts: `WORKERS_<HOOK_ID>` wins, then `WORKERS_DEFAULT`, then a count
|
|
134
146
|
derived from the machine's cores and free memory.
|
|
@@ -43,7 +43,7 @@ from codedoctor.lib.files import walk
|
|
|
43
43
|
from codedoctor.lib.worker_count import worker_count
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
_THIS: Final = Path(__file__).resolve()
|
|
46
|
+
_THIS: Final[Path] = Path(__file__).resolve()
|
|
47
47
|
_CWD: Final = _THIS.parent
|
|
48
48
|
|
|
49
49
|
if TYPE_CHECKING:
|
|
@@ -316,7 +316,7 @@ def _connect(database: Path) -> sqlite3.Connection | None:
|
|
|
316
316
|
# name there and took `mode=ro` with it. SQLite does not fail on that --
|
|
317
317
|
# it CREATES the truncated name, writable and empty, so the walk read a
|
|
318
318
|
# file that is not the index and left a stray one in the tree.
|
|
319
|
-
# pragma: no mutate start
|
|
319
|
+
# pragma: no mutate[truthiness] start
|
|
320
320
|
return sqlite3.connect(
|
|
321
321
|
f"file:{pathname2url(str(database))}?mode=ro",
|
|
322
322
|
uri=True,
|
|
@@ -537,7 +537,7 @@ def _globs(value: object, *, default: list[str]) -> list[str]:
|
|
|
537
537
|
# hand it a ``list[Unknown]`` and lose the element type the conversion
|
|
538
538
|
# establishes.
|
|
539
539
|
try:
|
|
540
|
-
words = from_plain(value, list[object], default=[])
|
|
540
|
+
words = from_plain(value, list[object], default=list[object]())
|
|
541
541
|
except ReadError:
|
|
542
542
|
return default
|
|
543
543
|
return [str(word) for word in words] or default
|