accessibility-checker 3.1.42 → 3.1.43

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.
@@ -0,0 +1,405 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ Copyright:: 2020- IBM, Inc
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ *****************************************************************************/
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
54
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
55
+ if (ar || !(i in from)) {
56
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
57
+ ar[i] = from[i];
58
+ }
59
+ }
60
+ return to.concat(ar || Array.prototype.slice.call(from));
61
+ };
62
+ Object.defineProperty(exports, "__esModule", { value: true });
63
+ exports.ACReporterXLSX = void 0;
64
+ // Load all the modules that are needed
65
+ var pathLib = require("path");
66
+ var fs = require("fs");
67
+ var ACEngineManager_1 = require("../ACEngineManager");
68
+ var ACConfigManager_1 = require("../ACConfigManager");
69
+ var multiScanData_1 = require("./multiScanData");
70
+ var multiScanReport_1 = require("./multiScanReport");
71
+ var toCSV = function (str) {
72
+ if (str === null) {
73
+ return '"null"';
74
+ }
75
+ else if (str.length == 0) {
76
+ return '""';
77
+ }
78
+ else {
79
+ str = str.replace(/"/g, '""');
80
+ return "\"".concat(str, "\"");
81
+ }
82
+ };
83
+ /**
84
+ * This function is responsible for constructing the aChecker Reporter which will be used to, report
85
+ * the scan results, such as writing the page results and the summary to a JSON file. This reporter function
86
+ * is registered with Karma server and triggered based on events that are triggered by the karma communication.
87
+ *
88
+ * @param {Object} baseReporterDecorator - the base karma reporter, which had the base functions which we override
89
+ * @param {Object} this.Config - All the Karma this.Configuration, we will extract what we need from this over
90
+ * all object, we need the entire object so that we detect any changes in the object
91
+ * as other plugins are loaded and the object is updated dynamically.
92
+ * @param {Object} logger - logger object which is used to log debug/error/info messages
93
+ * @param {Object} emitter - emitter object which allows to listem on any event that is triggered and allow to execute
94
+ * custom code, to handle the event that was triggered.
95
+ *
96
+ * @return - N/A
97
+ *
98
+ * @memberOf this
99
+ */
100
+ var ACReporterXLSX = /** @class */ (function () {
101
+ // helpPath:string = ""
102
+ function ACReporterXLSX(config, scanSummary) {
103
+ this.storedScans = [];
104
+ this.resultStr = "Label,Level,RuleId,Message,Xpath,Help\n";
105
+ this.deploymentDate = "latest";
106
+ this.accessibilityGuidelines = "IBM_Accessibility";
107
+ this.Config = config;
108
+ this.Config.DEBUG && console.log("START ACReporter Constructor");
109
+ var myThis = this;
110
+ if (typeof (after) !== "undefined") {
111
+ after(function (done) {
112
+ myThis.onRunComplete();
113
+ done && done();
114
+ });
115
+ }
116
+ else {
117
+ process.on('beforeExit', function () {
118
+ myThis.onRunComplete();
119
+ });
120
+ }
121
+ this.Config.DEBUG && console.log("END ACReporter Constructor");
122
+ }
123
+ ACReporterXLSX.prototype.preprocessReport = function (report, filter, scroll) {
124
+ var valueMap = {
125
+ "VIOLATION": {
126
+ "POTENTIAL": "Needs review",
127
+ "FAIL": "Violation",
128
+ "PASS": "Pass",
129
+ "MANUAL": "Needs review"
130
+ },
131
+ "RECOMMENDATION": {
132
+ "POTENTIAL": "Recommendation",
133
+ "FAIL": "Recommendation",
134
+ "PASS": "Pass",
135
+ "MANUAL": "Recommendation"
136
+ },
137
+ "INFORMATION": {
138
+ "POTENTIAL": "Needs review",
139
+ "FAIL": "Violation",
140
+ "PASS": "Pass",
141
+ "MANUAL": "Recommendation"
142
+ }
143
+ };
144
+ if (scroll === true) {
145
+ }
146
+ report.counts = {
147
+ "total": {},
148
+ "filtered": {}
149
+ };
150
+ report.counts.total["All"] = 0;
151
+ for (var _i = 0, _a = report.results; _i < _a.length; _i++) {
152
+ var item = _a[_i];
153
+ var filtVal = "";
154
+ item.selected = false;
155
+ item.selectedChild = false;
156
+ item.scrollTo = false;
157
+ if (!filter) {
158
+ filtVal = "X";
159
+ }
160
+ else {
161
+ var xpath = item.path.dom;
162
+ if (xpath === filter) {
163
+ filtVal = "=";
164
+ item.selected = true;
165
+ if (item.value[1] !== "PASS") {
166
+ item.scrollTo = false;
167
+ }
168
+ }
169
+ else if (xpath.startsWith(filter)) {
170
+ item.selectedChild = true;
171
+ filtVal = "^";
172
+ if (item.value[1] !== "PASS") {
173
+ item.scrollTo = false;
174
+ }
175
+ }
176
+ }
177
+ // let val = valueMap[item.value[0]][item.value[1]] || item.value[0] + "_" + item.value[1];
178
+ var val = valueMap[item.value[0]][item.value[1]] || item.value[0] + "_" + item.value[1];
179
+ // report.counts.total[val] = (report.counts.total[val] || 0) + 1;
180
+ report.counts.total[val] = (report.counts.total[val] || 0) + 1;
181
+ report.counts.total["All"] = report.counts.total["All"] + 1;
182
+ item.help = ACEngineManager_1.ACEngineManager.getHelpURL(item);
183
+ if (filtVal !== "") {
184
+ report.counts.filtered[val] = (report.counts.filtered[val] || 0) + 1;
185
+ }
186
+ }
187
+ return report;
188
+ };
189
+ // This emitter function is responsible for calling this function when the info event is detected
190
+ ACReporterXLSX.prototype.report = function (report1) {
191
+ return __awaiter(this, void 0, void 0, function () {
192
+ var report, myConfig, ruleArchiveSet, myRulesets, helpPath, helpPathLatest, xlsx_props, myScanData, scanData, violation, needsReview, recommendation, all, element_no_failures, element_no_violations, scanLabel, currentScan;
193
+ var _a;
194
+ var _this = this;
195
+ return __generator(this, function (_b) {
196
+ switch (_b.label) {
197
+ case 0:
198
+ this.Config.DEBUG && console.log("START 'info' emitter function");
199
+ // get values from user config
200
+ if (this.Config.hasOwnProperty('ruleArchive')) {
201
+ this.deploymentDate = this.Config.ruleArchive;
202
+ }
203
+ if (this.Config.hasOwnProperty('policies')) { // TODO should this always be 0?
204
+ this.accessibilityGuidelines = this.Config.policies[0];
205
+ }
206
+ report = this.preprocessReport(report1, null, false);
207
+ report.timestamp = new Date().getTime();
208
+ return [4 /*yield*/, ACConfigManager_1.ACConfigManager.getConfig()];
209
+ case 1:
210
+ myConfig = (_b.sent());
211
+ ruleArchiveSet = myConfig.ruleArchiveSet;
212
+ this.ruleArchiveSet = ruleArchiveSet;
213
+ return [4 /*yield*/, ACEngineManager_1.ACEngineManager.getRuleset(this.accessibilityGuidelines)];
214
+ case 2:
215
+ myRulesets = _b.sent();
216
+ report.ruleset = myRulesets;
217
+ helpPath = "";
218
+ helpPathLatest = "";
219
+ ruleArchiveSet.forEach(function (element) {
220
+ if (element.id === _this.deploymentDate) {
221
+ if (element.hasOwnProperty('helpPath')) { // The preview rules do no have a helpPath associated with them so we need to check
222
+ helpPath = element.helpPath;
223
+ }
224
+ }
225
+ if (element.id === "latest") { // This is to default to a known helpPath when we cant find them othere wise. Like in the case of preview rules.
226
+ if (element.hasOwnProperty('helpPath')) {
227
+ helpPathLatest = element.helpPath;
228
+ }
229
+ }
230
+ });
231
+ helpPath = (helpPath !== "") ? helpPath : helpPathLatest;
232
+ _a = {
233
+ report: report
234
+ };
235
+ return [4 /*yield*/, ACEngineManager_1.ACEngineManager.getRulesets()];
236
+ case 3:
237
+ xlsx_props = (_a.rulesets = _b.sent(),
238
+ _a.tabTitle = "",
239
+ _a.tabURL = report.summary.URL,
240
+ _a.helpPath = helpPath + "en-US/",
241
+ _a);
242
+ myScanData = new multiScanData_1.MultiScanData(this.Config);
243
+ scanData = myScanData.issues_sheet_rows(xlsx_props);
244
+ violation = (report === null || report === void 0 ? void 0 : report.counts.total["Violation"]) ? report === null || report === void 0 ? void 0 : report.counts.total["Violation"] : 0;
245
+ needsReview = (report === null || report === void 0 ? void 0 : report.counts.total["Needs review"]) ? report === null || report === void 0 ? void 0 : report.counts.total["Needs review"] : 0;
246
+ recommendation = (report === null || report === void 0 ? void 0 : report.counts.total["Recommendation"]) ? report === null || report === void 0 ? void 0 : report.counts.total["Recommendation"] : 0;
247
+ all = violation + needsReview + recommendation // not using report?.counts.total["All"] here on purpose. This calculation matches the excel sheet produced by the extension.
248
+ ;
249
+ if (all !== 0) {
250
+ element_no_failures = parseInt((((all - recommendation) / all) * 100).toFixed(0));
251
+ element_no_violations = parseInt((((all - violation) / all) * 100).toFixed(0));
252
+ }
253
+ else {
254
+ element_no_failures = 0;
255
+ element_no_violations = 0;
256
+ }
257
+ scanLabel = report.label;
258
+ currentScan = {
259
+ actualStoredScan: true,
260
+ isSelected: false,
261
+ url: report.summary.URL,
262
+ pageTitle: "",
263
+ dateTime: Date.now(),
264
+ scanLabel: scanLabel,
265
+ userScanLabel: scanLabel,
266
+ ruleSet: this.deploymentDate,
267
+ guidelines: this.accessibilityGuidelines,
268
+ reportDate: new Date().toJSON(),
269
+ violations: violation,
270
+ needsReviews: needsReview,
271
+ recommendations: recommendation,
272
+ elementsNoViolations: element_no_violations,
273
+ elementsNoFailures: element_no_failures,
274
+ storedScan: scanLabel,
275
+ screenShot: null,
276
+ storedScanData: scanData,
277
+ };
278
+ this.toolID = report.toolID;
279
+ this.storedScans = __spreadArray(__spreadArray([], this.storedScans, true), [currentScan], false);
280
+ // Save the results of a single scan to a JSON file based on the label provided
281
+ this.savePageResults(report);
282
+ // Update the overall summary object count object to include the new scan that was performed
283
+ this.addToSummaryCount(report.summary.counts);
284
+ // Save the summary of this scan into global space of this reporter, to be logged
285
+ // once the whole scan is done.
286
+ this.addResultsToGlobal(report);
287
+ this.Config.DEBUG && console.log("END 'info' emitter function");
288
+ return [2 /*return*/];
289
+ }
290
+ });
291
+ });
292
+ };
293
+ ;
294
+ /**
295
+ * This function is responsible for performing any action when the entire karma run is done.
296
+ * Overrides onRunComplete function from baseReporterDecorator
297
+ *
298
+ * @override
299
+ *
300
+ * @memberOf this
301
+ */
302
+ ACReporterXLSX.prototype.onRunComplete = function () {
303
+ this.Config.DEBUG && console.log("START 'ACReporterCSV::onRunComplete' function");
304
+ // Save summary object to a JSON file.
305
+ this.saveSummary();
306
+ this.Config.DEBUG && console.log("END 'ACReporterCSV::onRunComplete' function");
307
+ };
308
+ ;
309
+ /**
310
+ * This function is responsible for saving a single scans results to a file as JSON. On a side note
311
+ * this function will also extract the label which will be the file names where the results will be
312
+ * saved.
313
+ *
314
+ * @param {Object} this.Config - Karma this.Config object, used to extrat the outputFolder from the ACthis.Config.
315
+ * @param {Object} results - Provide the scan results for a single page that should be saved.
316
+ *
317
+ * @memberOf this
318
+ */
319
+ ACReporterXLSX.prototype.savePageResults = function (report) {
320
+ this.Config.DEBUG && console.log("START 'savePageResults' function");
321
+ for (var _i = 0, _a = report.results; _i < _a.length; _i++) {
322
+ var result = _a[_i];
323
+ this.resultStr += "".concat(toCSV(report.label), ",").concat(toCSV(result.level), ",").concat(toCSV(result.ruleId), ",").concat(toCSV(result.message), ",").concat(toCSV(result.path.dom), ",").concat(toCSV(ACEngineManager_1.ACEngineManager.getHelpURL(result)), "\n");
324
+ }
325
+ this.Config.DEBUG && console.log("END 'savePageResults' function");
326
+ };
327
+ /**
328
+ * This function is responsible for converting a javascript object into JSON and then writing that to a
329
+ * json file.
330
+ *
331
+ * @param {String} fileName - Full path of file where the JSON object should be stored
332
+ * @param {String} content - The javascript object which should be converted and saved to file as JSON.
333
+ *
334
+ * @memberOf this
335
+ */
336
+ ACReporterXLSX.prototype.writeObjectToFile = function (fileName, content) {
337
+ this.Config.DEBUG && console.log("START 'writeObjectToFileAsCSV' function");
338
+ fileName = pathLib.join(this.Config.outputFolder, fileName);
339
+ // Extract the parent directory of the file name that is provided
340
+ var parentDir = pathLib.dirname(fileName);
341
+ this.Config.DEBUG && console.log("Parent Directoy: \"" + parentDir + "\"");
342
+ // In the case that the parent directoy does not exist, create the directories
343
+ if (!fs.existsSync(parentDir)) {
344
+ // Create the parent directory recerseivly if it does not exist.
345
+ fs.mkdirSync(parentDir, { recursive: true });
346
+ }
347
+ this.Config.DEBUG && console.log("Object will be written to file: \"" + fileName + "\"");
348
+ // Convert the Object into JSON string and write that to the file
349
+ // Make sure to use utf-8 encoding to avoid an issues specify to OS.
350
+ // In terms of the JSON string that is constructed use 4 spaces to format the JSON object, before
351
+ // writing it to the file.
352
+ fs.writeFileSync(fileName, content, { encoding: 'utf-8' });
353
+ this.Config.DEBUG && console.log("END 'writeObjectToFileAsCSV' function");
354
+ };
355
+ /**
356
+ * This function is responsible for saving the summary object of the while scan to a summary file.
357
+ *
358
+ * @param {Object} summary - The summary object that needs to be written to the summary file.
359
+ *
360
+ * @memberOf this
361
+ */
362
+ ACReporterXLSX.prototype.saveSummary = function () {
363
+ this.Config.DEBUG && console.log("START 'saveSummary' function");
364
+ if (this.Config.outputFormat.indexOf("xlsx") === -1) {
365
+ return;
366
+ }
367
+ // this.writeObjectToFile("results.xlsx", this.resultStr);
368
+ var fileName = pathLib.join(this.Config.outputFolder, "results.xlsx");
369
+ multiScanReport_1.default.multiScanXlsxDownload(this.storedScans, "all", this.storedScans.length, this.ruleArchiveSet, this.toolID, fileName);
370
+ this.Config.DEBUG && console.log("END 'saveSummary' function");
371
+ };
372
+ /**
373
+ * This function is responsible for indexing the results into global spaces based on label.
374
+ *
375
+ * @param {Object} results - Results object which will be provided to the user/wroten to the file.
376
+ * Refer to aChecker.buildReport function's return to figure out what the object
377
+ * will look like.
378
+ *
379
+ * @return - N/A - Global object is updated with the results
380
+ *
381
+ * @memberOf this
382
+ */
383
+ ACReporterXLSX.prototype.addResultsToGlobal = function (results) {
384
+ this.Config.DEBUG && console.log("START 'addResultsToGlobal' function");
385
+ this.Config.DEBUG && console.log("END 'addResultsToGlobal' function");
386
+ };
387
+ /**
388
+ * This function is responsible for updating/creating the global violation summary for the engine karma run
389
+ * for browser that it is running on. Will take the pageCount object which is part of the page object and
390
+ * add extract the values for each of the levels and add them to the global object. This will provide an overall
391
+ * summary of violations for all testcases run and all scans done.
392
+ *
393
+ * @param {Object} pageCount - Provide the page count object, in the following format:
394
+ *
395
+ * @return N/A - Global summary object is updated with the counts
396
+ *
397
+ * @memberOf this
398
+ */
399
+ ACReporterXLSX.prototype.addToSummaryCount = function (pageCount) {
400
+ };
401
+ return ACReporterXLSX;
402
+ }());
403
+ exports.ACReporterXLSX = ACReporterXLSX;
404
+ ;
405
+ //# sourceMappingURL=ACReporterXLSX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ACReporterXLSX.js","sourceRoot":"","sources":["../../../src-ts/lib/reporters/ACReporterXLSX.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;8EAc8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9E,uCAAuC;AACvC,8BAAgC;AAChC,uBAAyB;AACzB,sDAAqD;AACrD,sDAAqD;AAGrD,iDAAgD;AAChD,qDAAgD;AAIhD,IAAI,KAAK,GAAG,UAAS,GAAG;IACpB,IAAI,GAAG,KAAK,IAAI,EAAE;QACd,OAAO,QAAQ,CAAC;KACnB;SAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC;KACf;SAAM;QACH,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,OAAO,YAAI,GAAG,OAAG,CAAC;KACrB;AACL,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH;IAQI,wBAAwB;IAExB,wBAAY,MAA0B,EAAE,WAAyB;QATjE,gBAAW,GAAO,EAAE,CAAA;QACpB,cAAS,GAAW,yCAAyC,CAAC;QAI9D,mBAAc,GAAW,QAAQ,CAAA;QACjC,4BAAuB,GAAW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,CAAC;IACnE,CAAC;IAED;;;;;;;;;;OAUG;IACH,2CAAkB,GAAlB,UAAmB,OAAO;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACxE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,0CAAiB,GAAjB,UAAkB,SAAS;IAE3B,CAAC;IACL,qBAAC;AAAD,CAAC,AApUD,IAoUC;AApUY,wCAAc;AAoU1B,CAAC"}
@@ -0,0 +1,27 @@
1
+ /******************************************************************************
2
+ Copyright:: 2020- IBM, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ *****************************************************************************/
16
+ import { IConfigUnsupported } from "../api/IChecker";
17
+ export declare class MultiScanData {
18
+ Config: IConfigUnsupported;
19
+ constructor(config: IConfigUnsupported);
20
+ issues_sheet_rows(xlsx_props: any): any;
21
+ static checkpoints_string(rule_checkpoints_map: any, rule_id: string): string;
22
+ static wcag_string(rule_checkpoints_map: any, rule_id: string): string;
23
+ static id_rule_map(xlsx_props: any): Map<any, any>;
24
+ static ruleId_checkpoints_map(xlsx_props: any): Map<any, any>;
25
+ static get_element(code: string): string;
26
+ static format_date(timestamp: string): string;
27
+ }
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ /******************************************************************************
3
+ Copyright:: 2020- IBM, Inc
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ *****************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.MultiScanData = void 0;
19
+ var stringHash = require("string-hash");
20
+ var MultiScanData = /** @class */ (function () {
21
+ function MultiScanData(config) {
22
+ this.Config = config;
23
+ }
24
+ // this class barrows heavily from singlePageReport
25
+ // however, our purpose here is just to generate the data
26
+ // needed for a multiScanReport which will replace singlePageReport
27
+ // also when saving scans we will be saving a reduced set of the
28
+ // scan data which is the smallest set of data needed for a
29
+ // multiScanReport
30
+ // more specifically we will only store the data for the issue
31
+ // sheet as all other data is either static or can be calculated
32
+ // from the issue data
33
+ MultiScanData.prototype.issues_sheet_rows = function (xlsx_props) {
34
+ var ret = [];
35
+ var report = xlsx_props.report;
36
+ var tab_url = xlsx_props.tabURL;
37
+ var tab_title = xlsx_props.tabTitle;
38
+ var engine_end_point = xlsx_props.helpPath;
39
+ // const engine_end_point = "process.env.engineEndpoint";
40
+ var rule_map = MultiScanData.id_rule_map(xlsx_props);
41
+ var rule_checkpoints_map = MultiScanData.ruleId_checkpoints_map(xlsx_props);
42
+ var valueMap = {
43
+ "VIOLATION": {
44
+ "POTENTIAL": "Needs review",
45
+ "FAIL": "Violation",
46
+ "PASS": "Pass",
47
+ "MANUAL": "Needs review"
48
+ },
49
+ "RECOMMENDATION": {
50
+ "POTENTIAL": "Recommendation",
51
+ "FAIL": "Recommendation",
52
+ "PASS": "Pass",
53
+ "MANUAL": "Recommendation"
54
+ },
55
+ "INFORMATION": {
56
+ "POTENTIAL": "Needs review",
57
+ "FAIL": "Violation",
58
+ "PASS": "Pass",
59
+ "MANUAL": "Recommendation"
60
+ }
61
+ };
62
+ if (report == null) {
63
+ return [];
64
+ }
65
+ for (var _i = 0, _a = report.results; _i < _a.length; _i++) {
66
+ var item = _a[_i];
67
+ if (item.value[1] === "PASS") {
68
+ continue;
69
+ }
70
+ var test = MultiScanData.checkpoints_string(rule_checkpoints_map, item.ruleId);
71
+ var test2 = MultiScanData.wcag_string(rule_checkpoints_map, item.ruleId);
72
+ MultiScanData.get_element(item.snippet);
73
+ MultiScanData.format_date(report.timestamp);
74
+ stringHash(item.ruleId + item.path.dom);
75
+ parseInt(rule_map.get(item.ruleId).toolkitLevel);
76
+ var row = [
77
+ tab_title,
78
+ tab_url,
79
+ MultiScanData.format_date(report.timestamp),
80
+ stringHash(item.ruleId + item.path.dom),
81
+ valueMap[item.value[0]][item.value[1]],
82
+ parseInt(rule_map.get(item.ruleId).toolkitLevel),
83
+ MultiScanData.checkpoints_string(rule_checkpoints_map, item.ruleId),
84
+ MultiScanData.wcag_string(rule_checkpoints_map, item.ruleId),
85
+ item.ruleId,
86
+ item.message.substring(0, 32767),
87
+ MultiScanData.get_element(item.snippet),
88
+ item.snippet,
89
+ item.path.aria,
90
+ // engine_end_point + '/tools/help/' + item.ruleId
91
+ engine_end_point + item.ruleId + ".html"
92
+ ];
93
+ ret.push(row);
94
+ }
95
+ return ret;
96
+ };
97
+ MultiScanData.checkpoints_string = function (rule_checkpoints_map, rule_id) {
98
+ var checkpoint_string = '';
99
+ var checkpoint_array = rule_checkpoints_map.get(rule_id);
100
+ for (var _i = 0, checkpoint_array_1 = checkpoint_array; _i < checkpoint_array_1.length; _i++) {
101
+ var checkpoint = checkpoint_array_1[_i];
102
+ if (checkpoint_string.length > 1) {
103
+ checkpoint_string = checkpoint_string + '; ';
104
+ }
105
+ checkpoint_string = checkpoint_string + checkpoint.num + ' ' + checkpoint.name;
106
+ }
107
+ return checkpoint_string;
108
+ };
109
+ MultiScanData.wcag_string = function (rule_checkpoints_map, rule_id) {
110
+ var wcag_string = '';
111
+ var checkpoint_array = rule_checkpoints_map.get(rule_id);
112
+ for (var _i = 0, checkpoint_array_2 = checkpoint_array; _i < checkpoint_array_2.length; _i++) {
113
+ var checkpoint = checkpoint_array_2[_i];
114
+ if (wcag_string.length > 0) {
115
+ wcag_string = wcag_string + '; ';
116
+ }
117
+ wcag_string = wcag_string + checkpoint.wcagLevel;
118
+ }
119
+ return wcag_string;
120
+ };
121
+ MultiScanData.id_rule_map = function (xlsx_props) {
122
+ var ruleset = xlsx_props.report.ruleset;
123
+ var checkpoints = ruleset.checkpoints;
124
+ var rule_map = new Map();
125
+ for (var _i = 0, checkpoints_1 = checkpoints; _i < checkpoints_1.length; _i++) {
126
+ var checkpoint = checkpoints_1[_i];
127
+ var rules = checkpoint.rules;
128
+ if (rules && rules.length > 0) {
129
+ for (var _a = 0, rules_1 = rules; _a < rules_1.length; _a++) {
130
+ var rule = rules_1[_a];
131
+ if (!rule_map.get(rule.id)) {
132
+ rule_map.set(rule.id, rule);
133
+ }
134
+ }
135
+ }
136
+ }
137
+ return rule_map;
138
+ };
139
+ MultiScanData.ruleId_checkpoints_map = function (xlsx_props) {
140
+ // const guideline_id = xlsx_props.report.option.guideline.id;
141
+ //ruleset used for scanning
142
+ // const ruleset = xlsx_props.rulesets.find((element: any) => element.id == guideline_id);
143
+ var ruleset = xlsx_props.report.ruleset;
144
+ var checkpoints = ruleset.checkpoints;
145
+ var checkpoint_map = new Map();
146
+ for (var _i = 0, checkpoints_2 = checkpoints; _i < checkpoints_2.length; _i++) {
147
+ var checkpoint = checkpoints_2[_i];
148
+ var temp_checkpoint = {
149
+ name: checkpoint.name,
150
+ num: checkpoint.num,
151
+ summary: checkpoint.summary,
152
+ wcagLevel: checkpoint.wcagLevel
153
+ };
154
+ var rules = checkpoint.rules;
155
+ if (rules && rules.length > 0) {
156
+ for (var _a = 0, rules_2 = rules; _a < rules_2.length; _a++) {
157
+ var rule = rules_2[_a];
158
+ if (!checkpoint_map.get(rule.id)) {
159
+ checkpoint_map.set(rule.id, [temp_checkpoint]);
160
+ }
161
+ else {
162
+ var checkpoint_array = checkpoint_map.get(rule.id);
163
+ checkpoint_array.push(temp_checkpoint);
164
+ checkpoint_map.set(rule.id, checkpoint_array);
165
+ }
166
+ }
167
+ }
168
+ }
169
+ return checkpoint_map;
170
+ };
171
+ MultiScanData.get_element = function (code) {
172
+ if (code) {
173
+ var ind_s = code.indexOf(' ');
174
+ var ind_br = code.indexOf('>');
175
+ return (ind_s > 0 && ind_s < ind_br) ? code.substring(1, ind_s) : code.substring(1, ind_br);
176
+ }
177
+ return '';
178
+ };
179
+ MultiScanData.format_date = function (timestamp) {
180
+ var date = new Date(timestamp);
181
+ return date.getFullYear() + '-' + ("00" + (date.getMonth() + 1)).slice(-2) + "-" +
182
+ ("00" + date.getDate()).slice(-2) + "-" +
183
+ ("00" + date.getHours()).slice(-2) + "-" +
184
+ ("00" + date.getMinutes()).slice(-2) + "-" +
185
+ ("00" + date.getSeconds()).slice(-2);
186
+ };
187
+ return MultiScanData;
188
+ }());
189
+ exports.MultiScanData = MultiScanData;
190
+ //# sourceMappingURL=multiScanData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiScanData.js","sourceRoot":"","sources":["../../../src-ts/lib/reporters/multiScanData.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;+EAc+E;;;AAG/E,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAItC;IAEI,uBAAY,MAA0B;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,mDAAmD;IACnD,yDAAyD;IACzD,mEAAmE;IACnE,iEAAiE;IACjE,4DAA4D;IAC5D,kBAAkB;IAElB,8DAA8D;IAC9D,gEAAgE;IAChE,sBAAsB;IAEf,yCAAiB,GAAxB,UAAyB,UAAe;QACpC,IAAI,GAAG,GAAQ,EAAE,CAAC;QAElB,IAAI,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC/B,IAAI,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC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