@code-pushup/cli 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +34 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -832,6 +832,14 @@ function sortAudits(a, b) {
|
|
|
832
832
|
}
|
|
833
833
|
return a.title.localeCompare(b.title);
|
|
834
834
|
}
|
|
835
|
+
function compareIssueSeverity(severity1, severity2) {
|
|
836
|
+
const levels = {
|
|
837
|
+
info: 0,
|
|
838
|
+
warning: 1,
|
|
839
|
+
error: 2
|
|
840
|
+
};
|
|
841
|
+
return levels[severity1] - levels[severity2];
|
|
842
|
+
}
|
|
835
843
|
async function loadReport(options2) {
|
|
836
844
|
const { outputDir, filename, format } = options2;
|
|
837
845
|
await ensureDirectoryExists(outputDir);
|
|
@@ -848,6 +856,30 @@ function throwIsNotPresentError(itemName, presentPlace) {
|
|
|
848
856
|
function getPluginNameFromSlug(slug, plugins) {
|
|
849
857
|
return plugins.find(({ slug: pluginSlug }) => pluginSlug === slug)?.title || slug;
|
|
850
858
|
}
|
|
859
|
+
function compareIssues(a, b) {
|
|
860
|
+
if (a.severity !== b.severity) {
|
|
861
|
+
return -compareIssueSeverity(a.severity, b.severity);
|
|
862
|
+
}
|
|
863
|
+
if (!a.source && b.source) {
|
|
864
|
+
return -1;
|
|
865
|
+
}
|
|
866
|
+
if (a.source && !b.source) {
|
|
867
|
+
return 1;
|
|
868
|
+
}
|
|
869
|
+
if (a.source?.file !== b.source?.file) {
|
|
870
|
+
return a.source?.file.localeCompare(b.source?.file || "") || 0;
|
|
871
|
+
}
|
|
872
|
+
if (!a.source?.position && b.source?.position) {
|
|
873
|
+
return -1;
|
|
874
|
+
}
|
|
875
|
+
if (a.source?.position && !b.source?.position) {
|
|
876
|
+
return 1;
|
|
877
|
+
}
|
|
878
|
+
if (a.source?.position?.startLine !== b.source?.position?.startLine) {
|
|
879
|
+
return (a.source?.position?.startLine || 0) - (b.source?.position?.startLine || 0);
|
|
880
|
+
}
|
|
881
|
+
return 0;
|
|
882
|
+
}
|
|
851
883
|
|
|
852
884
|
// packages/utils/src/lib/execute-process.ts
|
|
853
885
|
var ProcessError = class extends Error {
|
|
@@ -1179,7 +1211,7 @@ function reportToAuditsSection(report) {
|
|
|
1179
1211
|
}
|
|
1180
1212
|
const detailsTableData = [
|
|
1181
1213
|
detailsTableHeaders,
|
|
1182
|
-
...audit.details.issues.map((issue) => {
|
|
1214
|
+
...audit.details.issues.sort(compareIssues).map((issue) => {
|
|
1183
1215
|
const severity = `${getSeverityIcon(issue.severity)} <i>${issue.severity}</i>`;
|
|
1184
1216
|
const message = issue.message;
|
|
1185
1217
|
if (!issue.source) {
|
|
@@ -1609,7 +1641,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1609
1641
|
|
|
1610
1642
|
// packages/core/package.json
|
|
1611
1643
|
var name = "@code-pushup/core";
|
|
1612
|
-
var version = "0.
|
|
1644
|
+
var version = "0.4.0";
|
|
1613
1645
|
|
|
1614
1646
|
// packages/core/src/lib/implementation/collect.ts
|
|
1615
1647
|
async function collect(options2) {
|