Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output configuration - Hidden layers #567

Merged
merged 12 commits into from
Jun 14, 2021
Merged

Output configuration - Hidden layers #567

merged 12 commits into from
Jun 14, 2021

Conversation

patrickkusebauch
Copy link
Collaborator

@patrickkusebauch patrickkusebauch commented Jun 6, 2021

Hello,
I would open an issue for this, but it was so easy to add that I made a PR instead.

What it is about?

The ability to add something that I call "hidden layers". These are layers that I want to use for validation/testing, but I do not want to see in various outputs.

What is it good for?

For "generic layers" like the vendor folder or the most basic "set up code" or included libraries. Pretty much I find it useful if I have code I want to allow pretty much everywhere, but having it in graphical output would be cluttering. I can see it can have other uses as well (like discussions for different "outputs" based on the way you slice the architecture). In those cases, all layers could be defined in one place and you can only have different config files that would hide different parts of the full graph.

What is missing?

First - tests. I have tested it by compiling and using it on my project and it is working. I will add tests if this feature is something this repo is interested in, but if not, tests would be just a waste of time.

I have also only prepared the graphviz output formatter for now, just to gauge interest. If you think it is a good idea, I will try to add the rest to the best of my ability.

What is next?/How it could be improved?

I am interested in creating other changes for output (like right now I am working on subgraphs/groups/clusters) that were discussed for this repo several times. I think it might be beneficial to create an all-composing output section in the config instead, for all possible configs related to output formatting. It would also make it easier to pass it around internally.

@patrickkusebauch
Copy link
Collaborator Author

So for illustration purposes the change when I hide "Generic domain" from my output + the deptrac.yml configuration for what I mean by "Generic domain"

layers:
  - name: Generic Domains
    collectors:
      # Vendor
      - type: bool
        must:
          - type: className
            regex: .+\\.*
        must_not:
          - type: className
            regex: ^Company\\Saas\\.*
      # common
      - type: bool
        must:
          - type: directory
            regex: src/.*
        must_not:
          - type: directory
            regex: src/.*/.*
      # Libs
      - type: className
        regex: ^Company\\Saas\\Plugins\\.*
hidden_layers:
  - Generic Domains

deptrac
deptrac

Copy link
Collaborator

@dbrumann dbrumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. There's one thing that bugs me a bit, if I am not mistaken marking a layer as hidden will "hide" any violations from or to this layer in the analysis, right? If so, should we change the behavior to only hide these layers when there are no violations and conversely only show violations from/to these layers, when there are any?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@patrickkusebauch
Copy link
Collaborator Author

I like it. There's one thing that bugs me a bit, if I am not mistaken marking a layer as hidden will "hide" any violations from or to this layer in the analysis, right? If so, should we change the behavior to only hide these layers when there are no violations and conversely only show violations from/to these layers, when there are any?

You are correct about the current behavior. As for changing it? I would be against it. If we change it, there would be no way whatsoever to hide layers that have a from/to violation. In my mind, this is to serve to hide part of the graph, since you do not care about it, regardless of whether there are violations or not.

Of course, what you are asking could be done in the future if somebody expresses the need, a simple config parameter would do the trick.

Makefile Show resolved Hide resolved
@dbrumann dbrumann merged commit 869cd2e into qossmic:main Jun 14, 2021
@patrickkusebauch patrickkusebauch deleted the hiddenLayers branch June 14, 2021 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants