diff --git a/Magento2/Sniffs/Files/LineLengthSniff.php b/Magento2/Sniffs/Files/LineLengthSniff.php deleted file mode 100644 index f8baefa9..00000000 --- a/Magento2/Sniffs/Files/LineLengthSniff.php +++ /dev/null @@ -1,132 +0,0 @@ -doesPreviousLineContainTranslationString()) { - parent::checkLineLength($phpcsFile, $tokens, $stackPtr); - } - - $this->updateLineBuffer($phpcsFile, $tokens, $stackPtr); - } - - /** - * Checks whether the previous line is part of a translation. - * - * The generic line sniff (which we are falling back to if there is no translation) always checks the length of the - * last line, so we have to check the last and next-to-last line for translations. - * - * @return bool - */ - protected function doesPreviousLineContainTranslationString() - { - $lastLineMatch = preg_match($this->lastLineRegExp, $this->lastLineContent) !== 0; - $nextToLastLineMatch = preg_match($this->nextToLastLineRegexp, $this->nextToLastLineContent) !== 0; - - return $lastLineMatch || $nextToLastLineMatch; - } - - /** - * Assembles and returns the content for the code line of the provided stack pointer. - * - * @param File $phpcsFile - * @param array $tokens - * @param int $stackPtr - * @return string - */ - protected function getLineContent(File $phpcsFile, array $tokens, $stackPtr) - { - $lineContent = ''; - - /* - * Avoid out of range error at the end of the file - */ - if (!array_key_exists($stackPtr, $tokens)) { - return $lineContent; - } - - $codeLine = $tokens[$stackPtr]['line']; - - /* - * Concatenate the string until we jump to the next line or reach the end of line character. - */ - while (array_key_exists($stackPtr, $tokens) && - $tokens[$stackPtr]['line'] === $codeLine && - $tokens[$stackPtr]['content'] !== $phpcsFile->eolChar) { - $lineContent .= $tokens[$stackPtr]['content']; - $stackPtr++; - } - - return $lineContent; - } - - /** - * Pre-fills the line buffer for the next iteration. - * - * @param File $phpcsFile - * @param array $tokens - * @param int $stackPtr - */ - protected function updateLineBuffer(File $phpcsFile, array $tokens, $stackPtr) - { - $this->nextToLastLineContent = $this->lastLineContent; - $this->lastLineContent = $this->getLineContent($phpcsFile, $tokens, $stackPtr); - } -} diff --git a/Magento2/Sniffs/PHP/FinalImplementationSniff.php b/Magento2/Sniffs/PHP/FinalImplementationSniff.php index 2010e06d..e2ab7b16 100644 --- a/Magento2/Sniffs/PHP/FinalImplementationSniff.php +++ b/Magento2/Sniffs/PHP/FinalImplementationSniff.php @@ -27,7 +27,7 @@ public function register() public function process(File $phpcsFile, $stackPtr) { $phpcsFile->addError( - // phpcs:ignore Magento2.Files.LineLength.MaxExceeded + // phpcs:ignore Generic.Files.LineLength 'Final keyword is prohibited in Magento. It decreases extensibility and is not compatible with plugins and proxies.', $stackPtr, 'FoundFinal' diff --git a/Magento2/Sniffs/Security/LanguageConstructSniff.php b/Magento2/Sniffs/Security/LanguageConstructSniff.php index a0981988..acb71481 100644 --- a/Magento2/Sniffs/Security/LanguageConstructSniff.php +++ b/Magento2/Sniffs/Security/LanguageConstructSniff.php @@ -23,7 +23,7 @@ class LanguageConstructSniff implements Sniff /** * String representation of backtick error. * - * phpcs:disable Magento2.Files.LineLength.MaxExceeded + * phpcs:disable Generic.Files.LineLength * * @var string */ diff --git a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php index fb129097..901419c5 100644 --- a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php +++ b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php @@ -17,7 +17,7 @@ class ExecutableRegExSniff implements Sniff /** * String representation of error. * - * phpcs:disable Magento2.Files.LineLength.MaxExceeded + * phpcs:disable Generic.Files.LineLength * * @var string */ diff --git a/Magento2/Tests/Files/LineLengthUnitTest.inc b/Magento2/Tests/Files/LineLengthUnitTest.inc deleted file mode 100644 index 6bfd8083..00000000 --- a/Magento2/Tests/Files/LineLengthUnitTest.inc +++ /dev/null @@ -1,31 +0,0 @@ - 1, - 19 => 1, - ]; - } - - /** - * @inheritdoc - */ - public function getWarningList() - { - return []; - } -} diff --git a/Magento2/ruleset.xml b/Magento2/ruleset.xml index 2ee867db..8898695b 100644 --- a/Magento2/ruleset.xml +++ b/Magento2/ruleset.xml @@ -172,11 +172,6 @@ */Test/* *Test.php - - 8 - warning - *.phtml - 8 warning @@ -306,6 +301,14 @@ 6 warning + + + + + + 6 + warning + 6 warning diff --git a/README.md b/README.md index b5c784a1..f31135c2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ You can achieve this by adding the following to your project's `composer.json`: ```` "scripts": { "post-install-cmd": [ - "([ $COMPOSER_DEV_MODE -eq 1 ] && vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/) || true" + "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)" ], "post-update-cmd": [ "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"