-
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
Static tests: forbid 'or' instead of '||' #21062. #21275
Static tests: forbid 'or' instead of '||' #21062. #21275
Conversation
Hi @novikor. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @novikor, thanks for the pull request! Considering that |
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.
Having risky rule is totally fine while we have static test which uses php-cs-fixer
in dry run mode.
Please add such test and also corresponding phpcs
sniff wouldn't hurt.
Please preserve alphabetical order of fixers.
Hi. |
@orlangur , may I just update phpunit.xml.dist from https://github.com/magento/magento-coding-standard ? |
@novikor What would you like to add from |
@orlangur , I am a little bit confused about I would like to add changes from https://github.com/magento/magento-coding-standard/pull/40/files#diff-eb0df15a533f0e9054dc4d489ee5e67a |
@novikor mentioned changes are ok to be added. Risky rule will be ok if a test like https://github.com/magento/magento2/blob/2.3-develop/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php#L262 is implemented for |
@sivaschenko ok, agree, although relying on operator precedence does not look like a realistic scenario such developer experience would be pretty confusing. We may use risky fixers for dry run mode only when we have a @novikor feel free to contribute |
2cfc5bc
to
2b06a7f
Compare
@orlangur , I decided to improve |
@@ -85,4 +85,8 @@ | |||
<rule ref="Squiz.Commenting.DocCommentAlignment"/> | |||
<rule ref="Squiz.Functions.GlobalFunction"/> | |||
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/> | |||
<rule ref="Squiz.Operators.ValidLogicalOperators"> | |||
<severity>6</severity> |
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.
No need to spoil core coding standard with severities, each rule is mandatory.
Please put it before previous line to preserve alphabetical order.
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.
Done
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.
No need to make it warning, any rule is mandatory. Please squash into one commit.
Added Squiz.Operators.ValidLogicalOperators rule
c60ed54
to
23f415a
Compare
Done) |
Hi @orlangur, thank you for the review. |
Hi @novikor, thank you for your contribution! |
Description (*)
Added
Squiz.Operators.ValidLogicalOperators
PHP-CS ruleFixed Issues (if relevant)
Manual testing scenarios (*)
Just make sure PHP-CS asks you to avoid the literal logical operators
Contribution checklist (*)