-
Notifications
You must be signed in to change notification settings - Fork 49
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
Support wildcard references to modules in contracts #56
Comments
Thanks for the feature request. I think this is a good idea. I've renamed the issue accordingly. If you're eager to see a feature like this soon, you could implement it yourself by creating a custom contract and field type: https://import-linter.readthedocs.io/en/latest/custom_contract_types.html |
@seddonym this is an awesome project to contribute to, but sadly I dont' have enough time to work on it right now. I have a big release of |
hi 👋 @seddonym thanks for great tool! Possibility to define modules with wildcards is the feature I really need to start truly using I think I will try to prepare initial implementation in following weeks |
+100500 I use manual addition of rules to each contract, this is so annoying. |
Thanks @skarzi. You should be able to do this without any changes to core import-linter by implementing a custom contract and field type: https://import-linter.readthedocs.io/en/latest/custom_contract_types.html Of course I'd be happy to consider a PR to core import-linter, but it's worth knowing that you hopefully don't need anything from me in order to make this possible. Let me know how you get on! |
anyone above got this to work with a custom contract types? I can probably figure it out, but a code snippet would save some time if you fancy sharing :) |
This issue still open more than for 3 years. Is there any progress? How i can help you? |
Thanks for the nudge @Niccolum . Reading back this issue, I'm not sure exactly what the deliverable is. I'm going to try to define it more precisely... Perhaps what is required is for it to be possible to lint for independence between all child modules of a package, without specifying the modules directly. For example, I'd like to prevent imports between anything in In terms of excluding some of the child modules from that list, I'm not sure that would make much sense in an independence contract. If, for example, the contract excluded Another alternative would be for the more general purpose Interested to hear anyone's thoughts. To manage expectations, I'm not sure how likely it is that I'd work on any of these as a priority (I'm more focused on speeding up the linter at the moment) but might be able to support work on others' pull requests. It's important we define what we're trying to achieve first though. |
This linter is great, thanks for creating it as an open-source project! This would be a great feature to have. I'd like to apply I understand the maintainer has little time. What about tagging this feature as "help wanted"? |
Thank you! I haven't had any reply about the potential ways we could do this, so perhaps I could propose a more concrete option. The API could be as follows:
This would be the equivalent of listing all children of If anyone would like to work on this, let me know and I'd be happy to support it. |
For independence the wildcard format that is already used for (That would be sufficient for my use case) |
I have this directory structure: https://github.com/wemake-services/wemake-python-styleguide/tree/ae821ddb0b9c234870953ed5a17cd3858a52ee3c/wemake_python_styleguide/visitors
Every module in any module should be respect
type = independent
contract.But, I have like dozens of modules, and new ones are created like once a week.
What do I want? I want to enforce independent contract on all modules in a package and sub-packages. And mark several exceptions:
base
anddecorators
in my case. Something like this:Is it possible?
Original issue: wemake-services/wemake-python-styleguide#720
The text was updated successfully, but these errors were encountered: