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

Rework type handling from deptrac.analyser.types #1173

Open
dbrumann opened this issue May 5, 2023 · 0 comments
Open

Rework type handling from deptrac.analyser.types #1173

dbrumann opened this issue May 5, 2023 · 0 comments

Comments

@dbrumann
Copy link
Collaborator

dbrumann commented May 5, 2023

The current configruation, where we manually need to specify types is error prone. For example, I copied over an example from our docs where the class collector was missing and that caused the classLike collector to not emit anything. Sending me off to a wild goose chase.

I can think of two options for making this more convenient, with a clear preference for the first one, but feel free to propose alternatives.

Options

Replace current allow list with an ignore list

We change the default configuration to always use all types and replace the configuration with an ignore list, e.g.:

deptrac:
  analyser:
    ignored_types: ['class']

That way, people are less likely to run into errors, and we explicitly can still disable types we don't need.

Automatically determine required types

We could go through the deptrac.layers configuration and look which collectors are used. Based on the collectors we could then enable the required types.

A downside would be, that this would be a headache for extendability when using custom collectors. In those cases we could either enable all types or add something to the interface. The latter is probably safer, in case someone replaces a default collector with a custom implementation. Obviously, looking at the layers and then checking the used collectors will have some overhead. The good thing is, we could probably do this with the current DI-configuration, e.g. in a CompilerPass, at least as far as I can tell.

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