Feature request: Custom Code for Import Validation
Allow custom code and functions to be used.
Context
I have a requirement where i have a concept of internal packages in my codebase.
An internal package(folder) can only be imported by code whose import path is within the directory tree rooted at the parent of the internal directory.
For example if we have internal folders: a/b/internal/c, a/b/internal/c/d
These folders can be imported from folders: a/b, a/b/c, a/b/c/d, a/b/h
They cannot be imported from these folders: a/i, a/i/k, x/z
Basically mirroring how internal folders work in Go.
As I understand this cannot be implemented with dependency cruiser currently, because the capture groups can only be defined in from and used in to but for this case we need the other way around.
Is there a way to add the ability to make it a custom function to be used, or that doesn't align with performance requirements of this project?
Expected Behavior
The mentioned rule can be implemented
Current Behavior
With current features it's not possible
Possible Solution
- More flexible ways to use capture groups
- Custom code to be used for import validation
Considered alternatives
Source: sverweij/dependency-cruiser