Open rntz opened 1 year ago
Using import-linter
isn't tenable in the current form of the community repository, because it relies on the repository to be a Python package, i.e., we'd have to add __init__.py
files to each directory. There are options for namespace packages, but they'd require us to exhaustively list all files—or at least directories, I'm unsure, haven't gotten that to work—in the package, which is untenable and incredibly error prone.
@lunixbochs Would there be an problems with Talon if we were to add __init__.py
files to the community repository?
We could consider using bandit, but it does not seem to be able to work with allowlists: https://bandit.readthedocs.io/en/latest/blacklists/index.html
The import-linter
package also doesn't support allowlists, but it does support blocklists with wildcards and ignore statements, which is... less than ideal, but workable.
There's also flake8-tidy-imports, which is also partially implemented by ruff - I think the rule we'd want is there: https://beta.ruff.rs/docs/settings/#flake8-tidy-imports-banned-api
I think it'd also be worth running bandit.
@lunixbochs thinks that for security reasons we should lint for/ban certain Python imports. From slack:
cc @wenkokke