Repository: sverweij/dependency-cruiser
Pull request #869 (2023-11-18 13:24:51)

feat(reporter/dot): only considers rule severity for coloring invalid modules/ dependencies
## Description, Motivation and Context

- _only_ color modules & dependencies in one of the severity level colors when there's a severity set on the associated rule

The default `dot` configuration built into dependency-cruiser made that things that were invalid, but for which the rule was _ignored_ showed up with a red color. This is obviously not helpful (why otherwise ignore the rule).

## How Has This Been Tested?

- [x] green ci
- [x] adjusted automated non-regression tests

## Types of changes

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Documentation only change
- [ ] Refactor (non-breaking change which fixes an issue without changing functionality)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist

- [x] :book:

  - My change doesn't require a documentation update, or ...
  - it _does_ and I have updated it

- [x] :balance_scale:
  - The contribution will be subject to [The MIT license](https://github.com/sverweij/dependency-cruiser/blob/main/LICENSE), and I'm OK with that.
  - The contribution is my own original work.
  - I am ok with the stuff in [**CONTRIBUTING.md**](https://github.com/sverweij/dependency-cruiser/blob/main/.github/CONTRIBUTING.md).


codeclimate[bot]: Code Climate has analyzed commit 3760e96b and detected **0 issues** on this pull request.

View more on [Code Climate](https://codeclimate.com/github/sverweij/dependency-cruiser/pull/869).

codeclimate[bot]: Code Climate has analyzed commit 4772d37b and detected **0 issues** on this pull request.

View more on [Code Climate](https://codeclimate.com/github/sverweij/dependency-cruiser/pull/869).


Patch:
diff --git a/src/report/dot/default-theme.mjs b/src/report/dot/default-theme.mjs
index 02d9bad9..951a7cb3 100644
--- a/src/report/dot/default-theme.mjs
+++ b/src/report/dot/default-theme.mjs
@@ -46,14 +46,6 @@ export default {
       criteria: { "rules[0].severity": "info" },
       attributes: { fontcolor: "blue", color: "blue" },
     },
-    {
-      criteria: { valid: false },
-      attributes: { fontcolor: "red", color: "red" },
-    },
-    {
-      criteria: { couldNotResolve: true },
-      attributes: { color: "red", fontcolor: "red" },
-    },
     {
       criteria: { coreModule: true },
       attributes: { color: "grey", fontcolor: "grey" },
@@ -131,10 +123,6 @@ export default {
       criteria: { dynamic: true },
       attributes: { style: "dashed" },
     },
-    {
-      criteria: { valid: false },
-      attributes: { fontcolor: "red", color: "red" },
-    },
     {
       criteria: { circular: true },
       attributes: { arrowhead: "normalnoneodot" },


Test patch:
diff --git a/test/report/dot/theming.spec.mjs b/test/report/dot/theming.spec.mjs
index 6343346c..ea46a0af 100644
--- a/test/report/dot/theming.spec.mjs
+++ b/test/report/dot/theming.spec.mjs
@@ -25,7 +25,7 @@ describe("[U] report/dot/theming - determineModuleColors - default theme", () =>
         { couldNotResolve: true },
         theming.normalizeTheme({}).modules,
       ),
-      { color: "red", fontcolor: "red" },
+      {},
     );
   });