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

Only run PHPStan (on all PHP files) in pre-commit hook if there is a modified PHP file #5747

Merged
merged 2 commits into from
Dec 29, 2020

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Dec 29, 2020

Summary

I found that our pre-commit hook was eagerly running PHPStan even when no modified PHP files were staged. We originally were going to include PHPStan in lint-staged via #5424 but reverted in #5438 since it's important for all PHP files to be included in the analysis. This PR conditionally runs PHPStan on all PHP files if any PHP file is modified.

Logic inspired by example in lint-staged docs:

image

Checklist

  • My pull request is addressing an open issue (please create one otherwise).
  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@westonruter westonruter added this to the v2.1 milestone Dec 29, 2020
@westonruter westonruter added Testing Issues related with Unit, E2E, Smoke, and other testing requirements/needs WS:Core Work stream for Plugin core labels Dec 29, 2020
@westonruter westonruter marked this pull request as ready for review December 29, 2020 19:13
@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2020

Plugin builds for 225d5c0 are ready 🛎️!

@pierlon
Copy link
Contributor

pierlon commented Dec 29, 2020

For some reason the "ESLint Report Analysis" check is not resolving albeit the "Annotate code linting results" GHA step runs without any errors.

I'm going to push a commit that resolves the warning being emitted from the GoogleCloudPlatform/github-actions/setup-gcloud@master action (see the "Annotations" section in the Actions summary) and see if the "ESLint Report Analysis" check manages to fix itself.

Actions Summary section (as of ad9fe69):

image

@westonruter westonruter merged commit 3880af0 into develop Dec 29, 2020
@westonruter westonruter deleted the add/conditional-phpstan branch December 29, 2020 21:28
@pierlon pierlon self-assigned this Apr 24, 2021
@pierlon
Copy link
Contributor

pierlon commented Apr 26, 2021

Moving to the "QA Passed" column since there's nothing here to QA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing Issues related with Unit, E2E, Smoke, and other testing requirements/needs WS:Core Work stream for Plugin core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants