Skip to content

Commit

Permalink
feat(utils): include 1 decimal place when rounding score change
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed Apr 9, 2024
1 parent fa1a993 commit d8b10e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions e2e/cli-e2e/tests/__snapshots__/compare.report-diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

|🏷️ Category|⭐ Current score|⭐ Previous score|🔄 Score change|
|:--|:--:|:--:|:--:|
|Code style|🟡 **77**|🟡 54|![↑ +23](https://img.shields.io/badge/%E2%86%91%20%2B23-green)|
|Code style|🟡 **77**|🟡 54|![↑ +23.1](https://img.shields.io/badge/%E2%86%91%20%2B23.1-green)|
|Bug prevention|🟡 **68**|🟡 68||

## 🎗️ Groups
Expand All @@ -16,7 +16,7 @@

|🔌 Plugin|🗃️ Group|⭐ Current score|⭐ Previous score|🔄 Score change|
|:--|:--|:--:|:--:|:--:|
|ESLint|Suggestions|🟡 **71**|🟡 50|![↑ +21](https://img.shields.io/badge/%E2%86%91%20%2B21-green)|
|ESLint|Suggestions|🟡 **71**|🟡 50|![↑ +21.4](https://img.shields.io/badge/%E2%86%91%20%2B21.4-green)|

3 other groups are unchanged.

Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/lib/reports/generate-md-reports-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function formatGroupsOrAuditsDetails<T extends 'group' | 'audit'>(

function formatScoreChange(diff: number): string {
const marker = getDiffMarker(diff);
const text = formatDiffNumber(Math.round(diff * 100));
const text = formatDiffNumber(Math.round(diff * 1000) / 10); // round with max 1 decimal
return colorByScoreDiff(`${marker} ${text}`, diff);
}

Expand Down

0 comments on commit d8b10e2

Please sign in to comment.