On , I learnt ...
File-level flake8 comments ignore all errors
Until today, I was under the impression that including:
# flake8: noqa: F401
at the top of a Python module would ignore all F401 errors in the file.
However that isn’t true: the above directive ignores all errors in the file,
not just F401: the : F401
part of the comment is silently ignored.
Alternatively you can:
- append
# noqa: F401
to each offending line, or: - use the
--per-file-ignores
configuration option to ignore certain error codes in files matching a set of globs.
Related: