4.0 | .gitattributes: ignore test files, don't ignore test framework #73
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.
Description
As of PHPCS 4.0, the tests will no longer ship in a packaged version of the repo 🎉
However, while this removes a lot of friction, it can also cause some, as quite a few external standards use the PHPCS native test framework to run their tests. To continue to do so, those external standards would now have to use
--prefer-source
, which would make their builds a lot slower and will cause extra support questions from new contributors to those standards.This commit proposes a solution to this issue by making a few small changes to the
.gitattributes
file. With these updates directives in place, the PHPCS native test framework will still be included in the packaged up versions, but the test files will not be.In practice, this means that the following files should still be included in a packaged up version:
/tests/AllTests.php
/tests/bootstrap.php
/tests/FileList.php
/tests/TestSuite.php
/tests/Core/AbstractMethodUnitTest.php
/tests/Core/AllTests.php
/tests/Standards/AbstractSniffTest.php
/tests/Standards/AllSniffs.php
... but that all other test files will be excluded.
This removes the need for external standards to use
--prefer-source
.Suggested changelog entry
Update the existing changelog entry:
Related issues/external references
Fixes squizlabs/PHP_CodeSniffer#3158