action-php-codesniffer
action-php-codesniffer copied to clipboard
Not respecting standards file
I have an action setup exactly as in the readme (https://github.com/tinovyatkin/action-php-codesniffer#usage), and have a phpcs.xml in the root of the repository which looks alike this:
<?xml version="1.0"?>
<ruleset>
<arg name="colors"/>
<file>.</file>
<exclude-pattern>./vendor/*</exclude-pattern>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
<rule ref="PSR2.Files.EndFileNewline"/>
</ruleset>
I'm including a few specific rules and no generic standard. However, I get annotations referring to Generic.Files.LineLength.TooLong and PEAR.WhiteSpace.ScopeIndent.Incorrect and others which I didn't include.
It seems thus as if my standards file is not respected/recognized and a default standard is used. Does anyone know what's going on?
Did you point to the file directly viat standard parameter? https://github.com/tinovyatkin/action-php-codesniffer/blob/4a0895ce7a8d6d6a62efdfb7d2d32d84fe8d0b7b/action.yml#L17
Can you copy your workflow file here?
Yes, I have:
- uses: tinovyatkin/action-php-codesniffer@v1
with:
files: "**.php" # you may customize glob as needed
phpcs_path: php phpcs.phar
standard: phpcs.xml
It is an exact copy of the readme.
I set up an example repo. See https://github.com/lode/phpcs-action-test/pull/1. It makes remarks about things outside my standards, and the things inside the standards, like Generic.Arrays.DisallowLongArraySyntax, are not annotated.
Confirmed that it indeed ignores the standard option when running on blame
Since author hasn't merged the code yet, I have fixed and published my own fork of it.
Anyone facing this issue can use this in your yml file:
uses: thenabeel/action-phpcs@v8
@thenabeel thanks for the fork! Looking forward to merging the code as I am experiencing same issue.
@thenabeel thanks for the fork! Looking forward to merging the code as I am experiencing same issue.
@elenakondrateva I just saw your comment, haha pretty late. I hope it was helpful for you.