-
Notifications
You must be signed in to change notification settings - Fork 159
AC-664: Create phpcs static check for CodingStandardsIgnoreAnnotationUsageTest #257
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
Conversation
…UsageTest - Initial commit, copy the sniff across from magento repo
…UsageTest - Add methods register() and process()
…UsageTest - Add unit tests and update ruleset.xml
…UsageTest - Fix Typo
{ | ||
private const CODING_STANDARDS_IGNORE_FILE = '@codingStandardsIgnoreFile'; | ||
|
||
private const WARNING_CODE = self::CODING_STANDARDS_IGNORE_FILE . ' annotation must be avoided. '; |
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.
WARNING_CODE
must be something like avoidAnnotation
{ | ||
return []; | ||
} | ||
} |
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.
Newline missing
*/ | ||
public function getErrorList() | ||
{ | ||
return []; |
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.
There must be an error at line 7, that's where @codingStandardsIgnoreFile
is set
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.
I know, i set it up empty because was expecting complains on command line when running vendor/bin/phpunit
.
Actually, it must be a warning.
public function register(): array | ||
{ | ||
return [ | ||
T_OBJECT_OPERATOR |
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.
Are you sure about this operator? I think you should be looking for T_ASPERAND
(the @ char) or T_COMMENT
*/ | ||
public function process(File $phpcsFile, $stackPtr) | ||
{ | ||
$lineContent = $phpcsFile->getTokensAsString($stackPtr, 1); |
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.
I don't this way will work, try to do
php$tokens = $phpcsFile->getTokens();
if (strpos($tokens[$stackPtr - 1]['content']) !== false) {
...
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.
gonna try both
…UsageTest - Refactor: Fix small issues
This test cannot be moved to magento-coding-standard, since that’s not simply a phpunit question. |
AC-12715::Investigate the laminas composer dependencies upgrading to latest version
https://jira.corp.magento.com/browse/AC-664 Create phpcs static check for CodingStandardsIgnoreAnnotationUsageTest