When I run flake8 on a file that only has one line: def O(): pass
I got the following error, despite the function runs just fine:
/tmp/a.py:1:5: E743 ambiguous function definition 'O'
Why flake8 is failing? And why I don't just get warnings?
From the documentation:
Do not define functions named 'l', 'o', or 'i' (E743)
Functions namedI
,O
, andl
can be very hard to read. This is because the letterI
and the letterl
are easily confused, and the letterO
and the number0
can be easily confused.Change the names of these functions to something more descriptive.
Additional links
- https://www.python.org/dev/peps/pep-0008/#names-to-avoid
flake8 is a utility for enforcing pep8 style consistency across Python projects, and according to pep8 function naming conventions: Function names should be lowercase, with words separated by underscores as necessary to improve readability.
If you want flake8 to ignore this specific error (which is against linting purpose) either add this to your setup.cfg
file:
[flake8]
ignore = E743
or run it using the following option: flake8 --ignore=E743
But if you want just that flake8 does not fail and just show warning you have to run it with --exit-zero
:
flake8 --exit-zero
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With