Open LewisGaul opened 10 months ago
Thanks for the bug report - I'll look into it.
Incidentally this should just have better error handling, as using the root package as a layer isn't valid.
The same happens also the other way (ie. when more detailed package is declared first):
[importlinter]
root_packages =
root
[importlinter:contract:layers]
name = Layers
type = layers
layers =
root.subpkg
root
Is it a bug or just unsupported? Ie.
root.subpkg
import from root
root
to import from root.subpkg
One example use case would be like (though this may already be a different use case, I'm not sure):
[importlinter:contract:layers]
name = Layers
type = layers
layers =
root.public_api | root.private_api
root
root.util
root.*
stuff (except each other)root.util
should not be able to import from other packagesIs it a bug or just unsupported?
Unsupported...or, maybe, meaningless. Each layer is (potentially) a subpackage, so a layer shouldn't contain another layer in the same contract.
My expectation with layers has been that they're siblings, though rereading the documentation it doesn't spell that out, and possibly it doesn't need to. I guess as long as layers don't contain each other, they could still be linted in that way.
Possibly this issue is more related to what you want to do.
Using the root package name in the "layers" contract causes a Rust panic.
Small reproduction at https://github.com/LewisGaul/minegauler/commit/7ee4e627997cc879d883f9a51cfabc2f1287ef3d.
I'm on WSL1 (Ubuntu 20.04 on Windows 11), although I don't expect this to be relevant.