Skip to content

Commit d8b10e2

Browse files
committed
feat(utils): include 1 decimal place when rounding score change
1 parent fa1a993 commit d8b10e2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

e2e/cli-e2e/tests/__snapshots__/compare.report-diff.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

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

1212
## 🎗️ Groups
@@ -16,7 +16,7 @@
1616

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

2121
3 other groups are unchanged.
2222

packages/utils/src/lib/reports/generate-md-reports-diff.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function formatGroupsOrAuditsDetails<T extends 'group' | 'audit'>(
179179

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

0 commit comments

Comments
 (0)