Scope ExtraPathRule scans to their owning rules#42
Merged
Conversation
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.
Scope extra-path scans to their owning rules
Fixes #41.
Problem
ExtraPathRule::extraScanPaths()lets a rule register additional directoriesto scan (today only
DeprecatedTestMethodsRuleuses it, fortests/andtest/). The CLI was then handing those directories to the scanner with thefull rule set, so every rule ran on every test file.
That caused the false positives reported in #41:
DeprecatedUrlParametersRulerewrote Livewire wire-property names like
tableFilters/tableSearchinsidePest tests, breaking the suite at runtime because Filament's real Livewire
properties are still
$tableFilters/$tableSearch.Same bug existed in the
--dirtybranch — dirty test files were scanned withevery rule.
Fix
Each extra path is now scanned only with the rule(s) that requested it.
ResourceScanner::scan()accepts an optional?array $rules; when set,only those rules run for that pass. Default behavior is unchanged.
bin/filacheckbuilds apath => Rule[]map fromExtraPathRule::extraScanPaths()and callsscan()with each path's owningrules. So
tests/runs onlyDeprecatedTestMethodsRule; the rest of therules never see test files.
--dirtyflow uses the same map: a dirty file inside the main path keepsthe full rule set, a dirty file inside an extra path gets only its owning
rule(s).
No rule files were modified — the
ExtraPathRulecontract is unchanged.