Add skip large files for post PHPCS checks #217
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.
After running the PHPCS scan,
vip-go-ci
performs a few checks; and they can be expensive for large files.E.g.:
The following code block, which is called after the PHPCS, will potentially result in an OOM for a large file:
https://github.com/Automattic/vip-go-ci/blob/main/git-repo.php#L371-L396
Those checks should be skipped for the large files since the phpcs scan command itself is also skipped for the same scenario.
This PR applies the condition to skip large files during those checks - since they are not necessary.
Edit
Obs about tests:
For this scenario, we ideally would write tests to assert if the expensive methods were called or not when the files are large.
However, since this project is procedural, it's not possible to determine via
phpunit
whether a method is called or not. - not without rewriting the entire phpcs scan logic.Having that in mind, the tests found in the PhpcsScanScanCommitTest.php test class are still passing, and for the moment, that would be enough to validate that this code is not breaking any scenario.
Edit to add TODO list in the description:
TODO: