seddonym / import-linter

Import Linter allows you to define and enforce rules for the internal and external imports within your Python project.
https://import-linter.readthedocs.io/
BSD 2-Clause "Simplified" License
664 stars 45 forks source link

Fix bug with sibling layers with containerless layers contracts #188

Closed flaeppe closed 1 year ago

flaeppe commented 1 year ago

I tried out the new sibling layers feature for layers contract, but ran in to a bug when trying out the config from documentation:

[importlinter:contract:my-layers-contract]
name = Contract with sibling layers
type = layers
layers=
    high
    medium_a | medium_b | medium_c
    low

Resulted in a: 'set' object has no attribute 'is_optional'

The provided changes should ensure both return types(Layer | set[Layer]) of LayerField.parse are handled

seddonym commented 1 year ago

Thanks so much!

seddonym commented 1 year ago

I've just released this bugfix in v1.11.1. Thanks again for spotting it.