-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Automate squizlabs/php_codesniffer #32785
Conversation
6756d04
to
a01a905
Compare
Codecov Report
@@ Coverage Diff @@
## master #32785 +/- ##
=========================================
Coverage 64.14% 64.14%
Complexity 18721 18721
=========================================
Files 1184 1184
Lines 70453 70453
Branches 1270 1270
=========================================
Hits 45195 45195
Misses 24888 24888
Partials 370 370
Continue to review full report at Codecov.
|
a01a905
to
ca0fc05
Compare
ca0fc05
to
bcb1d46
Compare
bcb1d46
to
39a0a6e
Compare
5ce05fb
to
ee210ad
Compare
e1b01c7
to
329c878
Compare
did you guys consider simply adding it to the existing |
329c878
to
d4b6838
Compare
@PVince81 good idea! Then developers will get the checks "for free". I disabled the line length checks. Those give lots of warnings because the acceptance tests have many long lines due to the length of some Gherkin step text. The warnings make a lot of noise in the the output, we mostly ignored them anyway, and it would really annoy developers to get loads of crap output when doing Anyway, this is not any sort of "final project standard". It is what we do in the QA team at the moment, and can easily be changed if the project decides to adopt some project-wide coding standard. |
@PVince81 please review again. |
@@ -196,6 +196,7 @@ test-php-lint: $(composer_dev_deps) | |||
.PHONY: test-php-style | |||
test-php-style: $(composer_dev_deps) | |||
$(composer_deps)/bin/php-cs-fixer fix -v --diff --diff-format udiff --dry-run --allow-risky yes | |||
$(composer_deps)/bin/phpcs --runtime-set ignore_warnings_on_exit --standard=phpcs.xml tests/acceptance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, so we won't be using the same rules for QA code ?
can you make a separate ticket to consolidate said rules so we only use a single tool ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand your question.
php-cs-fixer
implements some "basic" rules across the whole code-base, including acceptance test code. That is already in place.
phpcs
has even more code style rules than php-cs-fixer
.
During discussions about code style, PHPdoc block etc standards some time ago, the QA team implemented some phpcs
rules to get started, and applied it to the tests/acceptance/...
folders. This is an "interim" standard while we await the "whole project" deciding on a project-wide standard. We have been manually running phpcs
locally on PRs to see that we meet our standard, but of course we often forget!
So automating it here will force us (and anyone who touches tests/acceptance/.../*.php
) to remember.
If the whole project some day decides to adopt a standard that is inclusive of these rules, then easy - the acceptance test code already meets the rules here. If the project adopts some standard that is not the same/similar, then we reformat doc blocks or whatever (like the rest of the project will have to do anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm ok, so if phpcs itself has more rules than phpcsfixer we could eclipse phpcsfixer then... and many IDEs support loading phpcs rules but not ones from phpcsfixer...
@PVince81 this will need a merge override, because it is expecting a Travis result. |
Backport |
d4b6838
to
528ad27
Compare
Description
phpcs
to enforce the existing acceptance test code style rulestest-php-style
make targetRelated Issue
Motivation and Context
See issue.
How Has This Been Tested?
Local run:
Types of changes
Checklist:
Open tasks: