action-php-codesniffer icon indicating copy to clipboard operation
action-php-codesniffer copied to clipboard

Not respecting standards file

Open lode opened this issue 5 years ago • 7 comments

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?

lode avatar Jun 25 '20 08:06 lode

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?

tinovyatkin avatar Jun 25 '20 12:06 tinovyatkin

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.

lode avatar Jun 25 '20 17:06 lode

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.

lode avatar Jun 25 '20 17:06 lode

Confirmed that it indeed ignores the standard option when running on blame

tinovyatkin avatar Jun 25 '20 17:06 tinovyatkin

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 avatar Jan 05 '21 14:01 thenabeel

@thenabeel thanks for the fork! Looking forward to merging the code as I am experiencing same issue.

elenakondrateva avatar Feb 23 '21 03:02 elenakondrateva

@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.

thenabeel avatar Aug 12 '22 17:08 thenabeel