From 1926b4051c15330b352ac6e726db1fb0a7acc86f Mon Sep 17 00:00:00 2001 From: Tomas Pospisil Date: Sun, 17 Mar 2019 16:39:56 +0100 Subject: [PATCH] Add ignore line --- composer.json | 3 ++- src/FileOutput.php | 18 ++++++++++++++---- src/table.phtml | 5 +++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 9a47d1c..460695c 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "phpstan/phpstan": "^0.11", "nette/utils": "2.5.*", "webmozart/path-util": "^2.3", - "thecodingmachine/safe": "^0.1.9" + "thecodingmachine/safe": "^0.1.9", + "nette/neon": "^3.0.0" }, "license": "MIT", "require-dev": { diff --git a/src/FileOutput.php b/src/FileOutput.php index be60cf8..9da642e 100644 --- a/src/FileOutput.php +++ b/src/FileOutput.php @@ -1,9 +1,11 @@ defaultFormatter = $defaultFormatterClass; $cwd = \Safe\getcwd() . DIRECTORY_SEPARATOR; try { - $outputFile = Strings::replace($outputFile, '{time}', (string)time()); + $outputFile = Strings::replace($outputFile, '{time}', (string) time()); } catch (RegexpException $e) { } @@ -114,9 +124,10 @@ private function generateFile(AnalysisResult $analysisResult): void $line = $fileSpecificError->getLine() ?? 1; $link = strtr($this->link, ['%file' => $file, '%line' => $line]); $output[self::FILES][$file][] = [ - self::ERROR => $this->formatMessage($fileSpecificError->getMessage()), + self::ERROR => self::formatMessage($fileSpecificError->getMessage()), self::LINK => $link, self::LINE => $line, + self::IGNORE => Neon::encode($fileSpecificError->getMessage()), ]; } @@ -126,13 +137,12 @@ private function generateFile(AnalysisResult $analysisResult): void }); } unset($file); - } FileSystem::write($this->outputFile, $this->getTable($output)); } - private function formatMessage(string $message): string + private static function formatMessage(string $message): string { $words = explode(' ', $message); $words = array_map(function ($word) { diff --git a/src/table.phtml b/src/table.phtml index 6bb2814..29b1170 100644 --- a/src/table.phtml +++ b/src/table.phtml @@ -1,4 +1,5 @@ + + + +