testilo 19.4.0 → 19.4.2
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 +1 -1
- package/procs/analyze/credit.js +13 -9
package/package.json
CHANGED
package/procs/analyze/credit.js
CHANGED
|
@@ -12,7 +12,9 @@ exports.credit = reports => {
|
|
|
12
12
|
tools: {},
|
|
13
13
|
issueCounts: {
|
|
14
14
|
total: 0,
|
|
15
|
-
|
|
15
|
+
nonOnlies: 0,
|
|
16
|
+
onlies: 0,
|
|
17
|
+
toolOnlies: {}
|
|
16
18
|
}
|
|
17
19
|
};
|
|
18
20
|
const {instanceCounts, onlies, mosts, tools, issueCounts} = tally;
|
|
@@ -20,10 +22,8 @@ exports.credit = reports => {
|
|
|
20
22
|
reports.forEach(report => {
|
|
21
23
|
// If it is valid:
|
|
22
24
|
if (report.score && report.score.details && report.score.details.issue) {
|
|
23
|
-
// Populate the issue count.
|
|
24
|
-
const issues = report.score.details && report.score.details.issue;
|
|
25
|
-
issueCounts.total = Object.keys(issues).length;
|
|
26
25
|
// For each issue:
|
|
26
|
+
const issues = report.score.details && report.score.details.issue;
|
|
27
27
|
Object.keys(issues).forEach(issueID => {
|
|
28
28
|
// For each tool with any complaints about it:
|
|
29
29
|
if (! instanceCounts[issueID]) {
|
|
@@ -72,18 +72,22 @@ exports.credit = reports => {
|
|
|
72
72
|
console.log(`ERROR: Report ${report.id} missing score data`);
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
+
// Populate the total and initial non-only issue counts.
|
|
76
|
+
issueCounts.nonOnlies = issueCounts.total = Object.keys(instanceCounts).length;
|
|
75
77
|
// For each tallied issue:
|
|
76
78
|
Object.keys(instanceCounts).forEach(issueID => {
|
|
77
79
|
// If only 1 tool complained about it:
|
|
78
|
-
const toolIDs = Object.keys(instanceCounts[issueID])
|
|
80
|
+
const toolIDs = Object.keys(instanceCounts[issueID]);
|
|
79
81
|
if (toolIDs.length === 1) {
|
|
80
|
-
// Add this to the tally.
|
|
82
|
+
// Add this to the tally and decrement the non-only total.
|
|
81
83
|
const toolID = toolIDs[0];
|
|
82
84
|
onlies[issueID] = toolID;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
issueCounts.onlies++;
|
|
86
|
+
if (! issueCounts.toolOnlies[toolID]) {
|
|
87
|
+
issueCounts.toolOnlies[toolID] = 0;
|
|
85
88
|
}
|
|
86
|
-
issueCounts.
|
|
89
|
+
issueCounts.toolOnlies[toolID]++;
|
|
90
|
+
issueCounts.nonOnlies--;
|
|
87
91
|
}
|
|
88
92
|
// Otherwise, i.e. if multiple tools complained about it:
|
|
89
93
|
else {
|