qossmic / deptrac

Keep your architecture clean.
https://qossmic.github.io/deptrac
MIT License
2.61k stars 135 forks source link

Collector for excluding the layer in which it is specified. #1278

Closed mafuuu-dev closed 6 months ago

mafuuu-dev commented 1 year ago

I apologize if there's already a topic like this; I've seen something similar before, but none of the options suited me because I'm using deptrac-shim.

Here's the issue: I need a collector that would allow a layer to exclude itself. For example, there are classes called 'Tasks,' and they allow implementing logic that cannot include other classes of the same type ('Tasks'). At the moment, it doesn't seem possible to describe such logic in YAML. I've seen that this can be done programmatically through ProcessEvent, but I can't do it because I'm using deptrac-shim, and it doesn't have Contracts. As far as I can judge, this is a quite common case among developers.

patrickkusebauch commented 6 months ago

This is now possible to do with the new distribution method. Update to this repo instead of shim and you get a scoped release where you can Contracts. As you mention, this might be somewhat common, therefore it would be nice to provide a blog post about how to go about it.

mafuuu-dev commented 6 months ago

Do I understand correctly that you are suggesting that I write a contract and describe it in a blog? This is great news! If I have time, I’ll definitely do this, I’m just not using deptrack at the moment precisely because of these limitations, but this will allow me to return to it! Thank you!

patrickkusebauch commented 6 months ago

Yes, use the new distribution method that scopes the release and effectively replaces the shim version. If you want to write a blog post about it, feel free to do so. If you don't, I put it on the backlog of blog post topics and might get to it myself at some point.