Closed photodude closed 8 years ago
They both throw exactly the same errors for me, which is what I'd expect given the indent property wont be overwritten just by changing the message (or shouldn't be). Can you provide some code you are checking against that shows error?
I'm checking against this code and sub folders within the Joomla CMS project
I've used the ruleset you've provided and checked Joomla. I don't get any errors with either of the two ruleset snippets.
It might be worth you checking a single file, such as admin.php in that dir, and using the -vv
command line argument so get more output. At the very top, you'll see how PHPCS is processing your ruleset. I get this:
Processing ruleset /Users/gsherwood/Sites/Projects/PHP_CodeSniffer/mystandard.xml
Processing rule "PEAR.Functions.FunctionDeclaration"
=> /Users/gsherwood/Sites/Projects/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
Excluding rule "PEAR.Functions.FunctionDeclaration.CloseBracketLine"
=> severity set to 0
Excluding rule "PEAR.Functions.FunctionDeclaration.NewlineBeforeOpenBrace"
=> severity set to 0
=> property "indent" set to "4"
Processing rule "PEAR.Functions.FunctionDeclaration.Indent"
=> /Users/gsherwood/Sites/Projects/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
=> message set to Multi-line function declaration not indented correctly; expected %s tabs but found %s
=> set command line value --tab-width=4
=> Ruleset processing complete; included 1 sniffs and excluded 0
You can see that it only sets the property value once, and it doesn't set it back. Do you get something different?
Ok, here is a file that I know the error should come up under.
Unfortunately, I am unable to reproduce this issue now. Could possibly be related to the other issues caused by failing to use --config-set tab_width 4
on tab based files
As I'm no longer able to reproduce the problem I'm closing the issue.
for tab based files, If you declare something like the following in the ruleset.xml:
PEAR.Functions.FunctionDeclaration.Indent will will throw errors
but if you declare something like this:
you will not get errors
I feel it's little unexpected that I need to redeclare the
<property name="indent" value="4"/>
when changing a sniff message.