Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show dashes (-) instead of 0 in the table #443

Merged
merged 8 commits into from Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/task/src/pullRequests/pullRequestComments.ts
Expand Up @@ -202,6 +202,11 @@ export default class PullRequestComments {
surround = '**'
}

return `${surround}${title}${surround}|${surround}${metric.toLocaleString()}${surround}\n`
let metricString = metric.toLocaleString();
GordonBeeming marked this conversation as resolved.
Show resolved Hide resolved
if (metricString === '0') {
metricString = '-';
}

return `${surround}${title}${surround}|${surround}${metricString}${surround}\n`
}
}
2 changes: 1 addition & 1 deletion src/task/task.json
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
"id": "907d3b28-6b37-4ac7-ac75-9631ee53e512",
"name": "PRMetrics",
"friendlyName": "PR Metrics v1.5.9",
"friendlyName": "PR Metrics v1.5.10",
GordonBeeming marked this conversation as resolved.
Show resolved Hide resolved
"description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.",
"helpUrl": "https://aka.ms/PRMetrics/README",
"helpMarkDown": "[More information](https://aka.ms/PRMetrics/README)",
Expand Down
10 changes: 5 additions & 5 deletions src/task/tests/pullRequests/pullRequestComments.spec.ts
Expand Up @@ -359,11 +359,11 @@ describe('pullRequestComments.ts', (): void => {
'✔ **Thanks for adding tests.**\n' +
'||Lines\n' +
'-|-:\n' +
`Product Code|${code[0].toLocaleString()}\n` +
`Test Code|${code[1].toLocaleString()}\n` +
`**Subtotal**|**${code[2].toLocaleString()}**\n` +
`Ignored Code|${code[3].toLocaleString()}\n` +
`**Total**|**${code[4].toLocaleString()}**\n` +
`Product Code|${code[0].toLocaleString() === '0' ? '-' : code[0].toLocaleString()}\n` +
`Test Code|${code[1].toLocaleString() === '0' ? '-' : code[1].toLocaleString()}\n` +
`**Subtotal**|**${code[2].toLocaleString() === '0' ? '-' : code[2].toLocaleString()}**\n` +
`Ignored Code|${code[3].toLocaleString() === '0' ? '-' : code[3].toLocaleString()}\n` +
`**Total**|**${code[4].toLocaleString() === '0' ? '-' : code[4].toLocaleString()}**\n` +
'\n' +
'[Metrics computed by PR Metrics. Add it to your Azure DevOps and GitHub PRs!](https://aka.ms/PRMetrics/Comment)')
verify(logger.logDebug('* PullRequestComments.getMetricsComment()')).once()
Expand Down
2 changes: 1 addition & 1 deletion src/vss-extension.json
Expand Up @@ -3,7 +3,7 @@
"manifestVersion": 1,
"id": "PRMetrics",
"name": "PR Metrics",
"version": "1.5.9",
"version": "1.5.10",
"publisher": "ms-omex",
"description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.",
"public": true,
Expand Down