Permalink
Browse files

Use modified LineLength check

Ignore when main reason for too long line is long translatable message.
  • Loading branch information...
1 parent a7c63e6 commit fecb3c1bc9c508a3c4ff2a987c988f4e7277531e @nijel nijel committed Apr 27, 2012
Showing with 14 additions and 5 deletions.
  1. +13 −5 PMAStandard/Sniffs/Files/LineLengthSniff.php
  2. +1 −0 PMAStandard/ruleset.xml
View
18 PMAStandard/Sniffs/Files/LineLengthSniff.php
@@ -1,6 +1,6 @@
<?php
/**
- * Generic_Sniffs_Files_LineLengthSniff.
+ * PMAStandard_Sniffs_Files_LineLengthSniff.
*
* PHP version 5
*
@@ -14,7 +14,7 @@
*/
/**
- * Generic_Sniffs_Files_LineLengthSniff.
+ * PMAStandard_Sniffs_Files_LineLengthSniff.
*
* Checks all lines in the file, and throws warnings if they are over 80
* characters in length and errors if they are over 100. Both these
@@ -29,15 +29,15 @@
* @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
-class Generic_Sniffs_Files_LineLengthSniff implements PHP_CodeSniffer_Sniff
+class PMAStandard_Sniffs_Files_LineLengthSniff implements PHP_CodeSniffer_Sniff
{
/**
* The limit that the length of a line should not exceed.
*
* @var int
*/
- public $lineLimit = 80;
+ public $lineLimit = 85;
/**
* The limit that the length of a line must not exceed.
@@ -46,7 +46,7 @@ class Generic_Sniffs_Files_LineLengthSniff implements PHP_CodeSniffer_Sniff
*
* @var int
*/
- public $absoluteLineLimit = 100;
+ public $absoluteLineLimit = 0;
/**
@@ -124,6 +124,14 @@ protected function checkLineLength(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $
return;
}
+ if (preg_match('|__\("[^"]{40,999}"\)|', $lineContent) !== 0) {
+ return;
+ }
+
+ if (preg_match("|__\('[^']{40,999}'\)|", $lineContent) !== 0) {
+ return;
+ }
+
if (PHP_CODESNIFFER_ENCODING !== 'iso-8859-1') {
// Not using the detault encoding, so take a bit more care.
$lineLength = iconv_strlen($lineContent, PHP_CODESNIFFER_ENCODING);
View
1 PMAStandard/ruleset.xml
@@ -8,6 +8,7 @@
<exclude name="PEAR.Commenting.ClassComment" />
<exclude name="PEAR.Commenting.FunctionComment" />
<exclude name="PEAR.Commenting.InlineComment" />
+ <exclude name="Generic.Files.LineLength" />
</rule>
</ruleset>

0 comments on commit fecb3c1

Please sign in to comment.