dependency-cruiser 10.3.0-beta-8 → 10.3.1-beta-3
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 +17 -17
- package/src/enrich/soften-known-violations.js +9 -6
- package/src/enrich/summarize/is-same-violation.js +18 -0
- package/src/enrich/summarize/summarize-modules.js +6 -3
- package/src/meta.js +1 -1
- package/src/schema/cruise-result.schema.js +1 -0
- package/types/cruise-result.d.ts +4 -0
- package/src/enrich/summarize/de-duplicate-violations.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependency-cruiser",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.1-beta-3",
|
|
4
4
|
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"static analysis",
|
|
@@ -131,21 +131,21 @@
|
|
|
131
131
|
"version": "npm-run-all build depcruise:graph:doc scm:stage"
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
|
-
"acorn": "8.
|
|
134
|
+
"acorn": "8.5.0",
|
|
135
135
|
"acorn-jsx": "5.3.2",
|
|
136
136
|
"acorn-jsx-walk": "2.0.0",
|
|
137
|
-
"acorn-loose": "8.1
|
|
138
|
-
"acorn-walk": "8.
|
|
139
|
-
"ajv": "8.6.
|
|
137
|
+
"acorn-loose": "8.2.1",
|
|
138
|
+
"acorn-walk": "8.2.0",
|
|
139
|
+
"ajv": "8.6.3",
|
|
140
140
|
"chalk": "4.1.2",
|
|
141
|
-
"commander": "8.
|
|
141
|
+
"commander": "8.2.0",
|
|
142
142
|
"enhanced-resolve": "5.8.2",
|
|
143
143
|
"figures": "^3.2.0",
|
|
144
144
|
"get-stream": "^6.0.1",
|
|
145
145
|
"glob": "7.1.7",
|
|
146
146
|
"handlebars": "4.7.7",
|
|
147
147
|
"indent-string": "^4.0.0",
|
|
148
|
-
"inquirer": "8.1.
|
|
148
|
+
"inquirer": "8.1.5",
|
|
149
149
|
"json5": "2.2.0",
|
|
150
150
|
"lodash": "4.17.21",
|
|
151
151
|
"safe-regex": "2.1.1",
|
|
@@ -156,13 +156,13 @@
|
|
|
156
156
|
"wrap-ansi": "^7.0.0"
|
|
157
157
|
},
|
|
158
158
|
"devDependencies": {
|
|
159
|
-
"@babel/core": "7.15.
|
|
160
|
-
"@babel/plugin-transform-modules-commonjs": "7.15.
|
|
159
|
+
"@babel/core": "7.15.5",
|
|
160
|
+
"@babel/plugin-transform-modules-commonjs": "7.15.4",
|
|
161
161
|
"@babel/preset-typescript": "7.15.0",
|
|
162
|
-
"@swc/core": "1.2.
|
|
163
|
-
"@typescript-eslint/eslint-plugin": "4.
|
|
164
|
-
"@typescript-eslint/parser": "4.
|
|
165
|
-
"c8": "7.
|
|
162
|
+
"@swc/core": "1.2.88",
|
|
163
|
+
"@typescript-eslint/eslint-plugin": "4.31.1",
|
|
164
|
+
"@typescript-eslint/parser": "4.31.1",
|
|
165
|
+
"c8": "7.9.0",
|
|
166
166
|
"chai": "4.3.4",
|
|
167
167
|
"chai-json-schema": "1.5.1",
|
|
168
168
|
"coffeescript": "2.5.1",
|
|
@@ -174,18 +174,18 @@
|
|
|
174
174
|
"eslint-plugin-mocha": "9.0.0",
|
|
175
175
|
"eslint-plugin-node": "11.1.0",
|
|
176
176
|
"eslint-plugin-security": "1.4.0",
|
|
177
|
-
"eslint-plugin-unicorn": "
|
|
177
|
+
"eslint-plugin-unicorn": "36.0.0",
|
|
178
178
|
"husky": "^4.3.8",
|
|
179
179
|
"intercept-stdout": "0.1.2",
|
|
180
180
|
"lint-staged": "11.1.2",
|
|
181
181
|
"mocha": "9.1.1",
|
|
182
182
|
"normalize-newline": "4.1.0",
|
|
183
183
|
"npm-run-all": "4.1.5",
|
|
184
|
-
"prettier": "2.
|
|
184
|
+
"prettier": "2.4.1",
|
|
185
185
|
"shx": "0.3.3",
|
|
186
|
-
"svelte": "3.42.
|
|
186
|
+
"svelte": "3.42.6",
|
|
187
187
|
"symlink-dir": "5.0.1",
|
|
188
|
-
"typescript": "4.4.
|
|
188
|
+
"typescript": "4.4.3",
|
|
189
189
|
"upem": "^7.0.0",
|
|
190
190
|
"vue-template-compiler": "2.6.14",
|
|
191
191
|
"yarn": "1.22.11"
|
|
@@ -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
|
-
{
|
|
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
|
|
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 =
|
|
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
|
@@ -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" },
|
package/types/cruise-result.d.ts
CHANGED
|
@@ -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
|
-
};
|