config:check: ban config files that shadow pyproject.toml tool sections - #40
Merged
Conversation
…ns (#39) Every tool configured in pyproject.toml (uv, pytest, ruff, pylint, pyright, coverage, gitleaks) also discovers standalone config files that silently win over the [tool.*] sections -- uv.toml ignores [tool.uv] with no warning, an empty pytest.ini shadows [tool.pytest.ini_options], and a ruff.toml in a subdirectory replaces the root lint rules for that subtree. Add ci/scripts/check-config-shadowing.py, a manifest-driven guard that fails if any of the 16 shadowing filenames exist anywhere in the tree (tracked or untracked-unignored, so a stray local file fails rite check before it is committed). Wire it in as config:check in the check set and the CI checks matrix, and extend ruff/pylint/pyright/format coverage to ci/ so the script is held to the same bar as src and tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #39
What
Adds a
config:checkgate (same idiom aslock:check) that fails if any config file exists that would shadow a[tool.*]section inpyproject.toml:ci/scripts/check-config-shadowing.py— manifest-driven: a table of 16 forbidden basenames (uv.toml,pytest.ini/.pytest.ini/pytest.toml/.pytest.toml,ruff.toml/.ruff.toml, the four pylintrc variants,pyrightconfig.json,.coveragerc,.gitleaks.toml,tox.ini,setup.cfg), each with the tool it belongs to and why it wins. Adding a future tool = adding a row.git ls-files --cached --others --exclude-standard, so it catches untracked local strays before commit and subdirectory files (ruff's closest-config-wins means atests/ruff.tomlsilently replaces all lint rules fortests/), while skipping.venv.config:checkrite task (aliascc), wired intocheck:and the CIchecksmatrix.ci/so the new script meets the same bar assrcandtests.Why
All tool config here lives in
pyproject.toml, but every tool's discovery chain prefers a standalone file — mostly silently (uv.tomldisables[tool.uv]with no warning; an emptypytest.inishadows[tool.pytest.ini_options]). Full shadow map and rejected alternatives (sp-repo-review, per-invocation-cpinning) in #39.tox.ini/setup.cfgare banned unconditionally rather than section-conditionally: neither has any legitimate use in this repo (no tox, no setuptools config), and skipping the section-parsing keeps the script trivial. If that ever changes, the manifest row comes out deliberately.Testing
rite config:checkpasses on a clean treepytest.ini(untracked, root) +tests/ruff.toml(subdirectory) → both reported, exit 1rite lint:ruff,format:check,lint:pylint,typecheck,lint:actions,deptryall pass with the new file and widened scope🤖 Generated with Claude Code
https://claude.ai/code/session_01Qn45YUDYJRtSm3zjgEdyha