Skip to content

config:check: ban config files that shadow pyproject.toml tool sections - #40

Merged
clintmod merged 1 commit into
masterfrom
fix/39-config-shadow-check
Jul 20, 2026
Merged

config:check: ban config files that shadow pyproject.toml tool sections#40
clintmod merged 1 commit into
masterfrom
fix/39-config-shadow-check

Conversation

@clintmod

Copy link
Copy Markdown
Owner

Closes #39

What

Adds a config:check gate (same idiom as lock:check) that fails if any config file exists that would shadow a [tool.*] section in pyproject.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.
  • Scans git ls-files --cached --others --exclude-standard, so it catches untracked local strays before commit and subdirectory files (ruff's closest-config-wins means a tests/ruff.toml silently replaces all lint rules for tests/), while skipping .venv.
  • New config:check rite task (alias cc), wired into check: and the CI checks matrix.
  • Extends ruff/pylint/pyright/format coverage to ci/ so the new script meets the same bar as src and tests.

Why

All tool config here lives in pyproject.toml, but every tool's discovery chain prefers a standalone file — mostly silently (uv.toml disables [tool.uv] with no warning; an empty pytest.ini shadows [tool.pytest.ini_options]). Full shadow map and rejected alternatives (sp-repo-review, per-invocation -c pinning) in #39.

tox.ini/setup.cfg are 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:check passes on a clean tree
  • Planted pytest.ini (untracked, root) + tests/ruff.toml (subdirectory) → both reported, exit 1
  • rite lint:ruff, format:check, lint:pylint, typecheck, lint:actions, deptry all pass with the new file and widened scope

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qn45YUDYJRtSm3zjgEdyha

…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.
@clintmod
clintmod merged commit 17e77a3 into master Jul 20, 2026
17 checks passed
@clintmod
clintmod deleted the fix/39-config-shadow-check branch July 20, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard against config files shadowing pyproject.toml tool sections

1 participant