fix(cs-fixer): Correctly ignore files ignored by git #47474
Merged
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.
Summary
Many files ignored by git were never ignored by cs-fixer due to symfony/symfony#37781.
If it was actually working as intended, then the code for ignoring the additional app directories wouldn't have been necessary.
This implementation is more generic and really ignores the files ignored by git.
Instead of scanning 7075 files (also from additional apps, your count will be different) it only has to scan 4493.
While being faster, this also stops cs-fixer from messing with formatting in additional apps, if they were placed in the
apps/
directory.I manually added back the ignores for build/stubs and composer since we don't control or care about their content formatting wise.
As for the config dir, we might want to remove the exclusion and have the config.sample.php correctly formatted. Let me know if I should change that.
According to https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst#configuring-paths the
notPath
calls were also wrong because they are only for files andexclude
should have been used instead.Checklist