-
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
Ability to customise $checkedTokens
in Generic.CodeAnalysis.EmptyStatement
from within a custom rule
#314
Comments
👍 to make it configurable. Just of curiosity how empty statements can be useful to you? |
That's a good question 😄 |
Coding Standard is called as such to enforce standard. Fact, that empty IF exists and user must fill content in should trigger an error, so user know that he must fill code in. If you don't need that empty IF to happen, then just comment it out. |
Yep, I agree but it would still be useful to be able to configure this rule as you can with others. If my suggestion is not applicable then this issue can be closed. |
Indeed, that's why I also put +1 before. |
👍 |
… statement detected (request #314)
I've decided to do this in a different way because the sniff pre-dates ruleset files and is showing its age. Instead, I've removed that member var and changed the message codes to include the type of statement that was detected. So to turn off empty IF statement errors, use this: <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedIF">
<severity>0</severity>
</rule> Or to turn empty IF statement errors into warnings, use this: <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedIF">
<type>warning</type>
</rule> The messages codes are:
Hopefully that gives you enough flexibility to do what you need without having to change the core sniffs or write your own. |
Works perfectly for me - thanks for implementing |
$checkedTokens
from within a custom ruleT_IF
but if I could do this within my ruleset it would be much better. Unless I am missing a way of doing this without editing the file?e.g.
The text was updated successfully, but these errors were encountered: