testilo 13.2.2 → 13.3.1
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/package.json
CHANGED
|
@@ -30,7 +30,6 @@ const populateQuery = (report, query) => {
|
|
|
30
30
|
const {sources, jobData, score} = report;
|
|
31
31
|
const {script, target, requester} = sources;
|
|
32
32
|
const {scoreProcID, summary, details} = score;
|
|
33
|
-
const {total} = summary;
|
|
34
33
|
query.ts = script;
|
|
35
34
|
query.sp = scoreProcID;
|
|
36
35
|
query.dp = id;
|
|
@@ -41,55 +40,51 @@ const populateQuery = (report, query) => {
|
|
|
41
40
|
query.url = target.which;
|
|
42
41
|
query.requester = requester;
|
|
43
42
|
// Add values for the score-summary table to the query.
|
|
44
|
-
['total', 'issue', 'tool', 'prevention', 'log', 'latency'].forEach(sumItem => {
|
|
45
|
-
query[sumItem] = summary[sumItem];
|
|
46
|
-
});
|
|
47
43
|
const rows = {
|
|
48
44
|
summaryRows: [],
|
|
49
45
|
issueRows: []
|
|
50
46
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
rows.summaryRows.push(getScoreRow(itemID, summary[itemID]));
|
|
55
|
-
}
|
|
47
|
+
['total', 'issue', 'tool', 'prevention', 'log', 'latency'].forEach(sumItem => {
|
|
48
|
+
query[sumItem] = summary[sumItem];
|
|
49
|
+
rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
|
|
56
50
|
});
|
|
57
|
-
//
|
|
58
|
-
Object.keys(details.issue)
|
|
51
|
+
// Sort the issue IDs in descending score order.
|
|
52
|
+
const issueIDs = Object.keys(details.issue);
|
|
53
|
+
issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
|
|
54
|
+
// Get rows for the issue-score table.
|
|
55
|
+
issueIDs.forEach(issueID => {
|
|
59
56
|
rows.issueRows.push(getScoreRow(issueID, details.issue[issueID].score));
|
|
60
57
|
});
|
|
61
58
|
// Add the rows to the query.
|
|
62
59
|
['summaryRows', 'issueRows'].forEach(rowType => {
|
|
63
60
|
query[rowType] = rows[rowType].join(innerJoiner);
|
|
64
61
|
});
|
|
65
|
-
// Add
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const scoreP = `<p>Score: ${details.issue[issueID]}</p>`;
|
|
71
|
-
const issueIntroP = '<p>Issue reports in this category:</p>';
|
|
72
|
-
const issueListItems = [];
|
|
62
|
+
// Add paragraph groups about the issue details to the query.
|
|
63
|
+
const issueDetailRows = [];
|
|
64
|
+
issueIDs.forEach(issueID => {
|
|
65
|
+
issueDetailRows.push(`<h3>Issue <code>${issueID}</code></h3>`);
|
|
66
|
+
issueDetailRows.push(`<p>WCAG: ${issueClasses[issueID].wcag || 'N/A'}</p>`);
|
|
73
67
|
const issueData = details.issue[issueID];
|
|
68
|
+
issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
|
|
74
69
|
const toolIDs = Object.keys(issueData.tools);
|
|
75
70
|
toolIDs.forEach(toolID => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
`<
|
|
82
|
-
|
|
71
|
+
issueDetailRows.push(`<h4>Complaints by <code>${toolID}</code></h5>`);
|
|
72
|
+
const ruleIDs = Object.keys(issueData.tools[toolID]);
|
|
73
|
+
ruleIDs.forEach(ruleID => {
|
|
74
|
+
issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
|
|
75
|
+
issueDetailRows.push(
|
|
76
|
+
`<p>Count of instances: ${issueData.tools[toolID][ruleID].complaints.countTotal}</p>`
|
|
77
|
+
);
|
|
78
|
+
issueDetailRows.push('<h6>Complaint specifics</h6>');
|
|
79
|
+
issueDetailRows.push('<ul>');
|
|
80
|
+
issueData.tools[toolID][ruleID].complaints.texts.forEach(text => {
|
|
81
|
+
issueDetailRows.push(` <li>${htmlEscape(text || '')}</li>`);
|
|
82
|
+
});
|
|
83
|
+
issueDetailRows.push('</ul>');
|
|
83
84
|
});
|
|
84
85
|
});
|
|
85
|
-
const issueList = [
|
|
86
|
-
'<ul>',
|
|
87
|
-
issueListItems.join('\n '),
|
|
88
|
-
'</ul>'
|
|
89
|
-
].join(joiner);
|
|
90
|
-
issueSummaryItems.push(issueHeading, wcagP, scoreP, issueIntroP, issueList);
|
|
91
86
|
});
|
|
92
|
-
query.
|
|
87
|
+
query.issueDetailRows = issueDetailRows.join(innerJoiner);
|
|
93
88
|
// Add an HTML-safe copy of the report to the query to be appended to the digest.
|
|
94
89
|
const reportJSON = JSON.stringify(report, null, 2);
|
|
95
90
|
const reportJSONSafe = htmlEscape(reportJSON);
|
|
@@ -97,7 +92,7 @@ const populateQuery = (report, query) => {
|
|
|
97
92
|
};
|
|
98
93
|
// Returns a digested report.
|
|
99
94
|
exports.digester = async report => {
|
|
100
|
-
// Create a query to replace
|
|
95
|
+
// Create a query to replace placeholders.
|
|
101
96
|
const query = {};
|
|
102
97
|
populateQuery(report, query);
|
|
103
98
|
// Get the template.
|