feat(validators,git-diff): exclude glob + wrong-CWD guards (#335, #336)#337
Merged
Merged
Conversation
Two dispatch/op ergonomics fixes: #335 - per-spec `exclude` glob on validators & formatters. A spec may set `"exclude": "*tests/*"` (string or list, skip-if-any) to skip files even when `match` hits. Motivating case: editing a PHPUnit test fired phpmd's TooManyPublicMethods - noise, since no real gate scans tests. Per-spec on purpose: a blanket skip would break phpunit, which must run on tests. #336 - git-diff:PATH no longer reports a missing/untracked path as "No changes." (a silent false-negative that masks a wrong CWD). Path mode checks `git ls-files` first: missing -> warn + exit 1, untracked -> warn, tracked-clean -> "No changes." Every mode stamps a `Repo: <toplevel>` header so a wrong-repo invocation is visible. grep's path-not-found error now carries the CWD too. Tests: 12 new (exclude dispatch x6, git-diff guard/header x5, grep cwd x1). Docs: validators.md + SCHEMA.md (exclude key), presets/git.md (guard + header). Co-Authored-By: Max <noreply>
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.
What
Two dispatch/op ergonomics fixes, bundled (they overlap in
supertool.py+CHANGELOG.md).#335 — per-spec
excludeglob (validators & formatters)A validator/formatter spec may now set
"exclude": "*tests/*"(string or list of globs, skip-if-any) to skip files even whenmatchhits. Wired into_applicable_validatorsand_applicable_formattersvia a shared_matches_any_globhelper.Why: editing a PHPUnit test fired phpmd's
TooManyPublicMethods— pure noise, since no real gate scans tests (CI mess-detection scans the source dir only; the pre-push git-hook skips/tests/). Per-spec on purpose: a blanket "skip tests" would breakphpunit, which must run on tests.#336 — wrong-CWD guards
git-diff:PATHpreviously reported a missing or untracked path asNo changes.— a silent false-negative that masks a stale CWD. Path mode now checksgit ls-filesfirst:⚠ not found under <cwd> — wrong CWD?, exit 1⚠ untracked (not in git)No changes.(correct)Every mode also stamps a
Repo: <toplevel>header so a wrong-repo invocation is visible at a glance.grep's path-not-found error now carries the CWD too.Tests
12 new — exclude dispatch (×6), git-diff guard/header (×5, incl. tracked-modified-still-diffs regression), grep cwd (×1).
158 passedacross the four affected suites.Docs
docs/validators.md+validators/SCHEMA.md(exclude key),docs/presets/git.md(git-diff guard + Repo header), CHANGELOG.Closes #335
Closes #336