Bug #15936 [Fbk]: duplicate error messages being displayed for custom sniff

From: Date: Wed, 25 Mar 2009 05:43:33 +0000
Subject: Bug #15936 [Fbk]: duplicate error messages being displayed for custom sniff
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-260@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=15936&edit=1 ID: 15936 Updated by: gsherwood@squiz.net Reported By: ken at linux dot ie Summary: duplicate error messages being displayed for custom sniff Status: Feedback Type: Bug Package: PHP_CodeSniffer PHP Version: 5.2.5 Assigned To: squiz Roadmap Versions: New Comment: Have you been able to check to see if it is a duplicate sniff issue? Previous Comments: ------------------------------------------------------------------------ [2009-03-09 04:38:23] squiz -Status: Open +Status: Feedback -Assigned To: +Assigned To: squiz ------------------------------------------------------------------------ [2009-03-09 04:38:09] squiz I do not get these duplicate messages when following the guide. But I am also using a new standard to do testing with. By the output you posted, I'd say you are probably including this new sniff in an existing standard. If this is the case, it is likely that the standard already has a sniff that reports the exact same error message, or contains a duplicate sniff. The easiest way to check this is to update to 1.2.0RC1 and then use the new -s command line argument to view the source of the errors. You should get something like this: phpcs --standard=/home/squiz/PHP_CodeSniffer/MyStandard ../temp.php -s FILE: /home/squiz/PHP_CodeSniffer/temp.php -------------------------------------------------------------------------------- FOUND 3 ERROR(S) AND 0 WARNING(S) AFFECTING 3 LINE(S) -------------------------------------------------------------------------------- 3 | ERROR | Hash comments are prohibited | | (MyStandard.Commenting.DisallowHashComments) 7 | ERROR | Hash comments are prohibited | | (MyStandard.Commenting.DisallowHashComments) 9 | ERROR | Hash comments are prohibited | | (MyStandard.Commenting.DisallowHashComments) -------------------------------------------------------------------------------- Check those sources and see if they are different. If so, it points to a duplicate sniff being somewhere in your standard. If they are from the same source, try following the guide again but use the new MyStandard coding standard dir and see if you get the same error when only one sniff exists in your standard. ------------------------------------------------------------------------ [2009-02-24 11:37:22] kguest Description: ------------ Copied DisallowHashCommentsSniff.php sample from https://pear.php.net/manual/en/package.php.php-codesniffer.coding-standard-tutorial.php I'm getting duplicates of the error message: FILE: /home/ken/test.php -------------------------------------------------------------------------------- FOUND 7 ERROR(S) AND 0 WARNING(S) AFFECTING 4 LINE(S) -------------------------------------------------------------------------------- 3 | ERROR | Hash comments are prohibited 3 | ERROR | Hash comments are prohibited 4 | ERROR | Expected "if (...) {\n"; found "if (...)\n{\n" 8 | ERROR | Hash comments are prohibited 8 | ERROR | Hash comments are prohibited 10 | ERROR | Hash comments are prohibited 10 | ERROR | Hash comments are prohibited -------------------------------------------------------------------------------- Test script: --------------- copy out code from the samples in the documention referenced above. run the new sniff against the same demo code as suggested in the documentation. Expected result: ---------------- no duplicate error messages. Actual result: -------------- duplicate error messages. ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=15936&edit=1

« previous php.pear.bugs (#260) next »