-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Superfluous whitespace #317
Comments
You explained it very well, but the feature does already exist. It's just that the PSR2 standard explicitly says that whitespace is not allowed at the end of non-blank lines. Take a look at this part of the standard: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md#23-lines
Please don't ask me why this line is in the standard :) To achieve this, the PSR2 ruleset.xml file includes this rule: <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="true"/>
</properties>
</rule> By default, the
So for the PSR2 standard, there isn't anything I can do. But you can use that Squiz sniff the way it was originally intended and it will look for whitespace everywhere. I hope that explains things well enough. |
Thank you so much Greg for your quick and efficient answer |
Hello Greg,
I use the latest version 2.0.0RC4 of phpcs, and I noticed something I think will be nice to catch to enhance the superfluous whitespace sniff.
If you've code with spaces line content, it's not detected as a violation (neither an error or a warning).
Here is an example :
At end of
return $var
there are extra whitespace, and also some white spaces on blank line between each if statements.So if I run the following command
I got
I expect to have
See token 17 about line 3
See token 20 corresponding to line 5 with extra spaces
Here is a chunk of console output
Hope my explains are enough !
Laurent
The text was updated successfully, but these errors were encountered: