-
Notifications
You must be signed in to change notification settings - Fork 160
Move phpcs checks from magento2 to magento-coding-standard repo #209
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
Move phpcs checks from magento2 to magento-coding-standard repo #209
Conversation
- Move files from Annotation folder
- Move files from Html folder
- Move files from Less folder
- WIP: Update ruleset.xml
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.
Thanks for the PR @loginesta .
The remaining work would be:
- Fix all the failing tests
- Add all the rules from the rulesets specified in the comments
@@ -580,4 +580,13 @@ | |||
<severity>5</severity> | |||
<type>warning</type> | |||
</rule> | |||
<rule ref="Magento2.Annotation"> |
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.
All the rules from the following files should be added as well:
- https://github.com/magento/magento2/blob/2.4-develop/dev/tests/static/testsuite/Magento/Test/Html/_files/html/ruleset.xml
- https://github.com/magento/magento2/blob/2.4-develop/dev/tests/static/testsuite/Magento/Test/Less/_files/lesscs/ruleset.xml
- https://github.com/magento/magento2/blob/2.4-develop/dev/tests/static/framework/Magento/ruleset.xml
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.
These ones are already there, EndFileNewline
, LineEndings
and DisallowTabIndent
.
Just adding the ones missing
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.
Hi @loginesta,
Could you also cover your change with tests?
- Add other rules from previous ruleset files on Magento
@ihor-sviziev we are moving a bulk of tests from magento2 repository to magento-testing-coverage (that is the first part). Considering the volume of tests to be moved, limited resources and missing test coverage on magento2 repository we would like to deffer test coverage for the Sniffs moved from magento2 in bulk. |
- Add missing comment block
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.
You can try like this
@@ -128,8 +128,7 @@ private function getArgumentListClosePointer($openParenthesisPointer, array $tok | |||
} | |||
|
|||
/** | |||
* Seeks the next available {@link T_OPEN_PARENTHESIS} token that comes directly after <var>$stackPointer</var>. | |||
* token. | |||
* Seeks the next available {@link T_OPEN_PARENTHESIS} token that comes directly after <var>$stackPointer</var> token. |
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.
* Seeks the next available {@link T_OPEN_PARENTHESIS} token that comes directly after <var>$stackPointer</var> token. | |
* Find the argument list open pointer | |
* | |
* Seeks the next available {@link T_OPEN_PARENTHESIS} token | |
* that comes directly after <var>$stackPointer</var> token. |
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.
And like this
@@ -68,8 +68,7 @@ public function process(File $phpcsFile, $stackPtr) | |||
} | |||
|
|||
/** | |||
* Seeks the next available token of type {@link T_CLOSE_CURLY_BRACKET} in <var>$tokens</var> and returns its | |||
* pointer. | |||
* Seeks the next available token of type {@link T_CLOSE_CURLY_BRACKET} in <var>$tokens</var> and returns its pointer. |
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.
* Seeks the next available token of type {@link T_CLOSE_CURLY_BRACKET} in <var>$tokens</var> and returns its pointer. | |
* Find the closing curly bracket pointer | |
* | |
* Seeks the next available token of type {@link T_CLOSE_CURLY_BRACKET} | |
* in <var>$tokens</var> and returns its pointer. |
@@ -81,10 +80,9 @@ private function getClosingCurlyBracketPointer($startPointer, array $tokens) | |||
} | |||
|
|||
/** | |||
* Seeks the next available token of type {@link T_OPEN_CURLY_BRACKET} in <var>$tokens</var> and returns its | |||
* pointer. | |||
* Seeks the next available token of type {@link T_OPEN_CURLY_BRACKET} in <var>$tokens</var> and returns its pointer. |
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.
* Seeks the next available token of type {@link T_OPEN_CURLY_BRACKET} in <var>$tokens</var> and returns its pointer. | |
* Find the opening curly bracket pointer | |
* | |
* Seeks the next available token of type {@link T_OPEN_CURLY_BRACKET} | |
* in <var>$tokens</var> and returns its pointer. |
- Format multi-line comments
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.
Test coverage and rules properties in ruleset.xml to follow
@magento import pr to magento-commerce/magento-coding-standard |
@sivaschenko the pull request successfully imported. |
…o-coding-standard-438 [Imported] Auto-fix `Magento2.PHP.ShortEchoSyntax.ShortEchoTag`
https://jira.corp.magento.com/browse/AC-201 Move phpcs checks from magento2 to magento-coding-standard repo