benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
812 stars 126 forks source link

Custom codesniffer or extra arguments do not seem to work #151

Closed brendt closed 8 years ago

brendt commented 8 years ago

I was testing different ways to exclude three sniffer rules. (curlies on different lines and _ prefixed private variables)

First config included this

"phpcs_additional_args": {
        "--standard": "PSR2",
        "-n": "",
        "--sniffs": "-PEAR.Classes.ClassDeclaration,-PEAR.NamingConventions.ValidVariableName,-PEAR.Functions.FunctionDeclaration"
},

The command executed in the debug console is this:

[Phpcs] /bin/phpcs --report=checkstyle -n --sniffs=-PEAR.Classes.ClassDeclaration,-PEAR.NamingConventions.ValidVariableName,-PEAR.Functions.FunctionDeclaration --standard=PSR2 /Users/brent/www/CENWEB/htdocs/application/src/statik/cenweb/decorator/EventDecorator.php

Output by the command in terminal:

(Brents-MacBook-Pro) brent /sites/cenweb/htdocs (develop) /bin/phpcs --report=checkstyle -n --sniffs=-PEAR.Classes.ClassDeclaration,-PEAR.NamingConventions.ValidVariableName,-PEAR.Functions.FunctionDeclaration --standard=PSR2 /Users/brent/www/CENWEB/htdocs/application/src/statik/cenweb/decorator/EventDecorator.php
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="2.5.1">
</checkstyle>

However, Sublime still shows curly errors in this file:

screen shot 2016-02-17 at 11 46 58

Tried with a custom ruleset:

"phpcs_additional_args": {
        "--standard": "/Users/brent/ride.xml",
        "-n": "",
},
<?xml version="1.0"?>
<ruleset name="PSR Ride">
    <description>The PSR Ride coding standard.</description>
    <rule ref="PEAR">
        <exclude name="PEAR.Functions.FunctionDeclaration"/>
        <exclude name="PEAR.NamingConventions.ValidVariableName"/>
        <exclude name="PEAR.Classes.ClassDeclaration"/>
    </rule>
</ruleset>

Which works in terminal, but again not in Sublime.

benmatselby commented 8 years ago

Hi @brendt Can you please turn on debugging for the plugin and look in the console as to what the plugin is running and the output we get

benmatselby commented 8 years ago

@brendt This is working for me... It is probably caching the old results.

In the command palette run "PHP Code Sniffer: Clear sniffer marks"

And then run the sniffer again.