Support wildcard references to modules in contracts
See original GitHub issueI 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
and decorators
in my case. Something like this:
[importlinter:contract:independence]
name = Independence contract (all shall be free!)
type = independence
modules =
wemake_python_styleguide.visitors.**.*
# Or at least something like this will do:
wemake_python_styleguide.visitors.ast.*
wemake_python_styleguide.visitors.tokenize.*
wemake_python_styleguide.visitors.filenames.*
ignore_imports =
# It is ok to be related on these modules:
wemake_python_styleguide.visitors.base
wemake_python_styleguide.visitors.decorators
Is it possible? Original issue: https://github.com/wemake-services/wemake-python-styleguide/issues/720
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
passing dictionary of wildcard constraints from config file
I am constructing a snakemake pipeline. I have a config.yaml file in which I want to store wildcard constraints ...
Read more >Python static code analysis: Wildcard imports should not be ...
Importing every public name from a module using a wildcard ( from mymodule import * ) is a bad idea because: It could...
Read more >Contract types — Import Linter 1.6.0 documentation
Wildcards (in the form of * ) are supported. These can stand in for a module names, but they do not extend to...
Read more >New-AzADApplication (Az.Resources) - Microsoft Learn
Syntax; Description; Examples; Parameters; Outputs; Notes; RELATED LINKS ... Specifies whether this application supports device authentication without a ...
Read more >Hibernate Search 6.1.7.Final: Reference Documentation
This allows the mapping of types that are not supported ... The usual compatibility policy does not apply: the contract of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!
@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
wemake-python-styleguide
in a month. 😞