From f77f35ebf42953740a29bf5b191f2ec29a277174 Mon Sep 17 00:00:00 2001 From: zarabatana Date: Thu, 27 Feb 2020 10:37:47 +0000 Subject: [PATCH 1/4] MULTISITE-23205: Exclude yml files from phpcs. --- .../Sniffs/Generic/HardcodedPathSniff.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php b/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php index bbca97b..b52344e 100644 --- a/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php +++ b/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php @@ -52,10 +52,17 @@ public function register() */ public function process(File $phpcsFile, $stackPtr) { + $end = (count($phpcsFile->getTokens()) + 1); // Check whole project for string "sites/". $fileContent = file_get_contents($phpcsFile->getFilename()); if (strpos($fileContent, 'sites') === false) { - $end = (count($phpcsFile->getTokens()) + 1); + return $end; + } + + // If the file extension is equal to '.yml' return. + $fileName = $phpcsFile->getFilename(); + $fileExtension = strtolower(substr($fileName, -4)); + if ($fileExtension === '.yml') { return $end; } From f79c7bfa01af7ba81b9136443e02da1994e4c893 Mon Sep 17 00:00:00 2001 From: zarabatana Date: Thu, 27 Feb 2020 12:43:42 +0000 Subject: [PATCH 2/4] MULTISITE-23205: Exclude yml files from phpcs. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95496c6..465a678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # QA Automation change log +## Version 4.0.4 + * MULTISITE-23205: Exclude yml files from phpcs + ## Version 4.0.3 * MULTISITE-22812: Bugfix on docker-compose.yml sniff From ca66ba34a0fe2b30beb0ccb474905db45b67ab54 Mon Sep 17 00:00:00 2001 From: zarabatana Date: Thu, 27 Feb 2020 13:22:35 +0000 Subject: [PATCH 3/4] MULTISITE-23205: Exclude yml files from phpcs. --- phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php b/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php index b52344e..8e8d5c0 100644 --- a/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php +++ b/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php @@ -60,7 +60,7 @@ public function process(File $phpcsFile, $stackPtr) } // If the file extension is equal to '.yml' return. - $fileName = $phpcsFile->getFilename(); + $fileName = $phpcsFile->getFilename(); $fileExtension = strtolower(substr($fileName, -4)); if ($fileExtension === '.yml') { return $end; From df0ce7871988e2e041af984999820df9f0e3d134 Mon Sep 17 00:00:00 2001 From: zarabatana Date: Thu, 27 Feb 2020 13:28:51 +0000 Subject: [PATCH 4/4] MULTISITE-23205: Exclude yml files from phpcs. --- phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php b/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php index 8e8d5c0..faadf02 100644 --- a/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php +++ b/phpcs/QualityAssurance/Sniffs/Generic/HardcodedPathSniff.php @@ -60,7 +60,7 @@ public function process(File $phpcsFile, $stackPtr) } // If the file extension is equal to '.yml' return. - $fileName = $phpcsFile->getFilename(); + $fileName = $phpcsFile->getFilename(); $fileExtension = strtolower(substr($fileName, -4)); if ($fileExtension === '.yml') { return $end;