There's https://github.com/joaopalmeiro/flake8-import-conventions to serve as inspiration, though I'm not sure if I'd like to replicate the behavior 100%.
It has an error code for each convention:
name2asname: Dict[str, str] = {
"altair": "alt", # IC001
"numpy": "np", # IC002
"pandas": "pd", # IC003
"seaborn": "sns", # IC004
}
The biggest problem with this approach is that it's not possible to expand with custom conventions without forking the repo.
One alternative would be to use a single error code for all conventions, default to the ones above, and allow users to configure a custom mapping:
[tool.ruff.import_conventions.aliases]
pulumi_aws = "aws"
There's https://github.com/joaopalmeiro/flake8-import-conventions to serve as inspiration, though I'm not sure if I'd like to replicate the behavior 100%.
It has an error code for each convention:
The biggest problem with this approach is that it's not possible to expand with custom conventions without forking the repo.
One alternative would be to use a single error code for all conventions, default to the ones above, and allow users to configure a custom mapping: