dependency-cruiser 11.1.0 → 11.2.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.
Files changed (41) hide show
  1. package/package.json +5 -5
  2. package/src/enrich/clear-caches.js +1 -1
  3. package/src/enrich/derive/circular/get-cycle.js +1 -1
  4. package/src/enrich/derive/dependents/get-dependents.js +1 -1
  5. package/src/enrich/derive/{metrics/get-stability-metrics.js → folders/aggregate-to-folders.js} +37 -28
  6. package/src/enrich/derive/folders/index.js +9 -0
  7. package/src/enrich/derive/folders/utl.js +44 -0
  8. package/src/enrich/derive/metrics/get-module-metrics.js +39 -0
  9. package/src/enrich/derive/metrics/index.js +14 -0
  10. package/src/enrich/derive/{utl.js → module-utl.js} +28 -0
  11. package/src/enrich/derive/orphan/is-orphan.js +1 -1
  12. package/src/enrich/derive/reachable/get-path.js +1 -1
  13. package/src/enrich/derive/reachable/index.js +1 -1
  14. package/src/enrich/enrich-modules.js +1 -1
  15. package/src/enrich/index.js +2 -2
  16. package/src/enrich/summarize/summarize-modules.js +24 -5
  17. package/src/meta.js +1 -1
  18. package/src/report/dot/module-utl.js +3 -3
  19. package/src/report/error-html/error-html.template.js +1 -1
  20. package/src/report/error-html/utl.js +50 -7
  21. package/src/report/error.js +55 -21
  22. package/src/report/teamcity.js +37 -11
  23. package/src/report/utl/index.js +16 -0
  24. package/src/schema/baseline-violations.schema.js +1 -35
  25. package/src/schema/configuration.schema.js +1 -496
  26. package/src/schema/cruise-result.schema.js +1 -646
  27. package/src/utl/regex-util.js +57 -0
  28. package/src/validate/match-dependency-rule.js +19 -33
  29. package/src/validate/match-module-rule.js +1 -1
  30. package/src/validate/matchers.js +50 -52
  31. package/src/validate/violates-required-rule.js +1 -1
  32. package/types/cruise-result.d.ts +2 -2
  33. package/types/shared-types.d.ts +7 -0
  34. package/types/violations.d.ts +19 -0
  35. package/CHANGELOG.md +0 -1
  36. package/src/enrich/derive/metrics/folder.js +0 -8
  37. package/src/enrich/derive/metrics/module-utl.js +0 -27
  38. package/src/enrich/derive/metrics/module.js +0 -28
  39. package/src/enrich/derive/metrics/utl.js +0 -23
  40. package/src/validate/utl.js +0 -31
  41. package/types/README.md +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "11.1.0",
3
+ "version": "11.2.0",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -160,9 +160,9 @@
160
160
  "@babel/core": "7.16.5",
161
161
  "@babel/plugin-transform-modules-commonjs": "7.16.5",
162
162
  "@babel/preset-typescript": "7.16.5",
163
- "@swc/core": "1.2.120",
164
- "@typescript-eslint/eslint-plugin": "5.7.0",
165
- "@typescript-eslint/parser": "5.7.0",
163
+ "@swc/core": "1.2.123",
164
+ "@typescript-eslint/eslint-plugin": "5.8.0",
165
+ "@typescript-eslint/parser": "5.8.0",
166
166
  "@vue/compiler-sfc": "3.2.26",
167
167
  "c8": "7.10.0",
168
168
  "chai": "4.3.4",
@@ -179,7 +179,7 @@
179
179
  "eslint-plugin-unicorn": "39.0.0",
180
180
  "husky": "^4.3.8",
181
181
  "intercept-stdout": "0.1.2",
182
- "lint-staged": "12.1.2",
182
+ "lint-staged": "12.1.4",
183
183
  "mocha": "9.1.3",
184
184
  "normalize-newline": "^3.0.0",
185
185
  "npm-run-all": "4.1.5",
@@ -1,4 +1,4 @@
1
- const utl = require("./derive/utl");
1
+ const utl = require("./derive/module-utl");
2
2
 
3
3
  module.exports = function clearCaches() {
4
4
  utl.clearCache();
@@ -1,4 +1,4 @@
1
- const { findModuleByName } = require("../utl");
1
+ const { findModuleByName } = require("../module-utl");
2
2
  /* about the absence of checks whether attributes/ objects actually
3
3
  * exist:
4
4
  * - it saves CPU cycles to the effect of being ~30% faster than with the
@@ -1,4 +1,4 @@
1
- const { isDependent } = require("../utl");
1
+ const { isDependent } = require("../module-utl");
2
2
 
3
3
  module.exports = function getDependents(pModule, pModules) {
4
4
  // perf between O(n) in an unconnected graph and O(n^2) in a fully connected one
@@ -1,11 +1,12 @@
1
1
  /* eslint-disable security/detect-object-injection */
2
2
  const path = require("path").posix;
3
- const { object2Array, getParentFolders } = require("./utl");
3
+ const { calculateInstability, metricsAreCalculable } = require("../module-utl");
4
4
  const {
5
5
  getAfferentCouplings,
6
6
  getEfferentCouplings,
7
- metricsAreCalculable,
8
- } = require("./module-utl");
7
+ getParentFolders,
8
+ object2Array,
9
+ } = require("./utl");
9
10
 
10
11
  function upsertCouplings(pAllDependents, pNewDependents) {
11
12
  pNewDependents.forEach((pNewDependent) => {
@@ -34,16 +35,14 @@ function upsertFolderAttributes(pAllMetrics, pModule, pDirname) {
34
35
  )
35
36
  );
36
37
  pAllMetrics[pDirname].moduleCount += 1;
37
-
38
38
  return pAllMetrics;
39
39
  }
40
40
 
41
- function orderFolderMetrics(pLeftMetric, pRightMetric) {
42
- // return pLeft.name.localeCompare(pRight.name);
43
- // For intended use in a table it's probably more useful to sort by
44
- // instability. Might need to be either configurable or flexible
45
- // in the output, though
46
- return pRightMetric.instability - pLeftMetric.instability;
41
+ function aggregateToFolder(pAllFolders, pModule) {
42
+ getParentFolders(path.dirname(pModule.source)).forEach((pParentDirectory) =>
43
+ upsertFolderAttributes(pAllFolders, pModule, pParentDirectory)
44
+ );
45
+ return pAllFolders;
47
46
  }
48
47
 
49
48
  function sumCounts(pAll, pCurrent) {
@@ -59,12 +58,15 @@ function getFolderLevelCouplings(pCouplingArray) {
59
58
  : path.dirname(pCoupling.name)
60
59
  )
61
60
  )
62
- );
61
+ ).map((pCoupling) => ({ name: pCoupling }));
63
62
  }
64
63
 
65
64
  function calculateFolderMetrics(pFolder) {
66
65
  const lModuleDependents = object2Array(pFolder.dependents);
67
66
  const lModuleDependencies = object2Array(pFolder.dependencies);
67
+ // this calculation might look superfluous (why not just .length the dependents
68
+ // and dependencies?), but it isn't because there can be > 1 relation between
69
+ // two folders
68
70
  const lAfferentCouplings = lModuleDependents.reduce(sumCounts, 0);
69
71
  const lEfferentCouplings = lModuleDependencies.reduce(sumCounts, 0);
70
72
 
@@ -72,26 +74,33 @@ function calculateFolderMetrics(pFolder) {
72
74
  ...pFolder,
73
75
  afferentCouplings: lAfferentCouplings,
74
76
  efferentCouplings: lEfferentCouplings,
75
- // when both afferentCouplings and efferentCouplings equal 0 instability will
76
- // yield NaN. Judging Bob Martin's intention, a component with no outgoing
77
- // dependencies is maximum stable (0)
78
- instability:
79
- lEfferentCouplings / (lEfferentCouplings + lAfferentCouplings) || 0,
77
+ instability: calculateInstability(lEfferentCouplings, lAfferentCouplings),
80
78
  dependents: getFolderLevelCouplings(lModuleDependents),
81
79
  dependencies: getFolderLevelCouplings(lModuleDependencies),
82
80
  };
83
81
  }
84
82
 
85
- module.exports = function getStabilityMetrics(pModules) {
86
- return object2Array(
87
- pModules.filter(metricsAreCalculable).reduce((pAllFolders, pModule) => {
88
- getParentFolders(path.dirname(pModule.source)).forEach(
89
- (pParentDirectory) =>
90
- upsertFolderAttributes(pAllFolders, pModule, pParentDirectory)
91
- );
92
- return pAllFolders;
93
- }, {})
94
- )
95
- .map(calculateFolderMetrics)
96
- .sort(orderFolderMetrics);
83
+ function findFolderByName(pAllFolders, pName) {
84
+ return pAllFolders.find((pFolder) => pFolder.name === pName);
85
+ }
86
+
87
+ function denormalizeInstability(pAllFolders) {
88
+ return (pFolder) => ({
89
+ ...pFolder,
90
+ dependencies: pFolder.dependencies.map((pDependency) => {
91
+ const lFolder = findFolderByName(pAllFolders, pDependency.name) || {};
92
+ return {
93
+ ...pDependency,
94
+ instability: lFolder.instability >= 0 ? lFolder.instability : 0,
95
+ };
96
+ }),
97
+ });
98
+ }
99
+
100
+ module.exports = function aggregateToFolders(pModules) {
101
+ const lFolders = object2Array(
102
+ pModules.filter(metricsAreCalculable).reduce(aggregateToFolder, {})
103
+ ).map(calculateFolderMetrics);
104
+
105
+ return lFolders.map(denormalizeInstability(lFolders));
97
106
  };
@@ -0,0 +1,9 @@
1
+ const aggregateToFolders = require("./aggregate-to-folders");
2
+
3
+ module.exports = function deriveFolderMetrics(pModules, pOptions) {
4
+ let lReturnValue = {};
5
+ if (pOptions.metrics) {
6
+ lReturnValue = { folders: aggregateToFolders(pModules) };
7
+ }
8
+ return lReturnValue;
9
+ };
@@ -0,0 +1,44 @@
1
+ /* eslint-disable security/detect-object-injection */
2
+ const path = require("path").posix;
3
+
4
+ function getAfferentCouplings(pModule, pDirname) {
5
+ return pModule.dependents.filter(
6
+ (pDependent) => !pDependent.startsWith(pDirname.concat(path.sep))
7
+ );
8
+ }
9
+
10
+ function getEfferentCouplings(pModule, pDirname) {
11
+ return pModule.dependencies.filter(
12
+ (pDependency) => !pDependency.resolved.startsWith(pDirname.concat(path.sep))
13
+ );
14
+ }
15
+
16
+ /**
17
+ *
18
+ * @param {string} pPath
19
+ * @returns string[]
20
+ */
21
+ function getParentFolders(pPath) {
22
+ let lFragments = pPath.split("/");
23
+ let lReturnValue = [];
24
+
25
+ while (lFragments.length > 0) {
26
+ lReturnValue.push(lFragments.join("/"));
27
+ lFragments.pop();
28
+ }
29
+ return lReturnValue.reverse();
30
+ }
31
+
32
+ function object2Array(pObject) {
33
+ return Object.keys(pObject).map((pKey) => ({
34
+ name: pKey,
35
+ ...pObject[pKey],
36
+ }));
37
+ }
38
+
39
+ module.exports = {
40
+ getAfferentCouplings,
41
+ getEfferentCouplings,
42
+ getParentFolders,
43
+ object2Array,
44
+ };
@@ -0,0 +1,39 @@
1
+ const { findModuleByName } = require("../module-utl");
2
+ const { calculateInstability, metricsAreCalculable } = require("../module-utl");
3
+
4
+ function addInstabilityMetric(pModule) {
5
+ return {
6
+ ...pModule,
7
+ ...(metricsAreCalculable(pModule)
8
+ ? {
9
+ instability: calculateInstability(
10
+ pModule.dependencies.length,
11
+ pModule.dependents.length
12
+ ),
13
+ }
14
+ : {}),
15
+ };
16
+ }
17
+
18
+ function addInstabilityToDependency(pAllModules) {
19
+ return (pDependency) => ({
20
+ ...pDependency,
21
+ instability:
22
+ (findModuleByName(pAllModules, pDependency.resolved) || {}).instability ||
23
+ 0,
24
+ });
25
+ }
26
+
27
+ function deNormalizeInstabilityMetricsToDependencies(pModule, _, pAllModules) {
28
+ return {
29
+ ...pModule,
30
+ dependencies: pModule.dependencies.map(
31
+ addInstabilityToDependency(pAllModules)
32
+ ),
33
+ };
34
+ }
35
+
36
+ module.exports = {
37
+ addInstabilityMetric,
38
+ deNormalizeInstabilityMetricsToDependencies,
39
+ };
@@ -0,0 +1,14 @@
1
+ const { clearCache } = require("../module-utl");
2
+ const {
3
+ addInstabilityMetric,
4
+ deNormalizeInstabilityMetricsToDependencies,
5
+ } = require("./get-module-metrics");
6
+
7
+ module.exports = function deriveModulesMetrics(pModules, pOptions) {
8
+ if (pOptions.metrics) {
9
+ const lModules = pModules.map(addInstabilityMetric);
10
+ clearCache();
11
+ return lModules.map(deNormalizeInstabilityMetricsToDependencies);
12
+ }
13
+ return pModules;
14
+ };
@@ -28,6 +28,32 @@ function isDependent(pResolvedName) {
28
28
  );
29
29
  }
30
30
 
31
+ function metricsAreCalculable(pModule) {
32
+ return (
33
+ !pModule.coreModule &&
34
+ !pModule.couldNotResolve &&
35
+ !pModule.matchesDoNotFollow
36
+ );
37
+ }
38
+
39
+ /**
40
+ * returns the Instability of a component given the number of incoming (afferent)
41
+ * and outgoign (efferent) connections ('couplings')
42
+ *
43
+ * @param {number} pEfferentCouplingCount
44
+ * @param {number} pAfferentCouplingCount
45
+ * @returns number
46
+ */
47
+ function calculateInstability(pEfferentCouplingCount, pAfferentCouplingCount) {
48
+ // when both afferentCouplings and efferentCouplings equal 0 instability will
49
+ // yield NaN. Judging Bob Martin's intention, a component with no outgoing
50
+ // dependencies is maximum stable (0)
51
+ return (
52
+ pEfferentCouplingCount /
53
+ (pEfferentCouplingCount + pAfferentCouplingCount) || 0
54
+ );
55
+ }
56
+
31
57
  function clearCache() {
32
58
  gIndexedGraph = null;
33
59
  }
@@ -36,4 +62,6 @@ module.exports = {
36
62
  findModuleByName,
37
63
  clearCache,
38
64
  isDependent,
65
+ metricsAreCalculable,
66
+ calculateInstability,
39
67
  };
@@ -1,4 +1,4 @@
1
- const { isDependent } = require("../utl");
1
+ const { isDependent } = require("../module-utl");
2
2
 
3
3
  module.exports = (pModule, pGraph) => {
4
4
  if (pModule.dependencies.length > 0) {
@@ -1,4 +1,4 @@
1
- const { findModuleByName } = require("../utl");
1
+ const { findModuleByName } = require("../module-utl");
2
2
 
3
3
  function getPath(pGraph, pFrom, pTo, pVisited = new Set()) {
4
4
  let lReturnValue = [];
@@ -4,7 +4,7 @@ const _clone = require("lodash/clone");
4
4
  const _get = require("lodash/get");
5
5
  const _has = require("lodash/has");
6
6
  const matchers = require("../../../validate/matchers");
7
- const { extractGroups } = require("../../../validate/utl");
7
+ const { extractGroups } = require("../../../utl/regex-util");
8
8
  const getPath = require("./get-path");
9
9
 
10
10
  function getReachableRules(pRuleSet) {
@@ -8,7 +8,7 @@ const addDependents = require("./derive/dependents");
8
8
  const deriveReachable = require("./derive/reachable");
9
9
  const addValidations = require("./add-validations");
10
10
  const softenKnownViolations = require("./soften-known-violations");
11
- const deriveModuleMetrics = require("./derive/metrics/module");
11
+ const deriveModuleMetrics = require("./derive/metrics");
12
12
 
13
13
  module.exports = function enrichModules(pModules, pOptions) {
14
14
  bus.emit("progress", "analyzing: cycles", { level: busLogLevels.INFO });
@@ -1,5 +1,5 @@
1
1
  const enrichModules = require("./enrich-modules");
2
- const deriveFolderMetrics = require("./derive/metrics/folder.js");
2
+ const aggregateToFolders = require("./derive/folders");
3
3
  const summarize = require("./summarize");
4
4
  const clearCaches = require("./clear-caches");
5
5
 
@@ -10,7 +10,7 @@ module.exports = function enrich(pModules, pOptions, pFileAndDirectoryArray) {
10
10
  clearCaches();
11
11
  return {
12
12
  modules: lModules,
13
- ...deriveFolderMetrics(lModules, pOptions),
13
+ ...aggregateToFolders(lModules, pOptions),
14
14
  summary: summarize(lModules, pOptions, pFileAndDirectoryArray),
15
15
  };
16
16
  };
@@ -1,14 +1,15 @@
1
1
  const _flattenDeep = require("lodash/flattenDeep");
2
2
  const _get = require("lodash/get");
3
+ const _has = require("lodash/has");
3
4
  const _uniqWith = require("lodash/uniqWith");
4
5
  const { findRuleByName } = require("../../graph-utl/rule-set");
5
6
  const compare = require("../../graph-utl/compare");
6
7
  const isSameViolation = require("./is-same-violation");
7
8
 
8
- function cutNonTransgressions(pSourceEntry) {
9
+ function cutNonTransgressions(pModule) {
9
10
  return {
10
- source: pSourceEntry.source,
11
- dependencies: pSourceEntry.dependencies.filter(
11
+ ...pModule,
12
+ dependencies: pModule.dependencies.filter(
12
13
  (pDependency) => pDependency.valid === false
13
14
  ),
14
15
  };
@@ -30,21 +31,38 @@ function extractMetaData(pViolations) {
30
31
  }
31
32
  function toDependencyViolationSummary(pRule, pModule, pDependency, pRuleSet) {
32
33
  let lReturnValue = {
34
+ type: "dependency",
33
35
  from: pModule.source,
34
36
  to: pDependency.resolved,
35
37
  rule: pRule,
36
38
  };
37
39
 
38
40
  if (
39
- pDependency.cycle &&
41
+ _has(pDependency, "cycle") &&
40
42
  _get(findRuleByName(pRuleSet, pRule.name), "to.circular")
41
43
  ) {
42
44
  lReturnValue = {
43
45
  ...lReturnValue,
46
+ type: "cycle",
44
47
  cycle: pDependency.cycle,
45
48
  };
46
49
  }
47
50
 
51
+ if (
52
+ _has(pModule, "instability") &&
53
+ _has(pDependency, "instability") &&
54
+ _has(findRuleByName(pRuleSet, pRule.name), "to.moreUnstable")
55
+ ) {
56
+ lReturnValue = {
57
+ ...lReturnValue,
58
+ type: "instability",
59
+ metrics: {
60
+ from: { instability: pModule.instability },
61
+ to: { instability: pDependency.instability },
62
+ },
63
+ };
64
+ }
65
+
48
66
  return lReturnValue;
49
67
  }
50
68
 
@@ -82,7 +100,7 @@ function extractDependencyViolations(pModules, pRuleSet) {
82
100
 
83
101
  function toModuleViolationSummary(pRule, pModule, pRuleSet) {
84
102
  let lReturnValue = [
85
- { from: pModule.source, to: pModule.source, rule: pRule },
103
+ { type: "module", from: pModule.source, to: pModule.source, rule: pRule },
86
104
  ];
87
105
  if (
88
106
  pModule.reaches &&
@@ -101,6 +119,7 @@ function toModuleViolationSummary(pRule, pModule, pRuleSet) {
101
119
  []
102
120
  )
103
121
  .map((pToModule) => ({
122
+ type: "reachability",
104
123
  from: pModule.source,
105
124
  to: pToModule.to,
106
125
  rule: pRule,
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "11.1.0",
4
+ version: "11.2.0",
5
5
  engines: {
6
6
  node: "^12.20||^14||>=16",
7
7
  },
@@ -1,5 +1,6 @@
1
1
  const path = require("path").posix;
2
2
  const _has = require("lodash/has");
3
+ const utl = require("../utl/index.js");
3
4
  const theming = require("./theming");
4
5
 
5
6
  const PROTOCOL_PREFIX_RE = /^[a-z]+:\/\//;
@@ -66,9 +67,8 @@ function makeInstabilityString(pModule, pShowMetrics = false) {
66
67
  let lInstabilityString = "";
67
68
 
68
69
  if (pShowMetrics && _has(pModule, "instability") && !pModule.consolidated) {
69
- lInstabilityString = ` <FONT color="#808080" point-size="8">${Math.round(
70
- // eslint-disable-next-line no-magic-numbers
71
- 100 * pModule.instability
70
+ lInstabilityString = ` <FONT color="#808080" point-size="8">${utl.formatInstability(
71
+ pModule.instability
72
72
  )}</FONT>`;
73
73
  }
74
74
  return lInstabilityString;
@@ -1 +1 @@
1
- var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["error-html.template.hbs"]=template({1:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' <div style="float:left;padding-right:20px" class="ignore">\n <strong>'+n.escapeExpression(n.lambda(null!=(n=null!=l?a(l,"summary"):l)?a(n,"ignore"):n,l))+"</strong> ignored\n </div>\n"},3:function(n,l,e,o,t){return"<th>ignored</th>"},5:function(n,l,e,o,t,a,r){var i,s,u=null!=l?l:n.nullContext||{},d=n.hooks.helperMissing,c="function",p=n.escapeExpression,h=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return" <tr "+(null!=(i=h(e,"if").call(u,null!=l?h(l,"unviolated"):l,{name:"if",hash:{},fn:n.program(6,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:218,column:16},end:{line:218,column:60}}}))?i:"")+">\n <td>"+(null!=(i=h(e,"if").call(u,null!=l?h(l,"unviolated"):l,{name:"if",hash:{},fn:n.program(8,t,0,a,r),inverse:n.program(10,t,0,a,r),data:t,loc:{start:{line:219,column:20},end:{line:220,column:66}}}))?i:"")+"</td>\n <td class="+(null!=(i=h(e,"if").call(u,null!=l?h(l,"unviolated"):l,{name:"if",hash:{},fn:n.program(12,t,0,a,r),inverse:n.program(14,t,0,a,r),data:t,loc:{start:{line:221,column:26},end:{line:221,column:81}}}))?i:"")+">"+p(typeof(s=null!=(s=h(e,"severity")||(null!=l?h(l,"severity"):l))?s:d)==c?s.call(u,{name:"severity",hash:{},data:t,loc:{start:{line:221,column:82},end:{line:221,column:94}}}):s)+'</td>\n <td class="nowrap"><a href="#'+p(typeof(s=null!=(s=h(e,"name")||(null!=l?h(l,"name"):l))?s:d)==c?s.call(u,{name:"name",hash:{},data:t,loc:{start:{line:222,column:45},end:{line:222,column:53}}}):s)+'-instance" id="'+p(typeof(s=null!=(s=h(e,"name")||(null!=l?h(l,"name"):l))?s:d)==c?s.call(u,{name:"name",hash:{},data:t,loc:{start:{line:222,column:68},end:{line:222,column:76}}}):s)+'-definition" class="noiseless">'+p(typeof(s=null!=(s=h(e,"name")||(null!=l?h(l,"name"):l))?s:d)==c?s.call(u,{name:"name",hash:{},data:t,loc:{start:{line:222,column:107},end:{line:222,column:115}}}):s)+"</a>\n </td>\n <td><strong>"+p(typeof(s=null!=(s=h(e,"count")||(null!=l?h(l,"count"):l))?s:d)==c?s.call(u,{name:"count",hash:{},data:t,loc:{start:{line:224,column:28},end:{line:224,column:37}}}):s)+"</strong></td>\n "+(null!=(i=h(e,"if").call(u,null!=(i=null!=r[1]?h(r[1],"summary"):r[1])?h(i,"ignore"):i,{name:"if",hash:{},fn:n.program(16,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:225,column:16},end:{line:225,column:90}}}))?i:"")+"\n <td>"+p(typeof(s=null!=(s=h(e,"comment")||(null!=l?h(l,"comment"):l))?s:d)==c?s.call(u,{name:"comment",hash:{},data:t,loc:{start:{line:226,column:20},end:{line:226,column:31}}}):s)+"</td>\n </tr>\n"},6:function(n,l,e,o,t){return'class="unviolated" '},8:function(n,l,e,o,t){return'<span class="ok">&check;</span>'},10:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'<span\n class="'+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"severity")||(null!=l?a(l,"severity"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"severity",hash:{},data:t,loc:{start:{line:220,column:31},end:{line:220,column:43}}}):a)+'">&cross;</span>'},12:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'"'+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"ok")||(null!=l?a(l,"ok"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"ok",hash:{},data:t,loc:{start:{line:221,column:45},end:{line:221,column:51}}}):a)+'"'},14:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'"'+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"severity")||(null!=l?a(l,"severity"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"severity",hash:{},data:t,loc:{start:{line:221,column:61},end:{line:221,column:73}}}):a)+'"'},16:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return"<td><strong>"+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"ignoredCount")||(null!=l?a(l,"ignoredCount"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"ignoredCount",hash:{},data:t,loc:{start:{line:225,column:53},end:{line:225,column:69}}}):a)+"</strong></td>"},18:function(n,l,e,o,t){return'"6"'},20:function(n,l,e,o,t){return'"5"'},22:function(n,l,e,o,t,a,r){var i,s=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' <span id="show-ignored-violations">\n <h2><svg class="p__svg--inline" viewBox="0 0 12 16" version="1.1" aria-hidden="true">\n <path fill-rule="evenodd"\n d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z">\n </path>\n </svg> All violations</h2>\n <table>\n <thead>\n <tr>\n <th>severity</th>\n <th>rule</th>\n <th>from</th>\n <th>to</th>\n </tr>\n </thead>\n <tbody>\n'+(null!=(i=n.hooks.blockHelperMissing.call(l,n.lambda(null!=(i=null!=l?s(l,"summary"):l)?s(i,"violations"):i,l),{name:"summary.violations",hash:{},fn:n.program(23,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:260,column:12},end:{line:269,column:35}}}))?i:"")+(null!=(i=s(e,"if").call(null!=l?l:n.nullContext||{},null!=(i=null!=l?s(l,"summary"):l)?s(i,"ignore"):i,{name:"if",hash:{},fn:n.program(25,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:270,column:12},end:{line:281,column:19}}}))?i:"")+" </tbody>\n </table>\n </span>\n"},23:function(n,l,e,o,t,a,r){var i=n.lambda,s=n.escapeExpression,u=null!=l?l:n.nullContext||{},d=n.hooks.helperMissing,c="function",p=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' <tr class="'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"severity"):n,l))+'d">\n <td class="'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"severity"):n,l))+'">'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"severity"):n,l))+'</td>\n <td class="nowrap"><a href="#'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"name"):n,l))+'-definition" id="'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"name"):n,l))+'-instance"\n class="noiseless">'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"name"):n,l))+'</a></td>\n <td><a href="'+s(i(null!=(n=null!=(n=null!=r[1]?p(r[1],"summary"):r[1])?p(n,"optionsUsed"):n)?p(n,"prefix"):n,l))+s(typeof(r=null!=(r=p(e,"from")||(null!=l?p(l,"from"):l))?r:d)==c?r.call(u,{name:"from",hash:{},data:t,loc:{start:{line:265,column:62},end:{line:265,column:70}}}):r)+'">'+s(typeof(r=null!=(r=p(e,"from")||(null!=l?p(l,"from"):l))?r:d)==c?r.call(u,{name:"from",hash:{},data:t,loc:{start:{line:265,column:72},end:{line:265,column:80}}}):r)+"</a></td>\n <td>"+(null!=(n=typeof(r=null!=(r=p(e,"to")||(null!=l?p(l,"to"):l))?r:d)==c?r.call(u,{name:"to",hash:{},data:t,loc:{start:{line:266,column:20},end:{line:266,column:28}}}):r)?n:"")+"</td>\n\n </tr>\n"},25:function(n,l,e,o,t){return' <tr>\n <td colspan="4" class="controls">\n <div id="show-ignored">\n &downarrow; <a href="#show-ignored-violations">also show ignored violations</a>\n </div>\n <div id="hide-ignored">\n &uparrow; <a href="">hide ignored violations</a>\n </div>\n </td>\n </tr>\n'},27:function(n,l,e,o,t){return' <h2><span aria-hidden="true">&hearts;</span> No violations found</h2>\n <p>Get gummy bears to celebrate.</p>\n'},compiler:[8,">= 4.3.0"],main:function(n,l,e,o,t,a,r){var i,s=n.lambda,u=n.escapeExpression,d=null!=l?l:n.nullContext||{},c=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <title>dependency-cruiser - results</title>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n\n <style type="text/css">\n body {\n font-family: sans-serif;\n margin: 0 auto;\n max-width: 90%;\n line-height: 1.6;\n font-size: 14px;\n color: #444;\n padding: 0 10px;\n background-color: #fff;\n }\n\n footer {\n color: gray;\n margin-top: 1.4em;\n border-top: solid 1px currentColor\n }\n\n a {\n text-decoration: none\n }\n\n a.noiseless {\n color: currentColor\n }\n\n h1,\n h2,\n h3 {\n line-height: 1.2\n }\n\n table {\n border-collapse: collapse;\n width: 100%;\n }\n\n th,\n td {\n text-align: left;\n padding: 4px;\n }\n\n tbody tr:nth-child(odd) {\n background-color: rgba(128, 128, 128, 0.2);\n }\n\n .error {\n color: red;\n }\n\n .warn {\n color: orange;\n }\n\n .info {\n color: blue;\n }\n\n .ignore {\n color:gray;\n }\n\n .ok {\n color: limegreen;\n }\n\n td.nowrap {\n white-space: nowrap\n }\n\n svg {\n fill: currentColor\n }\n\n #show-unviolated {\n display: block\n }\n\n #hide-unviolated {\n display: none\n }\n\n #show-all-the-rules:target #show-unviolated {\n display: none\n }\n\n #show-all-the-rules:target #hide-unviolated {\n display: block\n }\n\n tr.unviolated {\n display: none\n }\n\n #show-all-the-rules:target tr.unviolated {\n display: table-row;\n color: gray;\n }\n\n #show-ignored {\n display: block\n }\n\n #hide-ignored {\n display: none\n }\n\n #show-ignored-violations:target #show-ignored {\n display: none\n }\n\n #show-ignored-violations:target #hide-ignored {\n display: block\n }\n\n tr.ignored {\n display: none\n }\n\n #show-ignored-violations:target tr.ignored {\n display: table-row;\n color: gray;\n }\n\n .p__svg--inline {\n vertical-align: top;\n width: 1.2em;\n height: 1.2em\n }\n\n .controls {\n background-color: #fff;\n vertical-align: bottom;\n text-align: center\n }\n\n .controls:hover {\n opacity: 1;\n }\n\n .controls a {\n text-decoration: none;\n color: gray;\n }\n\n .controls a:hover {\n text-decoration: underline;\n color: blue;\n }\n\n .extra {\n color: gray;\n }\n </style>\n <style type="text/css" media="print">\n th,\n td {\n border: 1px solid #444;\n }\n\n .controls {\n display: none\n }\n </style>\n</head>\n\n<body>\n <h1>Forbidden dependency check - results</h1>\n <span id="show-all-the-rules">\n <h2><svg class="p__svg--inline" viewBox="0 0 14 16" version="1.1" aria-hidden="true">\n <path fill-rule="evenodd"\n d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8h-2.5z"></path>\n </svg> Summary</h2>\n <p>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"totalCruised"):i,l))+'</strong> modules\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"totalDependenciesCruised"):i,l))+'</strong> dependencies\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"error"):i,l))+'</strong> errors\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"warn"):i,l))+'</strong> warnings\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"info"):i,l))+"</strong> informational\n </div>\n"+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(1,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:199,column:8},end:{line:203,column:15}}}))?i:"")+" &nbsp;\n </p>\n <table>\n <tbody>\n <thead>\n <tr>\n <th></th>\n <th>severity</th>\n <th>rule</th>\n <th>violations</th>\n "+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(3,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:214,column:20},end:{line:214,column:65}}}))?i:"")+"\n <th>explanation</th>\n </thead>\n"+(null!=(i=n.hooks.blockHelperMissing.call(l,s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"agggregateViolations"):i,l),{name:"summary.agggregateViolations",hash:{},fn:n.program(5,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:217,column:12},end:{line:228,column:45}}}))?i:"")+" <tr>\n <td colspan="+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(18,t,0,a,r),inverse:n.program(20,t,0,a,r),data:t,loc:{start:{line:230,column:28},end:{line:230,column:68}}}))?i:"")+' class="controls">\n <div id="show-unviolated">\n &downarrow; <a href="#show-all-the-rules">also show unviolated rules</a>\n </div>\n <div id="hide-unviolated">\n &uparrow; <a href="">hide unviolated rules</a>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </span>\n\n'+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"violations"):i,{name:"if",hash:{},fn:n.program(22,t,0,a,r),inverse:n.program(27,t,0,a,r),data:t,loc:{start:{line:243,column:4},end:{line:288,column:11}}}))?i:"")+' <footer>\n <p><a href="https://github.com/sverweij/dependency-cruiser">'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"depcruiseVersion"):i,l))+"</a> /\n "+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"runDate"):i,l))+"</p>\n </footer>\n</body>\n\n</html>"},useData:!0,useDepths:!0});
1
+ var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["error-html.template.hbs"]=template({1:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' <div style="float:left;padding-right:20px" class="ignore">\n <strong>'+n.escapeExpression(n.lambda(null!=(n=null!=l?a(l,"summary"):l)?a(n,"ignore"):n,l))+"</strong> ignored\n </div>\n"},3:function(n,l,e,o,t){return"<th>ignored</th>"},5:function(n,l,e,o,t,a,r){var i,s,u=null!=l?l:n.nullContext||{},d=n.hooks.helperMissing,c="function",p=n.escapeExpression,h=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return" <tr "+(null!=(i=h(e,"if").call(u,null!=l?h(l,"unviolated"):l,{name:"if",hash:{},fn:n.program(6,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:218,column:16},end:{line:218,column:60}}}))?i:"")+">\n <td>"+(null!=(i=h(e,"if").call(u,null!=l?h(l,"unviolated"):l,{name:"if",hash:{},fn:n.program(8,t,0,a,r),inverse:n.program(10,t,0,a,r),data:t,loc:{start:{line:219,column:20},end:{line:220,column:66}}}))?i:"")+"</td>\n <td class="+(null!=(i=h(e,"if").call(u,null!=l?h(l,"unviolated"):l,{name:"if",hash:{},fn:n.program(12,t,0,a,r),inverse:n.program(14,t,0,a,r),data:t,loc:{start:{line:221,column:26},end:{line:221,column:81}}}))?i:"")+">"+p(typeof(s=null!=(s=h(e,"severity")||(null!=l?h(l,"severity"):l))?s:d)==c?s.call(u,{name:"severity",hash:{},data:t,loc:{start:{line:221,column:82},end:{line:221,column:94}}}):s)+'</td>\n <td class="nowrap"><a href="#'+p(typeof(s=null!=(s=h(e,"name")||(null!=l?h(l,"name"):l))?s:d)==c?s.call(u,{name:"name",hash:{},data:t,loc:{start:{line:222,column:45},end:{line:222,column:53}}}):s)+'-instance" id="'+p(typeof(s=null!=(s=h(e,"name")||(null!=l?h(l,"name"):l))?s:d)==c?s.call(u,{name:"name",hash:{},data:t,loc:{start:{line:222,column:68},end:{line:222,column:76}}}):s)+'-definition" class="noiseless">'+p(typeof(s=null!=(s=h(e,"name")||(null!=l?h(l,"name"):l))?s:d)==c?s.call(u,{name:"name",hash:{},data:t,loc:{start:{line:222,column:107},end:{line:222,column:115}}}):s)+"</a>\n </td>\n <td><strong>"+p(typeof(s=null!=(s=h(e,"count")||(null!=l?h(l,"count"):l))?s:d)==c?s.call(u,{name:"count",hash:{},data:t,loc:{start:{line:224,column:28},end:{line:224,column:37}}}):s)+"</strong></td>\n "+(null!=(i=h(e,"if").call(u,null!=(i=null!=r[1]?h(r[1],"summary"):r[1])?h(i,"ignore"):i,{name:"if",hash:{},fn:n.program(16,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:225,column:16},end:{line:225,column:90}}}))?i:"")+"\n <td>"+p(typeof(s=null!=(s=h(e,"comment")||(null!=l?h(l,"comment"):l))?s:d)==c?s.call(u,{name:"comment",hash:{},data:t,loc:{start:{line:226,column:20},end:{line:226,column:31}}}):s)+"</td>\n </tr>\n"},6:function(n,l,e,o,t){return'class="unviolated" '},8:function(n,l,e,o,t){return'<span class="ok">&check;</span>'},10:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'<span\n class="'+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"severity")||(null!=l?a(l,"severity"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"severity",hash:{},data:t,loc:{start:{line:220,column:31},end:{line:220,column:43}}}):a)+'">&cross;</span>'},12:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'"'+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"ok")||(null!=l?a(l,"ok"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"ok",hash:{},data:t,loc:{start:{line:221,column:45},end:{line:221,column:51}}}):a)+'"'},14:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'"'+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"severity")||(null!=l?a(l,"severity"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"severity",hash:{},data:t,loc:{start:{line:221,column:61},end:{line:221,column:73}}}):a)+'"'},16:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return"<td><strong>"+n.escapeExpression("function"==typeof(a=null!=(a=a(e,"ignoredCount")||(null!=l?a(l,"ignoredCount"):l))?a:n.hooks.helperMissing)?a.call(null!=l?l:n.nullContext||{},{name:"ignoredCount",hash:{},data:t,loc:{start:{line:225,column:53},end:{line:225,column:69}}}):a)+"</strong></td>"},18:function(n,l,e,o,t){return'"6"'},20:function(n,l,e,o,t){return'"5"'},22:function(n,l,e,o,t,a,r){var i,s=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' <span id="show-ignored-violations">\n <h2><svg class="p__svg--inline" viewBox="0 0 12 16" version="1.1" aria-hidden="true">\n <path fill-rule="evenodd"\n d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z">\n </path>\n </svg> All violations</h2>\n <table>\n <thead>\n <tr>\n <th>severity</th>\n <th>rule</th>\n <th>from</th>\n <th>to</th>\n </tr>\n </thead>\n <tbody>\n'+(null!=(i=n.hooks.blockHelperMissing.call(l,n.lambda(null!=(i=null!=l?s(l,"summary"):l)?s(i,"violations"):i,l),{name:"summary.violations",hash:{},fn:n.program(23,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:260,column:12},end:{line:269,column:35}}}))?i:"")+(null!=(i=s(e,"if").call(null!=l?l:n.nullContext||{},null!=(i=null!=l?s(l,"summary"):l)?s(i,"ignore"):i,{name:"if",hash:{},fn:n.program(25,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:270,column:12},end:{line:281,column:19}}}))?i:"")+" </tbody>\n </table>\n </span>\n"},23:function(n,l,e,o,t,a,r){var i=n.lambda,s=n.escapeExpression,u=null!=l?l:n.nullContext||{},d=n.hooks.helperMissing,c="function",p=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' <tr class="'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"severity"):n,l))+'d">\n <td class="'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"severity"):n,l))+'">'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"severity"):n,l))+'</td>\n <td class="nowrap"><a href="#'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"name"):n,l))+'-definition" id="'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"name"):n,l))+'-instance"\n class="noiseless">'+s(i(null!=(n=null!=l?p(l,"rule"):l)?p(n,"name"):n,l))+'</a></td>\n <td><a href="'+s(i(null!=(n=null!=(n=null!=r[1]?p(r[1],"summary"):r[1])?p(n,"optionsUsed"):n)?p(n,"prefix"):n,l))+s(typeof(r=null!=(r=p(e,"from")||(null!=l?p(l,"from"):l))?r:d)==c?r.call(u,{name:"from",hash:{},data:t,loc:{start:{line:265,column:62},end:{line:265,column:70}}}):r)+'">'+s(typeof(r=null!=(r=p(e,"from")||(null!=l?p(l,"from"):l))?r:d)==c?r.call(u,{name:"from",hash:{},data:t,loc:{start:{line:265,column:72},end:{line:265,column:80}}}):r)+"</a>"+(null!=(n=typeof(r=null!=(r=p(e,"fromExtras")||(null!=l?p(l,"fromExtras"):l))?r:d)==c?r.call(u,{name:"fromExtras",hash:{},data:t,loc:{start:{line:265,column:84},end:{line:265,column:100}}}):r)?n:"")+"</td>\n <td>"+(null!=(n=typeof(r=null!=(r=p(e,"to")||(null!=l?p(l,"to"):l))?r:d)==c?r.call(u,{name:"to",hash:{},data:t,loc:{start:{line:266,column:20},end:{line:266,column:28}}}):r)?n:"")+"</td>\n\n </tr>\n"},25:function(n,l,e,o,t){return' <tr>\n <td colspan="4" class="controls">\n <div id="show-ignored">\n &downarrow; <a href="#show-ignored-violations">also show ignored violations</a>\n </div>\n <div id="hide-ignored">\n &uparrow; <a href="">hide ignored violations</a>\n </div>\n </td>\n </tr>\n'},27:function(n,l,e,o,t){return' <h2><span aria-hidden="true">&hearts;</span> No violations found</h2>\n <p>Get gummy bears to celebrate.</p>\n'},compiler:[8,">= 4.3.0"],main:function(n,l,e,o,t,a,r){var i,s=n.lambda,u=n.escapeExpression,d=null!=l?l:n.nullContext||{},c=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <title>dependency-cruiser - results</title>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n\n <style type="text/css">\n body {\n font-family: sans-serif;\n margin: 0 auto;\n max-width: 90%;\n line-height: 1.6;\n font-size: 14px;\n color: #444;\n padding: 0 10px;\n background-color: #fff;\n }\n\n footer {\n color: gray;\n margin-top: 1.4em;\n border-top: solid 1px currentColor\n }\n\n a {\n text-decoration: none\n }\n\n a.noiseless {\n color: currentColor\n }\n\n h1,\n h2,\n h3 {\n line-height: 1.2\n }\n\n table {\n border-collapse: collapse;\n width: 100%;\n }\n\n th,\n td {\n text-align: left;\n padding: 4px;\n }\n\n tbody tr:nth-child(odd) {\n background-color: rgba(128, 128, 128, 0.2);\n }\n\n .error {\n color: red;\n }\n\n .warn {\n color: orange;\n }\n\n .info {\n color: blue;\n }\n\n .ignore {\n color:gray;\n }\n\n .ok {\n color: limegreen;\n }\n\n td.nowrap {\n white-space: nowrap\n }\n\n svg {\n fill: currentColor\n }\n\n #show-unviolated {\n display: block\n }\n\n #hide-unviolated {\n display: none\n }\n\n #show-all-the-rules:target #show-unviolated {\n display: none\n }\n\n #show-all-the-rules:target #hide-unviolated {\n display: block\n }\n\n tr.unviolated {\n display: none\n }\n\n #show-all-the-rules:target tr.unviolated {\n display: table-row;\n color: gray;\n }\n\n #show-ignored {\n display: block\n }\n\n #hide-ignored {\n display: none\n }\n\n #show-ignored-violations:target #show-ignored {\n display: none\n }\n\n #show-ignored-violations:target #hide-ignored {\n display: block\n }\n\n tr.ignored {\n display: none\n }\n\n #show-ignored-violations:target tr.ignored {\n display: table-row;\n color: gray;\n }\n\n .p__svg--inline {\n vertical-align: top;\n width: 1.2em;\n height: 1.2em\n }\n\n .controls {\n background-color: #fff;\n vertical-align: bottom;\n text-align: center\n }\n\n .controls:hover {\n opacity: 1;\n }\n\n .controls a {\n text-decoration: none;\n color: gray;\n }\n\n .controls a:hover {\n text-decoration: underline;\n color: blue;\n }\n\n .extra {\n color: gray;\n }\n </style>\n <style type="text/css" media="print">\n th,\n td {\n border: 1px solid #444;\n }\n\n .controls {\n display: none\n }\n </style>\n</head>\n\n<body>\n <h1>Forbidden dependency check - results</h1>\n <span id="show-all-the-rules">\n <h2><svg class="p__svg--inline" viewBox="0 0 14 16" version="1.1" aria-hidden="true">\n <path fill-rule="evenodd"\n d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8h-2.5z"></path>\n </svg> Summary</h2>\n <p>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"totalCruised"):i,l))+'</strong> modules\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"totalDependenciesCruised"):i,l))+'</strong> dependencies\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"error"):i,l))+'</strong> errors\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"warn"):i,l))+'</strong> warnings\n </div>\n <div style="float:left;padding-right:20px">\n <strong>'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"info"):i,l))+"</strong> informational\n </div>\n"+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(1,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:199,column:8},end:{line:203,column:15}}}))?i:"")+" &nbsp;\n </p>\n <table>\n <tbody>\n <thead>\n <tr>\n <th></th>\n <th>severity</th>\n <th>rule</th>\n <th>violations</th>\n "+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(3,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:214,column:20},end:{line:214,column:65}}}))?i:"")+"\n <th>explanation</th>\n </thead>\n"+(null!=(i=n.hooks.blockHelperMissing.call(l,s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"agggregateViolations"):i,l),{name:"summary.agggregateViolations",hash:{},fn:n.program(5,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:217,column:12},end:{line:228,column:45}}}))?i:"")+" <tr>\n <td colspan="+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(18,t,0,a,r),inverse:n.program(20,t,0,a,r),data:t,loc:{start:{line:230,column:28},end:{line:230,column:68}}}))?i:"")+' class="controls">\n <div id="show-unviolated">\n &downarrow; <a href="#show-all-the-rules">also show unviolated rules</a>\n </div>\n <div id="hide-unviolated">\n &uparrow; <a href="">hide unviolated rules</a>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </span>\n\n'+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"violations"):i,{name:"if",hash:{},fn:n.program(22,t,0,a,r),inverse:n.program(27,t,0,a,r),data:t,loc:{start:{line:243,column:4},end:{line:288,column:11}}}))?i:"")+' <footer>\n <p><a href="https://github.com/sverweij/dependency-cruiser">'+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"depcruiseVersion"):i,l))+"</a> /\n "+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"runDate"):i,l))+"</p>\n </footer>\n</body>\n\n</html>"},useData:!0,useDepths:!0});
@@ -1,6 +1,7 @@
1
1
  const _get = require("lodash/get");
2
2
  const _has = require("lodash/has");
3
3
  const { version } = require("../../../src/meta.js");
4
+ const { formatViolation, formatInstability } = require("../utl/index.js");
4
5
 
5
6
  function getFormattedAllowedRule(pRuleSetUsed) {
6
7
  const lAllowed = _get(pRuleSetUsed, "allowed", []);
@@ -29,14 +30,54 @@ function mergeCountsIntoRule(pRule, pViolationCounts) {
29
30
  };
30
31
  }
31
32
 
33
+ function formatCycleTo(pViolation) {
34
+ return pViolation.cycle.join(" &rightarrow;<br/>");
35
+ }
36
+
37
+ function formatReachabilityTo(pViolation) {
38
+ return `${pViolation.to}<br/>${pViolation.via.join(" &rightarrow;<br/>")}`;
39
+ }
40
+
41
+ function formatDependencyTo(pViolation) {
42
+ return pViolation.to;
43
+ }
44
+
45
+ function formatModuleTo() {
46
+ return "";
47
+ }
48
+
49
+ function formatInstabilityTo(pViolation) {
50
+ return `${pViolation.to}&nbsp;<span class="extra">(I: ${formatInstability(
51
+ pViolation.metrics.to.instability
52
+ )})</span>`;
53
+ }
54
+
32
55
  function determineTo(pViolation) {
33
- if (pViolation.cycle) {
34
- return pViolation.cycle.join(" &rightarrow;<br/>");
35
- }
36
- if (pViolation.via) {
37
- return `${pViolation.to}<br/>${pViolation.via.join(" &rightarrow;<br/>")}`;
38
- }
39
- return pViolation.from === pViolation.to ? "" : pViolation.to;
56
+ const lViolationType2Formatter = {
57
+ dependency: formatDependencyTo,
58
+ module: formatModuleTo,
59
+ cycle: formatCycleTo,
60
+ reachability: formatReachabilityTo,
61
+ instability: formatInstabilityTo,
62
+ };
63
+ return formatViolation(
64
+ pViolation,
65
+ lViolationType2Formatter,
66
+ formatDependencyTo
67
+ );
68
+ }
69
+
70
+ function formatInstabilityFromExtras(pViolation) {
71
+ return `&nbsp;<span class="extra">(I: ${formatInstability(
72
+ pViolation.metrics.from.instability
73
+ )})</span>`;
74
+ }
75
+
76
+ function determineFromExtras(pViolation) {
77
+ const lViolationType2Formatter = {
78
+ instability: formatInstabilityFromExtras,
79
+ };
80
+ return formatViolation(pViolation, lViolationType2Formatter, () => "");
40
81
  }
41
82
 
42
83
  function formatSummaryForReport(pSummary) {
@@ -46,6 +87,7 @@ function formatSummaryForReport(pSummary) {
46
87
  runDate: new Date().toISOString(),
47
88
  violations: (pSummary.violations || []).map((pViolation) => ({
48
89
  ...pViolation,
90
+ fromExtras: determineFromExtras(pViolation),
49
91
  to: determineTo(pViolation),
50
92
  })),
51
93
  };
@@ -55,5 +97,6 @@ module.exports = {
55
97
  getFormattedAllowedRule,
56
98
  mergeCountsIntoRule,
57
99
  formatSummaryForReport,
100
+ determineFromExtras,
58
101
  determineTo,
59
102
  };