support alternate lines for noqa declaration of import order violations
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start by tracing the plugin's handling of I100 and E402 noqa declarations, using the current and requested examples in this issue as behavioral references. The work is done when noqa directives on the warning-configuration imports can suppress violations on later imports, while existing inline suppressions continue to work and obsolete ignores can be removed safely.
Written by the indexing model from the issue text.
Description
I have a few programs that utilize upstream packages that emit warnings on initial import (mostly pkg_resources deprecations right now). This causes issues with commandline scripts, because the warnings are sent to STDERR, suggesting a failure.
The only way to suppress these warnings entirely within Python code, is to immediately import warnings and configure warnings.ignore.
There are 2 common ways to do this:
1- the initial lines import a _warnings_disable.py file that imports and configure ignores/logging.
2- the initial lines import warnings and configure ignores/logging before importing the offending packages.
In the first example, I100 must be placed on the first import AFTER importing the out-of-place lines.
In the second example, E402 must be placed on each import after the out-of-place lines.
It would be beneficial if the ignore statements could instead be placed on the out-of-place lines, so they are inherently removed when the code is updated. Under the current implementation, stray ignores are likely to remain when the code is maintained and the warnings configuration is removed.
Current behavior:
from . import _configure_warnings # noqa: F401
import datetime # noqa: I100
Requested behavior:
from . import _configure_warnings # noqa: F401, I10X
import datetime
I noted I10X because a feature like this might be better implemented with a new code.
In both situations, the offending anti-pattern is properly documented. The new functionality simply allows the noqa to be declared on alternate line(s).
Thank you for your consideration.
- Dominant language
- Python
- Stars
- 279
- Forks
- 72
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PyCQA/flake8-import-order
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
PyCQA/flake8-import-order#204 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
PyCQA/flake8-import-order#171 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
PyCQA/flake8-import-order#166 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
PyCQA/flake8-import-order#163 · 11 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
PyCQA/flake8-import-order#136 · 3 comments ·
All issues in PyCQA/flake8-import-order
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
NatLabRockies/openstudio-mcp#286 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
intersystems/ipm#1338 ·
Maintainers usually reply within 1 day
-
separate_packages splits imports from the same explicitly configured packagePossibly taken @rahul05ranjan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
The v0-through-v1 path derives ShutdownDuration its own way, silently overriding a user's definitionOpenv1
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day