Allow ignoring specific errors in files
At the moment it's only possible to ignore
- either a complete file (
# flake8: noqa
on a single line), - a single line (
# noqa
at the end of a line), - or specific errors in all files being checked (
ignore = F403,E501
in a[flake8]
section ofsetup.cfg
ortox.ini
)
See also the Configuration chapter in the docs.
Enhancement Proposal
1.) Allow ignoring only specific errors in a single file:
# flake8: ignore=F403,E501
While I think this only would be a valuable, almost necessary addition to flake8 already the very same concept could be taken further in addition.
Apply the Same Idea to Lines
2.) Allow ignoring only specific errors on a single line:
# noqa: ignore=F403,E501
Taking the Proposal Further
3.) Allow configuration within certain scopes of code:
Following this syntax it could be used to apply certain (flake8) rules to a code block (e.g. a function). For example, this would allow complexity 12 within the scope of the function my_func
:
def my_func():
# noqa: max-complexity=12
for i in range(99):
for j in range(99):
for k in range(99):
for m in range(99):
pass