Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #19693 exclude-patterns no longer work on specific messages
Submitted: 2012-11-07 05:50 UTC
From: happydog Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.1)
PHP Version: Irrelevant OS: All
Roadmaps: (Not assigned)    
Subscription  


 [2012-11-07 05:50 UTC] happydog (Mark Clements)
Description: ------------ In 1.4.0 I had this instruction in my ruleset.xml: <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"> <exclude-pattern>*</exclude-pattern> </rule> This successfully excluded the rule for all files. In 1.4.1, this no longer works, and the EndLine errors are reported. I tried adding type="relative" to the <exclude-pattern> tag, but this makes no difference. Expected result: ---------------- An exclude pattern of * should block all files, regardless of whether in 'absolute' or 'relative' mode. Actual result: -------------- It doesn't seem to work in either mode.

Comments

 [2012-11-07 06:37 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Feedback -Assigned To: +Assigned To: squiz
Yes, it should exclude all files, so I will look into it. But the best way of doing this is actually to use this: <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"> <severity>0</severity> </rule> That drops the severity down to 0, which tells PHPCS to stop generating that message. Give that a go and let me know if it works.
 [2012-11-07 07:02 UTC] squiz (Greg Sherwood)
-Summary: exclude-pattern * no longer works +Summary: exclude-patterns no longer work on specific messages
 [2012-11-07 07:04 UTC] squiz (Greg Sherwood)
-Status: Feedback +Status: Closed
Fixed in github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/0181a097c94ab7b1a5c5a3fdb 2aab60c470fa483
 [2012-11-07 08:22 UTC] happydog (Mark Clements)
<severity>0</severity> works fine, but glad to see you've fixed the other method too. Out of interest, why is the <severity> method 'best' - are they not equivalent?
 [2012-11-07 08:35 UTC] squiz (Greg Sherwood)
Thanks for getting back to me. I should have said "standard way" instead of "best way". The severity setting was built to exclude messages and sniffs for all files while the exclude patterns were built to exclude messages and sniffs for a subset of files. So if any improvements (perhaps performance improvements) are ever added in the future for excluding messages/sniffs from all files, it is better to be using the method that was designed for that purpose, although I'll always make sure the other way is also supported. Hope that makes sense.
 [2012-11-07 08:46 UTC] happydog (Mark Clements)
OK - thanks for the explanation.