@eui/tools 6.12.5 → 6.12.6

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.
@@ -1 +1 @@
1
- 6.12.5
1
+ 6.12.6
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 6.12.6 (2023-06-19)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **audit:**
6
+ * mark known allowed material entries as excluded from audit - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([e9e4d8e4](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/e9e4d8e449e0c414030c0c0eff709535f8e7f369))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 6.12.5 (2023-06-19)
2
11
 
3
12
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.12.5",
3
+ "version": "6.12.6",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -13,7 +13,7 @@ const metadataUtils = require('../metadata/metadata-utils');
13
13
 
14
14
  const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
15
15
 
16
- const generateIndicesContent = (indices, file, fileContent) => {
16
+ const generateIndicesContent = (indices, file, fileContent, exclusions = []) => {
17
17
  let content = [];
18
18
 
19
19
  indices.forEach((i) => {
@@ -28,16 +28,37 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
28
28
 
29
29
  const lineNumber = fileContent.substring(0, i).split('\n').length;
30
30
 
31
- content.push({
32
- file: file,
33
- lineNumber: lineNumber,
34
- content: indiceContent,
31
+ let excluded = false;
32
+ exclusions.forEach((exclusion) => {
33
+ if (indiceContent.indexOf(exclusion) > -1) {
34
+ excluded = true;
35
+ }
35
36
  })
37
+
38
+ if (!excluded) {
39
+ content.push({
40
+ file: file,
41
+ lineNumber: lineNumber,
42
+ content: indiceContent,
43
+ })
44
+ }
36
45
  })
37
46
 
38
47
  return content;
39
48
  }
40
49
 
50
+ const recalculateIndicesCount = (indicesContent) => {
51
+ let count = 0;
52
+
53
+ indicesContent.forEach((ic) => {
54
+ ic.forEach((icd) => {
55
+ count++;
56
+ });
57
+ });
58
+
59
+ return count;
60
+ }
61
+
41
62
  const getStatus = (count) => {
42
63
  return (count > 5) ? 'CRITICAL' : (count > 0 && count <= 5) ? 'IMPROVE' : 'OK';
43
64
  }
@@ -285,8 +306,16 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
285
306
  while ( (result = regex.exec(fileContent)) ) {
286
307
  materialIndices.push(result.index);
287
308
  }
288
- report.material.count += materialIndices.length;
289
- report.material.indices = [...report.material.indices, ...generateIndicesContent(materialIndices, file, fileContent)];
309
+ const indicesContent = generateIndicesContent(
310
+ materialIndices, file, fileContent,
311
+ [
312
+ '@angular/material/core',
313
+ '@angular/material-moment-adapter'
314
+ ]
315
+ );
316
+
317
+ report.material.count += recalculateIndicesCount(indicesContent);
318
+ report.material.indices = [...report.material.indices, indicesContent];
290
319
 
291
320
  let allModulesIndices = [];
292
321
  regex = /EuiAllModule/gi;