testilo 41.5.0 → 41.5.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.
@@ -21,35 +21,58 @@
21
21
  */
22
22
 
23
23
  /*
24
- tsp43
25
- Testilo score proc 43
24
+ tsp49
25
+ Testilo score proc 49
26
26
 
27
- Computes target score data and adds them to a ts40 report.
27
+ Computes target score data and adds them to a Testaro report.
28
28
  */
29
29
 
30
30
  // IMPORTS
31
31
 
32
- const {issues} = require('./tic43');
32
+ const {issues} = require('./tic49');
33
33
 
34
- // CONSTANTS
34
+ // MISCELLANEOUS CONSTANTS
35
35
 
36
36
  // ID of this proc.
37
- const scoreProcID = 'tsp43';
38
- // Latency weight (how much each second of excess latency adds to the score).
39
- const latencyWeight = 1;
40
- // Normal latency (6 visits, with 1.5 second per visit).
41
- const normalLatency = 9;
42
- // Prevention weights (how much each prevention adds to the score).
43
- const preventionWeight = 300;
44
- const testaroRulePreventionWeight = 30;
45
- // Maximum instance count addition weight (divisor of max).
46
- const maxWeight = 30;
47
- // Issue count weight.
37
+ const scoreProcID = 'tsp49';
38
+
39
+ // WEIGHT CONSTANTS
40
+ // How much is added to the page score by each component.
41
+
42
+ // 1. Issue
43
+ // Each issue.
48
44
  const issueCountWeight = 10;
49
- // Other weights.
45
+ /*
46
+ Expander of instance counts for issues with inherently limited instance counts. Divide this by
47
+ the maximum possible instance count and add the quotient to 1, then multiply the sum by the actual
48
+ instance count, i.e. the largest rule-quality-weighted instance count among the tools with any
49
+ instances of the issue.
50
+ */
51
+ const maxWeight = 30;
52
+
53
+ // 2. Solo
54
+
55
+ // 3. Tool
56
+ /*
57
+ Severity: amount added to each raw tool score by each violation of a rule with ordinal severity 0
58
+ through 3.
59
+ */
50
60
  const severityWeights = [1, 2, 3, 4];
61
+ // Final: multiplier of the raw tool score to obtain the final tool score.
51
62
  const toolWeight = 0.1;
63
+
64
+ // 4. Element
65
+ // Multiplier of the count of elements with at least 1 rule violation.
52
66
  const elementWeight = 2;
67
+
68
+ // 5. Prevention
69
+ // Each tool prevention by the page.
70
+ const preventionWeight = 300;
71
+ // Each prevention of a Testaro rule test by the page.
72
+ const testaroRulePreventionWeight = 30;
73
+
74
+ // 6. Log
75
+ // Multipliers of log values to obtain the log score.
53
76
  const logWeights = {
54
77
  logCount: 0.1,
55
78
  logSize: 0.002,
@@ -58,6 +81,15 @@ const logWeights = {
58
81
  prohibitedCount: 3,
59
82
  visitRejectionCount: 2
60
83
  };
84
+
85
+ // 7. Latency
86
+ // Normal latency (11 visits [1 per tool], with 2 seconds per visit).
87
+ const normalLatency = 22;
88
+ // Total latency exceeding normal, in seconds.
89
+ const latencyWeight = 2;
90
+
91
+ // RULE CONSTANTS
92
+
61
93
  // Initialize a table of tool rules.
62
94
  const issueIndex = {};
63
95
  // Initialize an array of variably named tool rules.
@@ -163,7 +195,8 @@ exports.scorer = report => {
163
195
  );
164
196
  // For each instance of the tool:
165
197
  standardResult.instances.forEach(instance => {
166
- const {count, ordinalSeverity, pathID, ruleID, what} = instance;
198
+ const {ordinalSeverity, pathID, ruleID, what} = instance;
199
+ const count = instance.count || 1;
167
200
  // If the rule ID is not in the table of tool rules:
168
201
  let canonicalRuleID = ruleID;
169
202
  if (! issueIndex[which][ruleID]) {
@@ -201,7 +234,7 @@ exports.scorer = report => {
201
234
  if (! details.issue[issueName].instanceCounts[which]) {
202
235
  details.issue[issueName].instanceCounts[which] = 0;
203
236
  }
204
- details.issue[issueName].instanceCounts[which] += count || 1;
237
+ details.issue[issueName].instanceCounts[which] += count;
205
238
  if (! details.issue[issueName].tools[which][canonicalRuleID]) {
206
239
  const ruleData = issues[issueName].tools[which][canonicalRuleID];
207
240
  details.issue[issueName].tools[which][canonicalRuleID] = {