Re: CodeSniffer - how can I suppress line end messages

From: Date: Thu, 15 Feb 2007 14:19:30 +0000
Subject: Re: CodeSniffer - how can I suppress line end messages
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26589@lists.php.net to get a copy of this message
I got a quick and helpful answer from Greg Sherwood when I emailed him direct. For posterity, I append it here: Hi Matthew, The coding standards that PHP_CodeSniffer comes with both require you to use \n line endings and not \r\n, which is why you are getting errors. I am required to throw errors when \r\n line endings are found. There are really only two things you can do. The first is to just use Unix newlines instead of Windows newlines. Most text editors will allow you to change line endings fairly easily. If you don't want to do that, you'll need to change some code. I suspect it is one test in particular that is giving you most of the errors (if you are using the PEAR standard, which is the default). You'll need to edit: /path/to/PEAR/CodeSniffer/Standards/PEAR/Sniffs/ControlStructures/ControlSignatureSniff.php You'll see an array in there with entires that look like this: "do {\n...} while (...);\n", Change them to use \r\n instead of \n, like this: "do {\r\n...} while (...);\r\n", That should stop most of your errors. Hope that helps. Greg ""Matthew Peters"" <matthew_peters@uk.ibm.com> wrote in message news:4D.63.04145.95698C54@pb1.pair.com... >I like codesniffer but when I run it "out of the box" against our code on >Windows I am inundated with messages like: > Expected "foreach (...) {\n"; found "foreach (...) {\r\n" > i.e. it is complaining about the Windows line end characters. > How can I get CodeSniffer to ignore line end differences? > > Matthew Peters

« previous php.pear.general (#26589) next »