module-graph icon indicating copy to clipboard operation
module-graph copied to clipboard

Missing relationships & failure to ignore a module

Open krishofmans opened this issue 1 year ago • 2 comments

🐛 Describe the bug

Hello,

first of all, thank you for this plugin, seems very usable in the early state it's in. This is definitly something that has been missing in the ecosystem for a while.

I've tried it out in a project that we're using as an example for clean architecture, thus it has a lot of modules.

But between the outgoing infra modules (sqldb, events-out) it seems to be missing the relations to the domain module (as they implement domain interfaces).

Also, I am able to ignore the vocabulary module (to which a lot of dependencies point at to make use of typed id classes etc), but I am unable to ignore the main partition module that points towards every module to bring it together to make it runnable.

⚠️ Current behavior

  • missing following relationships between modules:
  :code:infrastructure:outgoing:sqldb --> :code:application:domain
  :code:infrastructure:outgoing:events-out --> :code:application:domain
  • has these relationships that I would not expect because of ignoring the main module, and the subgraph
  subgraph :code
    :code:main["main"]
  end

  :code:main --> :code:application:usecases-api
  :code:main --> :code:application:usecases
  :code:main --> :code:application:policy-api
  :code:main --> :code:application:policy
  :code:main --> :code:infrastructure:incoming:commandbus
  :code:main --> :code:infrastructure:incoming:events-in
  :code:main --> :code:infrastructure:incoming:rest
  :code:main --> :code:infrastructure:incoming:validation
  :code:main --> :code:infrastructure:outgoing:events-out
  :code:main --> :code:infrastructure:outgoing:sqldb

✅ Expected behavior

This is the output that I would have expected from the plugin with the current config:

%%{
  init: {
    'theme': 'neutral'
  }
}%%

graph LR
  subgraph :code:application
    :code:application:usecases["usecases"]
    :code:application:usecases-api["usecases-api"]
    :code:application:domain-events["domain-events"]
    :code:application:policy-api["policy-api"]
    :code:application:policy["policy"]
    :code:application:domain["domain"]
  end
  subgraph :code:infrastructure:incoming
    :code:infrastructure:incoming:commandbus["commandbus"]
    :code:infrastructure:incoming:events-in["events-in"]
    :code:infrastructure:incoming:rest["rest"]
    :code:infrastructure:incoming:validation["validation"]
  end
  subgraph :code:infrastructure:outgoing
    :code:infrastructure:outgoing:events-out["events-out"]
    :code:infrastructure:outgoing:sqldb["sqldb"]
  end
  :code:application:usecases --> :code:application:usecases-api
  :code:application:usecases --> :code:application:domain-events
  :code:infrastructure:incoming:commandbus --> :code:application:usecases-api
  :code:infrastructure:incoming:events-in --> :code:application:domain-events
  :code:infrastructure:incoming:events-in --> :code:application:policy-api
  :code:application:policy --> :code:application:policy-api
  :code:application:policy --> :code:application:usecases-api
  :code:application:policy --> :code:application:domain-events
  :code:application:domain --> :code:application:domain-events
  :code:application:policy-api --> :code:application:domain-events
  :code:infrastructure:incoming:rest --> :code:application:usecases-api
  :code:infrastructure:incoming:validation --> :code:application:usecases-api
  :code:infrastructure:outgoing:sqldb --> :code:application:domain
  :code:infrastructure:outgoing:events-out --> :code:application:domain

💣 Steps to reproduce

Project can be found here: https://gitlab.rotate-it.be/tripled/triple-todo/-/tree/main

Generated the graph using: ./gradlew createModuleGraph

📷 Screenshots

expected: image

vs current: image

krishofmans avatar Jun 05 '24 20:06 krishofmans

Hey, thanks for the detailed issue! I'm on vacation now, but I'll check this out when I'm back next week. Cheers

iurysza avatar Jun 08 '24 12:06 iurysza

Have you had a chance to look at this? I will try to have a look myself otherwise to help out.

krishofmans avatar Jul 26 '24 21:07 krishofmans

Hey, @krishofmans! Is this still an issue? couldn't repro on my end 🤔

iurysza avatar Nov 09 '24 18:11 iurysza

I believe this is a documentation issue and I encountered the same problem.

If rootModulesRegex is not set then all modules will be selected as root modules. Once they are picked up as root modules it appears that they cannot be ignored via excludedModulesRegex.

The solution is to ensure you always set rootModulesRegex if you want to ignore certain other modules.

npars avatar Jan 21 '25 17:01 npars

Hey, thanks for pointing that out! I'll try to update docs.

iurysza avatar Jan 28 '25 21:01 iurysza