Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip large files for post PHPCS checks #217

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

ariskataoka
Copy link
Member

@ariskataoka ariskataoka commented Oct 20, 2021

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:

@ariskataoka ariskataoka marked this pull request as ready for review October 21, 2021 00:58
Copy link

@ovidiul ovidiul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ariskataoka thank you for adding the changes, they look good on my part! 🙇‍♂️

@ariskataoka ariskataoka added this to the 1.0.9 milestone Oct 21, 2021
@ariskataoka ariskataoka merged commit 04c2eb4 into main Oct 21, 2021
@ariskataoka ariskataoka deleted the hotfix/apply-skip-large-files-git-blame branch October 21, 2021 23:46
ariskataoka added a commit that referenced this pull request Oct 22, 2021
ariskataoka added a commit that referenced this pull request Nov 10, 2021
* Changelog for version 1.0.9

* Adding version 1.0.9

* Add #204 to the 1.0.9 changelog

* Add #209 to the 1.0.9 changelog

* Add #217 to the 1.0.9 changelog

* Remove #205 changelog

It's been postponed and won't be part of the 1.0.9 version.

* Add #208 to the 1.0.9 changelog

* Add #214 to the 1.0.9 changelog

* Add release date to the change log

Co-authored-by: Ariana Kataoka <aris.kataoka@gmail.com>
Co-authored-by: Ariana Kataoka <ariana.kataoka@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants