Skip to content
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

Ignore unused imports #79

Open
bdice opened this issue Jun 29, 2023 · 4 comments
Open

Ignore unused imports #79

bdice opened this issue Jun 29, 2023 · 4 comments

Comments

@bdice
Copy link

bdice commented Jun 29, 2023

In flake8, users can ignore F401 to avoid warning about unused imports. I tried cython-lint --ignore F401 but it seems to do nothing. From the source of cython-lint, it doesn't seem like there is a way to disable this check right now.

f'\'{_import[0]}\' imported but unused',

@bdice
Copy link
Author

bdice commented Jun 29, 2023

Ideally users would be able to ignore import and cimport statements separately -- in the cases I'm considering, I'd like to detect unused cimport statements but ignore unused import statements.

@MarcoGorelli
Copy link
Owner

good idea - interested in submitting a pr?

@bdice
Copy link
Author

bdice commented Jun 29, 2023

It seems like cython-lint might need a way to ignore violations raised by cython-lint itself (as opposed to pycodestyle) which seems like it could be a lot of scope. That would require naming a code for existing violations, unless you want to do something like add a flag for every violation (e.g. --ignore-unused-imports, --ignore-unused-cimports). What do you think is the best course of action?

@MarcoGorelli
Copy link
Owner

either sounds good!

just fyi for now I'd expect that # no-cython-lint would work, but a cli argument to turn off this globally sounds useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants