Skip to content

Commit

Permalink
Minor code edits in ByIssueLevelAndType
Browse files Browse the repository at this point in the history
  • Loading branch information
bdsl committed Dec 2, 2022
1 parent c1d2e56 commit 9e63bf6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Psalm/Report/ByIssueLevelAndTypeReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public function create(): string
HEADING;

;

foreach ($this->issues_data as $issue_data) {
$output .= $this->format($issue_data) . "\n" . "\n";
}
Expand All @@ -54,7 +52,7 @@ public function create(): string
}

/**
* Copied from ConsoleReport with only very minor changes. Todo consider reducing code duplication
* Copied from ConsoleReport with only very minor changes.
*/
private function format(IssueData $issue_data): string
{
Expand Down Expand Up @@ -106,7 +104,7 @@ private function format(IssueData $issue_data): string
}

/**
* Copied from ConsoleReport unchanged. Todo consider reducing code duplication
* Copied from ConsoleReport unchanged. We could consider moving to another class to reduce duplication.
* @param non-empty-list<DataFlowNodeData|array{label: string, entry_path_type: string}> $taint_trace
*/
private function getTaintSnippets(array $taint_trace): string
Expand Down Expand Up @@ -141,6 +139,7 @@ private function getTaintSnippets(array $taint_trace): string
}

/**
* Copied from ConsoleReport unchanged. We could consider moving to another class to reduce duplication.
* @param IssueData|DataFlowNodeData $data
*/
private function getFileReference($data): string
Expand Down Expand Up @@ -180,7 +179,7 @@ private function getFileReference($data): string
private function sortIssuesByLevelAndType(): void
{
usort($this->issues_data, function (IssueData $left, IssueData $right): int {

// negative error levels go to the top, followed by large positive levels, with level 1 at the bottom.
return [$left->error_level > 0, -$left->error_level, $left->type] <=>
[$right->error_level > 0, -$right->error_level, $right->type];
});
Expand Down

0 comments on commit 9e63bf6

Please sign in to comment.