dependency-cruiser 10.6.0 → 10.7.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "10.6.0",
3
+ "version": "10.7.0",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -170,7 +170,7 @@
170
170
  "eslint": "^7.32.0",
171
171
  "eslint-config-moving-meadow": "2.0.9",
172
172
  "eslint-config-prettier": "8.3.0",
173
- "eslint-plugin-budapestian": "2.3.0",
173
+ "eslint-plugin-budapestian": "3.0.1",
174
174
  "eslint-plugin-import": "2.25.2",
175
175
  "eslint-plugin-mocha": "9.0.0",
176
176
  "eslint-plugin-node": "11.1.0",
@@ -199,11 +199,6 @@
199
199
  "policy": "wanted",
200
200
  "because": "some eslint plugins (eslint-plugin-budapestian) are not compatible with eslint 8 yet "
201
201
  },
202
- {
203
- "package": "eslint-plugin-budapestian",
204
- "policy": "pin",
205
- "because": "eslint-plugin-budapestian 3.0.0 is a bit too enthousiastic flagging things it shouldn't - keeping at 2.3.0 for the time being"
206
- },
207
202
  {
208
203
  "package": "figures",
209
204
  "policy": "wanted",
@@ -5,7 +5,7 @@ module.exports = function validateNodeEnvironment(pNodeVersion) {
5
5
  // not using default parameter here because the check should run
6
6
  // run on node 4 as well
7
7
  const lNodeVersion = pNodeVersion || process.versions.node;
8
- const VERSION_ERR = `\nERROR: Your node version (${lNodeVersion}) is not supported. dependency-cruiser
8
+ const lVersionError = `\nERROR: Your node version (${lNodeVersion}) is not supported. dependency-cruiser
9
9
  follows the node.js release cycle and runs on these node versions:
10
10
  ${engines.node}
11
11
  See https://nodejs.org/en/about/releases/ for details.
@@ -13,6 +13,6 @@ module.exports = function validateNodeEnvironment(pNodeVersion) {
13
13
  `;
14
14
 
15
15
  if (!satisfies(lNodeVersion, engines.node)) {
16
- throw new Error(VERSION_ERR);
16
+ throw new Error(lVersionError);
17
17
  }
18
18
  };
@@ -54,12 +54,12 @@ function normalizeFilterOptions(pOptions, pFilterOptionKeys) {
54
54
  function normalizeCollapse(pCollapse) {
55
55
  let lReturnValue = pCollapse;
56
56
  const lOneOrMoreNonSlashes = "[^/]+";
57
- const FOLDER_PATTERN = `${lOneOrMoreNonSlashes}/`;
58
- const FOLDER_BELOW_NODE_MODULES = `node_modules/${lOneOrMoreNonSlashes}`;
57
+ const lFolderPattern = `${lOneOrMoreNonSlashes}/`;
58
+ const lFolderBelowNodeModules = `node_modules/${lOneOrMoreNonSlashes}`;
59
59
  const lSingleDigitRe = /^\d$/;
60
60
 
61
61
  if (typeof pCollapse === "number" || pCollapse.match(lSingleDigitRe)) {
62
- lReturnValue = `${FOLDER_BELOW_NODE_MODULES}|^${FOLDER_PATTERN.repeat(
62
+ lReturnValue = `${lFolderBelowNodeModules}|^${lFolderPattern.repeat(
63
63
  Number.parseInt(pCollapse, 10)
64
64
  )}`;
65
65
  }
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "10.6.0",
4
+ version: "10.7.0",
5
5
  engines: {
6
6
  node: "^12.20||^14||>=16",
7
7
  },
@@ -45,10 +45,26 @@ function reportAllowedRule(pAllowedRule, pViolations) {
45
45
  return lReturnValue;
46
46
  }
47
47
 
48
- function reportViolatedRules(pRuleSetUsed, pViolations) {
48
+ function reportIgnoredRules(pIgnoredCount) {
49
+ let lReturnValue = [];
50
+
51
+ if (pIgnoredCount > 0) {
52
+ lReturnValue = tsm.inspectionType({
53
+ id: "ignored-known-violations",
54
+ name: "ignored-known-violations",
55
+ description:
56
+ "some dependency violations were ignored; run without --ignore-known to see them",
57
+ category: CATEGORY,
58
+ });
59
+ }
60
+ return lReturnValue;
61
+ }
62
+
63
+ function reportViolatedRules(pRuleSetUsed, pViolations, pIgnoredCount) {
49
64
  return reportRules(_get(pRuleSetUsed, "forbidden", []), pViolations)
50
65
  .concat(reportAllowedRule(_get(pRuleSetUsed, "allowed", []), pViolations))
51
- .concat(reportRules(_get(pRuleSetUsed, "required", []), pViolations));
66
+ .concat(reportRules(_get(pRuleSetUsed, "required", []), pViolations))
67
+ .concat(reportIgnoredRules(pIgnoredCount));
52
68
  }
53
69
 
54
70
  function determineTo(pViolation) {
@@ -66,15 +82,31 @@ function bakeViolationMessage(pViolation) {
66
82
  ? pViolation.from
67
83
  : `${pViolation.from} -> ${determineTo(pViolation)}`;
68
84
  }
69
- function reportViolations(pViolations) {
70
- return pViolations.map((pViolation) =>
71
- tsm.inspection({
72
- typeId: pViolation.rule.name,
73
- message: bakeViolationMessage(pViolation),
74
- file: pViolation.from,
75
- SEVERITY: severity2teamcitySeverity(pViolation.rule.severity),
76
- })
77
- );
85
+
86
+ function reportIgnoredViolation(pIgnoredCount) {
87
+ let lReturnValue = [];
88
+
89
+ if (pIgnoredCount > 0) {
90
+ lReturnValue = tsm.inspection({
91
+ typeId: "ignored-known-violations",
92
+ message: `${pIgnoredCount} known violations ignored. Run without --ignore-known to see them.`,
93
+ SEVERITY: "WARNING",
94
+ });
95
+ }
96
+ return lReturnValue;
97
+ }
98
+
99
+ function reportViolations(pViolations, pIgnoredCount) {
100
+ return pViolations
101
+ .map((pViolation) =>
102
+ tsm.inspection({
103
+ typeId: pViolation.rule.name,
104
+ message: bakeViolationMessage(pViolation),
105
+ file: pViolation.from,
106
+ SEVERITY: severity2teamcitySeverity(pViolation.rule.severity),
107
+ })
108
+ )
109
+ .concat(reportIgnoredViolation(pIgnoredCount));
78
110
  }
79
111
 
80
112
  /**
@@ -96,11 +128,14 @@ module.exports = (pResults) => {
96
128
  tsm.stdout = false;
97
129
 
98
130
  const lRuleSet = _get(pResults, "summary.ruleSetUsed", []);
99
- const lViolations = _get(pResults, "summary.violations", []);
131
+ const lViolations = _get(pResults, "summary.violations", []).filter(
132
+ (pViolation) => pViolation.rule.severity !== "ignore"
133
+ );
134
+ const lIgnoredCount = _get(pResults, "summary.ignore", 0);
100
135
 
101
136
  return {
102
- output: reportViolatedRules(lRuleSet, lViolations)
103
- .concat(reportViolations(lViolations))
137
+ output: reportViolatedRules(lRuleSet, lViolations, lIgnoredCount)
138
+ .concat(reportViolations(lViolations, lIgnoredCount))
104
139
  .reduce((pAll, pCurrent) => `${pAll}${pCurrent}\n`, ""),
105
140
  exitCode: pResults.summary.error,
106
141
  };
@@ -4,7 +4,7 @@ const wrapAnsi = require("wrap-ansi");
4
4
  const DEFAULT_INDENT = 4;
5
5
  module.exports = function wrapAndIndent(pString, pIndent = DEFAULT_INDENT) {
6
6
  const lDogmaticMaxConsoleWidth = 78;
7
- const MAX_WIDTH = lDogmaticMaxConsoleWidth - pIndent;
7
+ const lMaxWidth = lDogmaticMaxConsoleWidth - pIndent;
8
8
 
9
- return indentString(wrapAnsi(pString, MAX_WIDTH), pIndent);
9
+ return indentString(wrapAnsi(pString, lMaxWidth), pIndent);
10
10
  };