Custom phpcs ruleset is not respecting exclude-pattern declaration

Answered

I have a custom phpcs ruleset file, where I am including a couple of rulesets and also excluded files from certain directories like tests or vendor.

The full phpcs.xml config file is at https://github.com/sudar/bulk-move/blob/master/phpcs.xml Below I have mentioned the interesting bits

 

<file>./</file>

<!-- Exclude test directories -->
<exclude-pattern>tests/*</exclude-pattern>
<!-- PHP Compatibility -->
<config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibility">
</rule>

Now when I run `phpcs` command from the root of my project, it excluded the files from tests directory and runs phpcs only on the other files.

In PhpStorm I have selected this phpcs.xml file as the custom coding standard while configuring phpcs. But when I am editing a file from the tests directory (that is excluded) PhpStorm still calls phpcs with the custom coding standard and show warnings.

So my question is how to tell PhpStorm to exclude the files that are excluded in the phpcs.xml ruleset file?

0
2 comments
Avatar
Permanently deleted user

Hello Andriy,

Thanks for the reply. I have posted a comment in the Jetbrains ticket that you linked in the stackoverflow answer.

I really really wish that Jetbrains could solve this issue since this is a blocker to me. It is really unfortunate that Jetbrains has not fixed it even after 4 years.

The scopes workaround will not work for me since I need to apply different phpcs code sniff for 'tests' and 'src' files. Scopes only allows me to either enable or disable phpcs inspection based on scope.

0

Please sign in to leave a comment.