-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Dev][Coding Standard] Hundreds of PHPCS-based static tests violations in mainline #8612
Comments
…ests violations in mainline - enable PHPCS-based tests for the whole codebase - combine three PHPCS-based tests into one - polish up Magento Coding Standard into one ruleset.xml: no new rules added, only those rules removed which are already contained in PSR2 - run static tests under PHP 7 which is ~3 times faster than PHP 5.6
…ests violations in mainline - apply manual fixes to make PHPCS happy, changes for "Constants are not allowed as the first argument of translation function, use string literal instead" - third-party constants are simply ignored, not sure if this is correct or not
…ests violations in mainline - apply manual fixes to make PHPCS and PHPMD happy - some phtml templates marked as ignored for now as PHPCS 1.5.3 version produces false-positives on them (PHPCS 2.8.0 treats them fine)
…ests violations in mainline - apply automatic PHP-CS-FIXER fixes to make PHPCS happy - Step 0. Install php-cs-fixer globally: composer global require friendsofphp/php-cs-fixer:2.1.0 - Step 1. Remove outdated php-cs-fixer config: rm .php_cs - Step 2. Execute tool: ~/.composer/vendor/bin/php-cs-fixer fix . --rules=no_extra_consecutive_blank_lines,method_separation -v - Step 3. Reset changed fixture file to not break related unit test: git checkout HEAD -- lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php - Step 4. Restore outdated php-cs-fixer config: git checkout HEAD -- .php_cs
…ests violations in mainline - apply automatic PHPCBF fixes to make PHPCS happy - Step 0. Install phpcs globally: composer global require squizlabs/php_codesniffer:2.8.0 - Step 1. Execute tool to fix PSR-2 violations in PHP files: ~/.composer/vendor/bin/phpcbf --standard=PSR2 --extensions=php --ignore=generated/*,vendor/*,var/* .
…ests violations in mainline - apply manual fixes to make PHPCS and PHPMD happy
…ests violations in mainline - apply manual fixes to make PHPCS happy, changes for "Constants are not allowed as the first argument of translation function, use string literal instead" - third-party constants are simply ignored, not sure if this is correct or not
…ests violations in mainline - apply manual fixes to make PHPCS and PHPMD happy - some phtml templates marked as ignored for now as PHPCS 1.5.3 version produces false-positives on them (PHPCS 2.8.0 treats them fine)
…ests violations in mainline - apply automatic PHP-CS-FIXER fixes to make PHPCS happy - Step 0. Install php-cs-fixer globally: composer global require friendsofphp/php-cs-fixer:2.1.0 - Step 1. Remove outdated php-cs-fixer config: rm .php_cs - Step 2. Execute tool: ~/.composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix . --rules=no_extra_consecutive_blank_lines,method_separation -v - Step 3. Reset changed fixture file to not break related unit test: git checkout HEAD -- lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php - Step 4. Restore outdated php-cs-fixer config: git checkout HEAD -- .php_cs
…ests violations in mainline - apply automatic PHPCBF fixes to make PHPCS happy - Step 0. Install phpcs globally: composer global require squizlabs/php_codesniffer:2.8.0 - Step 1. Execute tool to fix PSR-2 violations in PHP files: ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcbf --standard=PSR2 --extensions=php --ignore=generated/*,vendor/*,var/* .
…ests violations in mainline - apply manual fixes to make PHPCS and PHPMD happy
… PHPCS-based static tests violations in mainline #8685
… PHPCS-based static tests violations in mainline #8685 - fixed code style issues
… PHPCS-based static tests violations in mainline #8685 - fixed whitelist for cs test
… PHPCS-based static tests violations in mainline #8685 - fixed code style issue
… PHPCS-based static tests violations in mainline #8685 - automatic fix of code style issues: - Step 1. Install php-cs-fixer globally: composer global require friendsofphp/php-cs-fixer:2.1.0 - Step 2. Execute tool: ~/.composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix . --rules=no_extra_consecutive_blank_lines,method_separation -v
… PHPCS-based static tests violations in mainline #8685 - automatic fix of code style issues: - Step 1. Install phpcs globally: composer global require squizlabs/php_codesniffer:2.8.0 - Step 1. Execute tool to fix PSR-2 violations in PHP files: ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcbf --standard=PSR2 --extensions=php --ignore=generated/*,vendor/*,var/* .
… PHPCS-based static tests violations in mainline #8685 - automatic fix of code style issues: - Step 1. Install php-cs-fixer globally: composer global require friendsofphp/php-cs-fixer:2.1.0 - Step 2. Execute tool: ~/.composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix . --rules=no_extra_consecutive_blank_lines,method_separation -v
… PHPCS-based static tests violations in mainline #8685 - automatic fix of code style issues: - Step 1. Install phpcs globally: composer global require squizlabs/php_codesniffer:2.8.0 - Step 1. Execute tool to fix PSR-2 violations in PHP files: ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcbf --standard=PSR2 --extensions=php --ignore=generated/*,vendor/*,var/* .
… PHPCS-based static tests violations in mainline #8685 - automatic fix of code style issues: - Step 1. Install phpcs globally: composer global require squizlabs/php_codesniffer:2.8.0 - Step 1. Execute tool to fix PSR-2 violations in PHP files: ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcbf --standard=PSR2 --extensions=php --ignore=generated/*,vendor/*,var/* .
Regression occurred. Looks like Steps to reproduceRun Expected resultPHPCS-based tests are green Actual result
What needs to be done
I'm going to take care of it this weekend or earlier if I have some spare time. |
Hi @orlangur |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions! |
This issue is NOT about
@codingStandardsIgnoreFile
evil annotation appearing quite often: http://prnt.sc/eawtihThe problem is that even except those 666 ignored files there are a lot of not coding standard compliant files due to holes in CI processes and/or bugs in
get_changed_files
mechanism. This is even more strange as "bump copyright year" commit changed all the files and still didn't reveal these violations.Preconditions
Use
develop
branchSteps to reproduce
Run PHPCS-based tests against full codebase
Expected result
PHPCS-based tests are green
Actual result
https://travis-ci.org/orlangur/magento2/jobs/203250472
Solution
As it turned out, running PHPCS against full codebase takes less than 5 minutes: https://travis-ci.org/orlangur/magento2/jobs/203222909#L554
I propose to remove buggy
get_changed_files
mechanism for PHPCS-based tests as it does not bring any notable value currently but causes troubles.I would like to prepare a pull request implementing this approach and eliminating all existing violations if you don't mind.
The text was updated successfully, but these errors were encountered: