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

Is it possible to exclude same layer, different name? #1030

Closed
nmeri17 opened this issue Nov 17, 2022 · 6 comments
Closed

Is it possible to exclude same layer, different name? #1030

nmeri17 opened this issue Nov 17, 2022 · 6 comments

Comments

@nmeri17
Copy link

nmeri17 commented Nov 17, 2022

Sorry, if this has already been asked. Couldn't tell where to look. The examples show how to group by a Models layer and prevent that from leaking into Views or something. But what if I've got multiple Models, or Modules within a shared namespace, is it possible to distinguish between each module, preventing them reaching into each other? The way I think this can be achieved is by specifying each module by hand and manually excluding the other module layers, but I imagine there must be a more elegant way to go about it

@patrickkusebauch
Copy link
Collaborator

You don't need to exclude the other modules, Deptrac does this for you by default. However yes, you need to specify each of the modules separately.

@nmeri17
Copy link
Author

nmeri17 commented Nov 25, 2022

You don't need to exclude the other modules, Deptrac does this for you by default.

Ah, Ok. I will try a config like so and report to you if it doesn't work as intended

deptrac:
  paths:
    - ./ # AllModules resides here
  layers:
    -
      name: CartModule
      collectors:
        - type: glob
          value: AllModules/CartModule/**
    -
      name: ProductsModule
      collectors:
        - type: glob
          value: AllModules/ProductsModule/**

However yes, you need to specify each of the modules separately.

Is there a way to do this programmatically? I imagine this requires a new issue but here's the thing: Suphle (my framework) has a command for creating modules. So it'll be elegant if new module was automatically included in config above.

@patrickkusebauch
Copy link
Collaborator

patrickkusebauch commented Nov 25, 2022

There is no direct support for programmatic definitions in Deptrac right now. However, #1002 introduces PHP configuration instead of YAML and that should make it substantially easier for you to cook something up.

@nmeri17 nmeri17 closed this as completed Nov 25, 2022
@nmeri17
Copy link
Author

nmeri17 commented Dec 7, 2022

@patrickkusebauch I've just checked and can't see a php configuration. I was expecting to see a way to define the rules using php rather than yaml like your comment suggested. Or am I missing something?

@patrickkusebauch
Copy link
Collaborator

Yeah, my link was wrong. Updated it with the right link to the PR implementing it.

@patrickkusebauch
Copy link
Collaborator

Closed in #1002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants