dependency-cruiser 10.3.0 → 10.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "10.3.0",
3
+ "version": "10.3.1",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -139,10 +139,10 @@
139
139
  "ajv": "8.6.3",
140
140
  "chalk": "4.1.2",
141
141
  "commander": "8.2.0",
142
- "enhanced-resolve": "5.8.2",
142
+ "enhanced-resolve": "5.8.3",
143
143
  "figures": "^3.2.0",
144
144
  "get-stream": "^6.0.1",
145
- "glob": "7.1.7",
145
+ "glob": "7.2.0",
146
146
  "handlebars": "4.7.7",
147
147
  "indent-string": "^4.0.0",
148
148
  "inquirer": "8.1.5",
@@ -159,13 +159,13 @@
159
159
  "@babel/core": "7.15.5",
160
160
  "@babel/plugin-transform-modules-commonjs": "7.15.4",
161
161
  "@babel/preset-typescript": "7.15.0",
162
- "@swc/core": "1.2.88",
163
- "@typescript-eslint/eslint-plugin": "4.31.1",
164
- "@typescript-eslint/parser": "4.31.1",
162
+ "@swc/core": "1.2.91",
163
+ "@typescript-eslint/eslint-plugin": "4.31.2",
164
+ "@typescript-eslint/parser": "4.31.2",
165
165
  "c8": "7.9.0",
166
166
  "chai": "4.3.4",
167
167
  "chai-json-schema": "1.5.1",
168
- "coffeescript": "2.5.1",
168
+ "coffeescript": "2.6.0",
169
169
  "eslint": "7.32.0",
170
170
  "eslint-config-moving-meadow": "2.0.9",
171
171
  "eslint-config-prettier": "8.3.0",
@@ -178,12 +178,12 @@
178
178
  "husky": "^4.3.8",
179
179
  "intercept-stdout": "0.1.2",
180
180
  "lint-staged": "11.1.2",
181
- "mocha": "9.1.1",
181
+ "mocha": "9.1.2",
182
182
  "normalize-newline": "4.1.0",
183
183
  "npm-run-all": "4.1.5",
184
184
  "prettier": "2.4.1",
185
185
  "shx": "0.3.3",
186
- "svelte": "3.42.6",
186
+ "svelte": "3.43.0",
187
187
  "symlink-dir": "5.0.1",
188
188
  "typescript": "4.4.3",
189
189
  "upem": "^7.0.0",
@@ -1,5 +1,6 @@
1
1
  const bus = require("../utl/bus");
2
2
  const busLogLevels = require("../utl/bus-log-levels");
3
+ const isSameViolation = require("./summarize/is-same-violation");
3
4
 
4
5
  function softenModuleViolation(
5
6
  pRule,
@@ -26,11 +27,8 @@ function softenDependencyViolation(
26
27
  ) {
27
28
  return {
28
29
  ...pViolationKey.rule,
29
- severity: pKnownDependencyViolations.some(
30
- (pKnownError) =>
31
- pKnownError.from === pViolationKey.from &&
32
- pKnownError.to === pViolationKey.to &&
33
- pKnownError.rule.name === pViolationKey.rule.name
30
+ severity: pKnownDependencyViolations.some((pKnownError) =>
31
+ isSameViolation(pKnownError, pViolationKey)
34
32
  )
35
33
  ? pSoftenedSeverity
36
34
  : pViolationKey.rule.severity,
@@ -48,7 +46,12 @@ function softenDependencyViolations(
48
46
  ...pDependency,
49
47
  rules: pDependency.rules.map((pRule) =>
50
48
  softenDependencyViolation(
51
- { rule: pRule, from: pModuleSource, to: pDependency.resolved },
49
+ {
50
+ rule: pRule,
51
+ from: pModuleSource,
52
+ to: pDependency.resolved,
53
+ cycle: pDependency.cycle,
54
+ },
52
55
  pKnownDependencyViolations,
53
56
  pSoftenedSeverity
54
57
  )
@@ -0,0 +1,18 @@
1
+ module.exports = function isSameViolation(pLeftViolation, pRightViolation) {
2
+ let lReturnValue = false;
3
+
4
+ if (pLeftViolation.rule.name === pRightViolation.rule.name) {
5
+ if (pRightViolation.cycle && pLeftViolation.cycle) {
6
+ lReturnValue =
7
+ pLeftViolation.cycle.length === pRightViolation.cycle.length &&
8
+ pLeftViolation.cycle.every((pModule) =>
9
+ pRightViolation.cycle.includes(pModule)
10
+ );
11
+ } else {
12
+ lReturnValue =
13
+ pLeftViolation.from === pRightViolation.from &&
14
+ pLeftViolation.to === pRightViolation.to;
15
+ }
16
+ }
17
+ return lReturnValue;
18
+ };
@@ -1,8 +1,9 @@
1
1
  const _flattenDeep = require("lodash/flattenDeep");
2
2
  const _get = require("lodash/get");
3
+ const _uniqWith = require("lodash/uniqWith");
3
4
  const { findRuleByName } = require("../../graph-utl/rule-set");
4
5
  const compare = require("../../graph-utl/compare");
5
- const deDuplicateViolations = require("./de-duplicate-violations");
6
+ const isSameViolation = require("./is-same-violation");
6
7
 
7
8
  function cutNonTransgressions(pSourceEntry) {
8
9
  return {
@@ -23,6 +24,7 @@ function extractMetaData(pViolations) {
23
24
  error: 0,
24
25
  warn: 0,
25
26
  info: 0,
27
+ ignore: 0,
26
28
  }
27
29
  );
28
30
  }
@@ -128,10 +130,11 @@ function extractModuleViolations(pModules, pRuleSet) {
128
130
  }
129
131
 
130
132
  module.exports = function summarizeModules(pModules, pRuleSet) {
131
- const lViolations = deDuplicateViolations(
133
+ const lViolations = _uniqWith(
132
134
  extractDependencyViolations(pModules, pRuleSet)
133
135
  .concat(extractModuleViolations(pModules, pRuleSet))
134
- .sort(compare.violations)
136
+ .sort(compare.violations),
137
+ isSameViolation
135
138
  );
136
139
 
137
140
  return {
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "10.3.0",
4
+ version: "10.3.1",
5
5
  engines: {
6
6
  node: "^12.20||^14||>=16",
7
7
  },
@@ -172,6 +172,7 @@ module.exports = {
172
172
  error: { type: "number" },
173
173
  warn: { type: "number" },
174
174
  info: { type: "number" },
175
+ ignore: { type: "number" },
175
176
  totalCruised: { type: "number" },
176
177
  totalDependenciesCruised: { type: "number" },
177
178
  ruleSetUsed: { $ref: "#/definitions/RuleSetType" },
@@ -271,6 +271,10 @@ export interface ISummary {
271
271
  * the number of errors in the dependencies
272
272
  */
273
273
  error: number;
274
+ /**
275
+ * the number of ignored notices in the dependencies
276
+ */
277
+ ignore: number;
274
278
  /**
275
279
  * the number of informational level notices in the dependencies
276
280
  */
@@ -1,18 +0,0 @@
1
- const _difference = require("lodash/difference");
2
- const _uniqWith = require("lodash/uniqWith");
3
-
4
- function violationIsEqual(pLeftViolation, pRightViolation) {
5
- if (
6
- pLeftViolation.rule.name === pRightViolation.rule.name &&
7
- pLeftViolation.cycle
8
- ) {
9
- return (
10
- _difference(pLeftViolation.cycle, pRightViolation.cycle).length === 0
11
- );
12
- }
13
- return false;
14
- }
15
-
16
- module.exports = function deDuplicateViolations(pViolations) {
17
- return _uniqWith(pViolations, violationIsEqual);
18
- };