-
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
[PSR-2 Compliance] Fix #8612: Hundreds of PHPCS-based static tests violations in mainline #8685
[PSR-2 Compliance] Fix #8612: Hundreds of PHPCS-based static tests violations in mainline #8685
Conversation
@orlangur thank you for this contribution. It will take some time to review all changes in this PR. And thank you for providing URL for the code change which requires manual review |
+100500 to your karma! 👍 |
Would clean up the code. Very nice PR. |
@okorshenko, please ping me back if I need to resolve merge conflicts in order to get this merged. Currently there is only one pretty easy to fix conflict in |
Hi @orlangur Please, resolve the conflicts if you can. Thank you |
@okorshenko, in PR description I mentioned
There you can see:
for both of automatic commits :) The last small commit 9db86d8 is manual too, it is not possible to squash with changes before automatic commits as those changes are in files with CRLF line breaks. Ok, will resolve conflicts by hard reset before automatic commits + re-apply of automatic changes. So, don't be surprised there will be no merge commit (of course, if there are no conflicting changes with my manual changes in mainline). |
…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/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
9db86d8
to
f122079
Compare
@orlangur thank you |
@orlangur from the first look everything is ok. !is_null($local) ==> $local === null I will fix it on our side Tomorrow I will code review one more time to make sure I didn't miss any other issues. After that, I will start merge procedure. Thank you for this PR! |
Oh, my bad, sorry, it would be better to fix it with |
@orlangur could you please provide detailed explanation why some rules were removed from the ruleset:
Please let me know if I missed some other rules |
@okorshenko explanation is already provided in 0338636 commit message:
|
@orlangur thank you for your contribution. Your Pull Request has been successfully merged. Great job! |
Awesome stuff @orlangur |
Cool, thx! :) Didn't expect it to be merged that fast (or even merged at all :D). Magento 2 contribution starting to be a pleasure, keep up the decent pace reached 👍 |
Great to see that this commit has been merged so quickly. Keep up this fantastic progress! |
Tier4 Kings PR Delivery 12.18.2023
Scope of Work
ruleset.xml
@codingStandardsIgnoreFile
annotations removed to reduce size of PR@codingStandardsIgnoreFile
only added when really necessary:interface
marked with@api
(can be addressed separately, didn't want to mix with cosmetic changes)phtml
files which show false-positive with currently used PHPCS 1.5.3 and no violation with latest stable PHPCS 2.8.0 (example: orlangur@ecf0948)Code Review Notes
git diff