-
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] The Great @codingStandardsIgnoreFile Massacre #9367
[PSR-2 Compliance] The Great @codingStandardsIgnoreFile Massacre #9367
Conversation
- adjust php-cs-fixer configuration: add is_null and method_separation rules already enforced by phpcs sniffers, update excluded paths
- remove @codingStandardsIgnoreFile annotation all over the codebase - Step 0. Run command: find . -name "*.php" -type f | xargs sed -i -e "/@codingStandardsIgnoreFile/d"
- apply automatic php-cs-fixer fixes to make PHPCS happy - Step 0. Execute tool: ./vendor/bin/php-cs-fixer fix . -v
- 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/* .
- revert files with nontrivial issues to mainline state for further investigation - Step 0. Run command: git checkout bbe3ee0 -- lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/_files/ConfigDomMock.php lib/internal/Magento/Framework/Interception lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php lib/internal/Magento/Framework/Code/ dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php dev/tests/integration/testsuite/Magento/Framework/Interception/ dev/tests/static/get_github_changes.php setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/ParserTest.php app/code/Magento/Vault/Api/Data/PaymentTokenInterfaceFactory.php app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressTest.php dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/phrases/TestPhrases.php
- apply manual fixes to make PHPCS happy, mainly "Line exceeds maximum limit of 120 characters" violations
- apply manual fixes to make PHPMD happy
a4eea58
to
c87c521
Compare
…gStandardsIgnoreFile-massacre Conflicts: app/code/Magento/Backend/Block/Page/Notices.php app/code/Magento/Backend/Block/Widget/Container.php app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/Source.php app/code/Magento/CatalogRule/Setup/UpgradeData.php app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Aggregation/AggregationResolverTest.php app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Dynamic/DataProviderTest.php app/code/Magento/Cms/Setup/ContentConverter.php app/code/Magento/GoogleOptimizer/Block/Code/Category.php app/code/Magento/GoogleOptimizer/Block/Code/Product.php app/code/Magento/LayeredNavigation/Block/Navigation/State.php app/code/Magento/Paypal/Model/Payflow/Service/Response/Transaction.php app/code/Magento/Paypal/Model/Payflow/Transparent.php app/code/Magento/Paypal/Test/Unit/Controller/Payflow/ReturnUrlTest.php app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php app/code/Magento/Paypal/Test/Unit/Model/PayflowlinkTest.php app/code/Magento/Paypal/Test/Unit/Model/PayflowproTest.php app/code/Magento/Quote/Setup/ConvertSerializedDataToJson.php app/code/Magento/Sales/Setup/UpgradeData.php app/code/Magento/SalesRule/Setup/UpgradeData.php app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php app/code/Magento/Widget/Block/Adminhtml/Widget.php app/code/Magento/Widget/Helper/Conditions.php app/code/Magento/Widget/Setup/LayoutUpdateConverter.php app/code/Magento/Widget/Setup/UpgradeData.php dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreEntityTest.php dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php lib/internal/Magento/Framework/Data/Wysiwyg/Normalizer.php lib/internal/Magento/Framework/Indexer/BatchSizeManagement.php lib/internal/Magento/Framework/Indexer/Test/Unit/BatchSizeManagementTest.php
- apply manual fixes to make PHPCS happy
Now synced and green: https://travis-ci.org/orlangur/magento2/builds/232866106 (integration test failure seems unrelated as it passed in previous run and main branch run), https://travis-ci.org/orlangur/magento2/builds/232587786 |
@ishakhsuvarov @okorshenko please share your thoughts on current changes. I'll do re-apply over latest mainline, so that there will be no merge commits, but will preserve old manual commits and any additional required changes will come in separate commits on top of that. |
Hi @orlangur Let's do the next. Please, separate each module and each framework component into individual PR. They will be smaller and easier for review and stabilization. I will close this PR and will wait for series of PRs based on these changes. Thank you for collaboration. |
@okorshenko it was stable at the moment of publishing and I believe it would be pretty easy to re-apply and stabilize again at any moment. Quote from description: Review NotesManual commits: orlangur@a1f9e1a, 40ba673, c87c521 Do you have any concerns regarding manual changes mentioned? |
@orlangur it is almost impossible to review 4k changed files, despite these changes were done automatically. We must to make sure that all changes are secure. I understand your concern, but it will be better to deliver such big changes partially to 2.2 release. Otherwise they will go to 2.3 :( |
Hmmm, why need to review automated changes with bare eyes and not just repeat the same commands and then do That was the whole point of my optimization - maximum automatization which minimize code review efforts :) If there is some requirement to review changes manually, such approach simply does not work. Please correct me if I'm wrong - #8685 had to be fully reviewed manually? Thanks for the quick feedback, will do my best to get this merged into mainline to the earliest possible release, just want to understand the circumstances. |
…e Massacre #9367 - fixed code style
Hi @orlangur |
Here is a good example how we can do this: |
@okorshenko thanks, at first sight it looks like some commands applied all over the code base (not module batching), please tell me if I'm wrong. I still believe it can be done pretty easily without small batching (what I would like to avoid: apply I'm going to repeat massacre this weekend, please share if possible whether it fits into 2.2.0 release plan so that efforts are not wasted. |
Hi @orlangur |
This PR fixes mistake introduced in 004c9bb which resulted in hundreds of files with coding style violations.
Description
As pointed out in #9251 (comment) manual fixing would take too much time and developer/reviewer efforts. Thus I did exactly what was described in #7166 (comment) to get maximum profit out of existing automated tools.
Review Notes
Manual commits: orlangur@a1f9e1a, 40ba673, c87c521
Automated commits (just repeat steps from commit message instead of manual review): orlangur@b51681c, 4dc56e0, c619404, d813974
PHPMD on Travis CI was not able to complete within 10 minutes limit thus I checked static tests in two chunks (modules only and all but modules in whitelist): https://travis-ci.org/orlangur/magento2/builds/224861865, https://travis-ci.org/orlangur/magento2/builds/224861991
Contribution checklist