Skip to content

Commit

Permalink
ConsoleFormatter: output 'file:line' to allow jump-to-line in IDEs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
janedbal authored Mar 8, 2024
1 parent b90e349 commit c71e756
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Supportive/OutputFormatter/ConsoleOutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function printMultilinePath(OutputInterface $output, DependencyInterface
$buffer = implode(
" -> \n",
array_map(
static fn (array $dependency): string => sprintf("\t%s::%d", $dependency['name'], $dependency['line']),
static fn (array $dependency): string => sprintf("\t%s:%d", $dependency['name'], $dependency['line']),
$dep->serialize()
)
);
Expand Down Expand Up @@ -170,7 +170,7 @@ private function printUncovered(OutputResult $result, OutputInterface $output):

private function printFileOccurrence(OutputInterface $output, FileOccurrence $fileOccurrence): void
{
$output->writeLineFormatted($fileOccurrence->filepath.'::'.$fileOccurrence->line);
$output->writeLineFormatted($fileOccurrence->filepath.':'.$fileOccurrence->line);
}

private function printErrors(OutputResult $result, OutputInterface $output): void
Expand Down
18 changes: 9 additions & 9 deletions tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ public static function basicDataProvider(): iterable
'warnings' => [],
'
ClassA must not depend on ClassB (LayerA on LayerB)
originalA.php::12
ClassInheritD::6 ->
ClassInheritC::5 ->
ClassInheritB::4 ->
ClassInheritA::3 ->
OriginalB::12
originalA.php:12
ClassInheritD:6 ->
ClassInheritC:5 ->
ClassInheritB:4 ->
ClassInheritA:3 ->
OriginalB:12
Report:
Violations: 1
Expand All @@ -108,7 +108,7 @@ public static function basicDataProvider(): iterable
'warnings' => [],
'
OriginalA must not depend on OriginalB (LayerA on LayerB)
originalA.php::12
originalA.php:12
Report:
Violations: 1
Expand Down Expand Up @@ -147,7 +147,7 @@ public static function basicDataProvider(): iterable
[],
'warnings' => [],
'[SKIPPED] OriginalA must not depend on OriginalB (LayerA on LayerB)
originalA.php::12
originalA.php:12
Report:
Violations: 0
Expand All @@ -171,7 +171,7 @@ public static function basicDataProvider(): iterable
'
Uncovered dependencies:
OriginalA has uncovered dependency on OriginalB (LayerA)
originalA.php::12
originalA.php:12
Report:
Violations: 0
Skipped violations: 0
Expand Down

0 comments on commit c71e756

Please sign in to comment.