testilo 34.0.2 → 35.0.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.
Files changed (55) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +49 -12
  3. package/batch.js +22 -0
  4. package/call.js +22 -0
  5. package/compare.js +22 -0
  6. package/credit.js +22 -0
  7. package/difgest.js +22 -0
  8. package/digest.js +22 -0
  9. package/merge.js +22 -0
  10. package/package.json +5 -5
  11. package/procs/analyze/axeFrac.js +22 -0
  12. package/procs/analyze/coverage.js +22 -0
  13. package/procs/analyze/ruleCounts.js +22 -0
  14. package/procs/analyze/toolScores.js +22 -0
  15. package/procs/compare/cpA11yMessage/index.js +22 -0
  16. package/procs/compare/cpProductPrice/index.js +22 -0
  17. package/procs/compare/tcp40/index.js +22 -0
  18. package/procs/difgest/tfp40/index.js +22 -0
  19. package/procs/digest/dpProductPrice/index.js +22 -0
  20. package/procs/digest/dpa11yMessage/index.js +22 -0
  21. package/procs/digest/tdp40/index.js +22 -0
  22. package/procs/digest/tdp41/index.js +24 -2
  23. package/procs/digest/tdp42/index.html +1 -1
  24. package/procs/digest/tdp42/index.js +25 -3
  25. package/procs/score/tic40.js +22 -0
  26. package/procs/score/tic41.js +22 -0
  27. package/procs/score/tsp40.js +22 -0
  28. package/procs/score/tsp41.js +24 -2
  29. package/procs/score/tsp42.js +366 -0
  30. package/procs/score/tspA11yMessage.js +22 -0
  31. package/procs/score/tspProductPrice.js +22 -0
  32. package/procs/test.js +22 -0
  33. package/procs/track/ttp40/index.js +22 -0
  34. package/procs/util.js +23 -1
  35. package/reconcile.js +22 -0
  36. package/rescore.js +22 -0
  37. package/score.js +22 -0
  38. package/script.js +22 -0
  39. package/summarize.js +22 -0
  40. package/track.js +22 -0
  41. package/validation/compare/comparer.js +22 -0
  42. package/validation/compare/validate.js +22 -0
  43. package/validation/digest/digester.js +22 -0
  44. package/validation/digest/validate.js +22 -0
  45. package/validation/merge/validate.js +22 -0
  46. package/validation/score/scorer.js +22 -0
  47. package/validation/score/validate.js +22 -0
  48. package/toolRules/alfa.tsv +0 -82
  49. package/toolRules/axe.js +0 -390
  50. package/toolRules/htmlcs.js +0 -543
  51. package/toolRules/ibm.tsv +0 -159
  52. package/toolRules/qualWeb.tsv +0 -121
  53. package/toolRules/tenon.tsv +0 -14
  54. package/toolRules/wave.json +0 -1617
  55. package/toolRules/wave.tsv +0 -55
@@ -1,11 +1,33 @@
1
- // index: digester for scoring procedure tsp40.
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ // index: digester for scoring procedure tsp41.
2
24
 
3
25
  // IMPORTS
4
26
 
5
27
  // Module to keep secrets.
6
28
  require('dotenv').config();
7
29
  // Module to classify tool rules into issues
8
- const {issues} = require('../../score/tic40');
30
+ const {issues} = require('../../score/tic41');
9
31
  // Module to process files.
10
32
  const fs = require('fs/promises');
11
33
  // Utility module.
@@ -36,7 +36,7 @@
36
36
  <h2>Introduction</h2>
37
37
  <p>How <a href="https://www.w3.org/WAI/">accessible</a> is the __org__ web page at <a href="__url__"><code>__url__</code></a>?</p>
38
38
  <p>This digest can help answer that question. Ten different tools (Alfa, ASLint, Axe, Editoria11y, Equal Access, HTML CodeSniffer, Nu Html Checker, QualWeb, Testaro, and WAVE) tested the page to check its compliance with their accessibility rules. In all, the tools define about 990 rules, which are classified here into about 310 accessibility issues.</p>
39
- <p>The results were interpreted to yield a score, with 0 being ideal. The score for this page was __total__, the sum of __issueCount__ for the count of issues, __issue__ for specific issues, __solo__ for unclassified rule violations, __tool__ for tool-by-tool ratings, __prevention__ for the page preventing tools from running, __log__ for browser warnings, and __latency__ for delayed page responses.</p>
39
+ <p>The results were interpreted to yield a score, with 0 being ideal. The score for this page was __total__, the sum of __issueCount__ for the count of issues, __issue__ for specific issues, __solo__ for unclassified rule violations, __tool__ for tool-by-tool ratings, __element__ for the count of violating elements, __prevention__ for the page preventing tools from running, __log__ for browser warnings, and __latency__ for delayed page responses.</p>
40
40
  <h2>Issue summary</h2>
41
41
  <p>This table shows the issues discovered by one or more tools. When an instance count is 0, that means the tool has a test for the issue but the page passed that test.</p>
42
42
  <p>Why do instance counts differ among tools? Possibly because the tests are not really equivalent, or a test is unreliable. You can inspect the <a href="__reportURL__">full report</a> to diagnose differences.</p>
@@ -1,11 +1,33 @@
1
- // index: digester for scoring procedure tsp40.
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ // index: digester for scoring procedure tsp42.
2
24
 
3
25
  // IMPORTS
4
26
 
5
27
  // Module to keep secrets.
6
28
  require('dotenv').config();
7
29
  // Module to classify tool rules into issues
8
- const {issues} = require('../../score/tic40');
30
+ const {issues} = require('../../score/tic41');
9
31
  // Module to process files.
10
32
  const fs = require('fs/promises');
11
33
  // Utility module.
@@ -59,7 +81,7 @@ const populateQuery = (report, query) => {
59
81
  summaryRows: [],
60
82
  issueRows: []
61
83
  };
62
- ['total', 'issueCount', 'issue', 'solo', 'tool', 'prevention', 'log', 'latency']
84
+ ['total', 'issueCount', 'issue', 'solo', 'tool', 'element', 'prevention', 'log', 'latency']
63
85
  .forEach(sumItem => {
64
86
  query[sumItem] = summary[sumItem];
65
87
  rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  tic40
3
25
  Testilo issue classification 40
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  tic41
3
25
  Testilo issue classification 41
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  tsp40
3
25
  Testilo score proc 40
@@ -1,6 +1,28 @@
1
1
  /*
2
- tsp40
3
- Testilo score proc 40
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ tsp41
25
+ Testilo score proc 41
4
26
 
5
27
  Computes target score data and adds them to a ts40 report.
6
28
  */
@@ -0,0 +1,366 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ tsp42
25
+ Testilo score proc 42
26
+
27
+ Computes target score data and adds them to a ts40 report.
28
+ */
29
+
30
+ // IMPORTS
31
+
32
+ const {issues} = require('./tic41');
33
+
34
+ // CONSTANTS
35
+
36
+ // ID of this proc.
37
+ const scoreProcID = 'tsp42';
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.
48
+ const issueCountWeight = 10;
49
+ // Other weights.
50
+ const severityWeights = [1, 2, 3, 4];
51
+ const toolWeight = 0.1;
52
+ const elementWeight = 1;
53
+ const logWeights = {
54
+ logCount: 0.1,
55
+ logSize: 0.002,
56
+ errorLogCount: 0.2,
57
+ errorLogSize: 0.004,
58
+ prohibitedCount: 3,
59
+ visitRejectionCount: 2
60
+ };
61
+ // Initialize a table of tool rules.
62
+ const issueIndex = {};
63
+ // Initialize an array of variably named tool rules.
64
+ const issueMatcher = [];
65
+ // For each issue:
66
+ Object.keys(issues).forEach(issueName => {
67
+ // For each tool with rules belonging to that issue:
68
+ Object.keys(issues[issueName].tools).forEach(toolName => {
69
+ // For each of those rules:
70
+ Object.keys(issues[issueName].tools[toolName]).forEach(ruleID => {
71
+ // Add it to the table of tool rules.
72
+ if (! issueIndex[toolName]) {
73
+ issueIndex[toolName] = {};
74
+ }
75
+ issueIndex[toolName][ruleID] = issueName;
76
+ // If it is variably named:
77
+ if (issues[issueName].tools[toolName][ruleID].variable) {
78
+ // Add it to the array of variably named tool rules.
79
+ issueMatcher.push(ruleID);
80
+ }
81
+ })
82
+ });
83
+ });
84
+
85
+ // FUNCTIONS
86
+
87
+ // Scores a report.
88
+ exports.scorer = report => {
89
+ // If there are any acts in the report:
90
+ const {acts} = report;
91
+ if (Array.isArray(acts) && acts.length) {
92
+ // If any of them are test acts:
93
+ const testActs = acts.filter(act => act.type === 'test');
94
+ const testTools = new Set(testActs.map(act => act.which));
95
+ if (testActs.length) {
96
+ // Initialize the score data.
97
+ const score = {
98
+ scoreProcID,
99
+ weights: {
100
+ severities: severityWeights,
101
+ tool: toolWeight,
102
+ element: elementWeight,
103
+ log: logWeights,
104
+ latency: latencyWeight,
105
+ prevention: preventionWeight,
106
+ testaroRulePrevention: testaroRulePreventionWeight,
107
+ maxInstanceCount: maxWeight
108
+ },
109
+ normalLatency,
110
+ summary: {
111
+ total: 0,
112
+ issueCount: 0,
113
+ issue: 0,
114
+ solo: 0,
115
+ tool: 0,
116
+ element: 0,
117
+ prevention: 0,
118
+ log: 0,
119
+ latency: 0
120
+ },
121
+ details: {
122
+ severity: {
123
+ total: [0, 0, 0, 0],
124
+ byTool: {}
125
+ },
126
+ prevention: {},
127
+ issue: {},
128
+ solo: {},
129
+ tool: {}
130
+ }
131
+ };
132
+ // Initialize the set of path-identified elements.
133
+ const pathIDs = new Set();
134
+ const {summary, details} = score;
135
+ // For each test act:
136
+ testActs.forEach(act => {
137
+ const {data, which, standardResult} = act;
138
+ // If the tool is Testaro and the count of rule preventions was reported:
139
+ if (which === 'testaro' && data && data.rulePreventions) {
140
+ // Add their score to the score.
141
+ details.prevention.testaro = testaroRulePreventionWeight * data.rulePreventions.length;
142
+ }
143
+ // If the page prevented the tool from operating:
144
+ if (! standardResult || standardResult.prevented) {
145
+ // Add this to the score.
146
+ details.prevention[which] = preventionWeight;
147
+ }
148
+ // Otherwise, if a valid standard result exists:
149
+ else if (
150
+ standardResult
151
+ && standardResult.totals
152
+ && standardResult.totals.length === 4
153
+ && standardResult.instances
154
+ ) {
155
+ // Add the severity totals of the tool to the score.
156
+ const {totals} = standardResult;
157
+ details.severity.byTool[which] = totals;
158
+ // Add the severity-weighted tool totals to the score.
159
+ details.tool[which] = totals.reduce(
160
+ (sum, current, index) => sum + severityWeights[index] * current, 0
161
+ );
162
+ // For each instance of the tool:
163
+ standardResult.instances.forEach(instance => {
164
+ const {count, ordinalSeverity, pathID, ruleID, what} = instance;
165
+ // Get the rule ID.
166
+ // If it is not in the table of tool rules:
167
+ let canonicalRuleID = ruleID;
168
+ if (! issueIndex[which][ruleID]) {
169
+ // Convert it to the variably named tool rule that it matches, if any.
170
+ canonicalRuleID = issueMatcher.find(pattern => {
171
+ const patternRE = new RegExp(pattern);
172
+ return patternRE.test(ruleID);
173
+ });
174
+ }
175
+ // If the rule ID belongs to a non-ignorable issue:
176
+ if (canonicalRuleID) {
177
+ // Get the issue.
178
+ const issueName = issueIndex[which][canonicalRuleID];
179
+ // Add the instance to the issue details of the score data.
180
+ if (issueName !== 'ignorable') {
181
+ if (! details.issue[issueName]) {
182
+ details.issue[issueName] = {
183
+ summary: issues[issueName].summary,
184
+ wcag: issues[issueName].wcag || '',
185
+ score: 0,
186
+ maxCount: 0,
187
+ weight: issues[issueName].weight,
188
+ countLimit: issues[issueName].max,
189
+ instanceCounts: {},
190
+ tools: {}
191
+ };
192
+ if (! details.issue[issueName].countLimit) {
193
+ delete details.issue[issueName].countLimit;
194
+ }
195
+ }
196
+ if (! details.issue[issueName].tools[which]) {
197
+ details.issue[issueName].tools[which] = {};
198
+ }
199
+ if (! details.issue[issueName].instanceCounts[which]) {
200
+ details.issue[issueName].instanceCounts[which] = 0;
201
+ }
202
+ details.issue[issueName].instanceCounts[which] += count || 1;
203
+ if (! details.issue[issueName].tools[which][canonicalRuleID]) {
204
+ const ruleData = issues[issueName].tools[which][canonicalRuleID];
205
+ details.issue[issueName].tools[which][canonicalRuleID] = {
206
+ quality: ruleData.quality,
207
+ what: ruleData.what,
208
+ complaints: {
209
+ countTotal: 0,
210
+ texts: []
211
+ }
212
+ };
213
+ }
214
+ details
215
+ .issue[issueName]
216
+ .tools[which][canonicalRuleID]
217
+ .complaints
218
+ .countTotal += count || 1;
219
+ if (
220
+ ! details
221
+ .issue[issueName]
222
+ .tools[which][canonicalRuleID]
223
+ .complaints
224
+ .texts
225
+ .includes(what)
226
+ ) {
227
+ details
228
+ .issue[issueName]
229
+ .tools[which][canonicalRuleID]
230
+ .complaints
231
+ .texts
232
+ .push(what);
233
+ }
234
+ }
235
+ }
236
+ // Otherwise, i.e. if the rule ID belongs to no issue:
237
+ else {
238
+ // Add the instance to the solo details of the score data.
239
+ if (! details.solo[which]) {
240
+ details.solo[which] = {};
241
+ }
242
+ if (! details.solo[which][ruleID]) {
243
+ details.solo[which][ruleID] = 0;
244
+ }
245
+ details.solo[which][ruleID] += (count || 1) * (ordinalSeverity + 1);
246
+ // Report this.
247
+ console.log(`ERROR: ${ruleID} of ${which} not found in issues`);
248
+ }
249
+ // Ensure that the element, if path-identified, is in the set of elements.
250
+ if (pathID) {
251
+ pathIDs.add(pathID);
252
+ }
253
+ });
254
+ }
255
+ // Otherwise, i.e. if a failed standard result exists:
256
+ else {
257
+ // Add an inferred prevention to the score.
258
+ details.prevention[which] = preventionWeight;
259
+ }
260
+ });
261
+ // For each non-ignorable issue with any complaints:
262
+ Object.keys(details.issue).forEach(issueName => {
263
+ const issueData = details.issue[issueName];
264
+ // For each tool with any complaints for the issue:
265
+ Object.keys(issueData.tools).forEach(toolID => {
266
+ // Get the sum of the quality-weighted counts of its issue rules.
267
+ let weightedCount = 0;
268
+ Object.values(issueData.tools[toolID]).forEach(ruleData => {
269
+ weightedCount += ruleData.quality * ruleData.complaints.countTotal;
270
+ });
271
+ // If the sum exceeds the existing maximum weighted count for the issue:
272
+ if (weightedCount > issueData.maxCount) {
273
+ // Change the maximum count for the issue to the sum.
274
+ issueData.maxCount = weightedCount;
275
+ }
276
+ });
277
+ // Get the score for the issue, including any addition for the instance count limit.
278
+ const maxAddition = issueData.countLimit ? maxWeight / issueData.countLimit : 0;
279
+ issueData.score = Math.round(issueData.weight * issueData.maxCount * (1 + maxAddition));
280
+ // For each tool that has any rule of the issue:
281
+ Object.keys(issues[issueName].tools).forEach(toolName => {
282
+ // If the tool was in the job and has no instances of the issue:
283
+ if (testTools.has(toolName) && ! issueData.instanceCounts[toolName]) {
284
+ // Report its instance count as 0.
285
+ issueData.instanceCounts[toolName] = 0;
286
+ }
287
+ });
288
+ });
289
+ // Add the severity detail totals to the score.
290
+ details.severity.total = Object
291
+ .keys(details.severity.byTool)
292
+ .reduce((severityTotals, toolID) => {
293
+ details.severity.byTool[toolID].forEach((severityScore, index) => {
294
+ severityTotals[index] += severityScore;
295
+ });
296
+ return severityTotals;
297
+ }, details.severity.total);
298
+ // Add the summary issue-count total to the score.
299
+ summary.issueCount = Object.keys(details.issue).length * issueCountWeight;
300
+ // Add the summary issue total to the score.
301
+ summary.issue = Object
302
+ .values(details.issue)
303
+ .reduce((total, current) => total + current.score, 0);
304
+ // Add the summary solo total to the score.
305
+ Object.keys(details.solo).forEach(tool => {
306
+ summary.solo += Object
307
+ .values(details.solo[tool])
308
+ .reduce((total, current) => total + current);
309
+ });
310
+ // Add the summary tool total to the score.
311
+ summary.tool = toolWeight * details.severity.total.reduce(
312
+ (total, current, index) => total + severityWeights[index] * current, 0
313
+ );
314
+ // Add the summary element total to the score.
315
+ summary.element = elementWeight * pathIDs.size;
316
+ // Add the summary prevention total to the score.
317
+ summary.prevention = Object.values(details.prevention).reduce(
318
+ (total, current) => total + current, 0
319
+ );
320
+ // Add the summary log score to the score.
321
+ const {jobData} = report;
322
+ if (jobData) {
323
+ summary.log = Math.max(0, Math.round(
324
+ logWeights.logCount * jobData.logCount
325
+ + logWeights.logSize * jobData.logSize +
326
+ + logWeights.errorLogCount * jobData.errorLogCount
327
+ + logWeights.errorLogSize * jobData.errorLogSize
328
+ + logWeights.prohibitedCount * jobData.prohibitedCount +
329
+ + logWeights.visitRejectionCount * jobData.visitRejectionCount
330
+ ));
331
+ // Add the summary latency score to the score.
332
+ summary.latency = Math.round(
333
+ latencyWeight * (Math.max(0, jobData.visitLatency - normalLatency))
334
+ );
335
+ }
336
+ // Round the unrounded scores.
337
+ Object.keys(summary).forEach(summaryTypeName => {
338
+ summary[summaryTypeName] = Math.round(summary[summaryTypeName]);
339
+ });
340
+ details.severity.total.forEach((severityTotal, index) => {
341
+ details.severity.total[index] = Math.round(severityTotal);
342
+ });
343
+ // Add the summary total score to the score.
344
+ summary.total = summary.issueCount
345
+ + summary.issue
346
+ + summary.solo
347
+ + summary.tool
348
+ + summary.element
349
+ + summary.prevention
350
+ + summary.log
351
+ + summary.latency;
352
+ // Add the score to the report or replace the existing score of the report.
353
+ report.score = score;
354
+ }
355
+ // Otherwise, i.e. if none of them is a test act:
356
+ else {
357
+ // Report this.
358
+ console.log('ERROR: No test acts');
359
+ }
360
+ }
361
+ // Otherwise, i.e. if there are no acts in the report:
362
+ else {
363
+ // Report this.
364
+ console.log('ERROR: No acts');
365
+ }
366
+ };
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  tspA11yMessage
3
25
  Testilo score proc a11yMessage
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  spProductPrice
3
25
  Testilo score proc productPrice
package/procs/test.js CHANGED
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  // Array of 62 alphanumeric characters.
2
24
  const alphaNumChars = (() => {
3
25
  const digits = Array(10).fill('').map((digit, index) => index.toString());
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2024 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  // index: tracker for tracking procedure ttp40.
2
24
 
3
25
  // IMPORTS