Skip to content

Commit

Permalink
Merge pull request #902 from himanshu007-creator/patch-2
Browse files Browse the repository at this point in the history
added newline for better ANSI output
  • Loading branch information
kylekatarnls committed Jun 24, 2021
2 parents 2e2cafc + 5e5cbe7 commit 42fb77b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/php/PHPMD/Renderer/AnsiRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ private function writeViolationsReport(Report $report)
$previousFile = null;
foreach ($report->getRuleViolations() as $violation) {
if ($violation->getFileName() !== $previousFile) {
if ($previousFile !== null) {
$this->getWriter()->write(PHP_EOL);
}

$this->writeViolationFileHeader($violation);
}

Expand Down
1 change: 1 addition & 0 deletions src/test/php/PHPMD/Renderer/AnsiRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function testRendererOutputsForReportWithContents()
$expectedChunks = array(
PHP_EOL . "FILE: /bar.php" . PHP_EOL . "--------------" . PHP_EOL,
" 1 | \e[31mVIOLATION\e[0m | Test description" . PHP_EOL,
PHP_EOL,
PHP_EOL . "FILE: /foo.php" . PHP_EOL . "--------------" . PHP_EOL,
" 2 | \e[31mVIOLATION\e[0m | Test description" . PHP_EOL,
" 3 | \e[31mVIOLATION\e[0m | Test description" . PHP_EOL,
Expand Down

0 comments on commit 42fb77b

Please sign in to comment.