Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flake8 to ignore warning F405 on multiple lines

Tags:

python

flake8

I am having a fabric script and i am using below statement

from fabric.api import *

Now i know this isn't as per PEP8 standards but this is really needed specially for a library like fabric and we can really import everything from it. Because of this flake8 is complaining on multiple lines with F405 code.

I have disabled this for one line using #noqa but since there multiple lines with same PEP8 violation how can i ask flake8 to ignore this particular error code.

I have also tried # noqa: F405 at the beginning of the file but that didn't work.

like image 832
Rohit Avatar asked Dec 28 '25 19:12

Rohit


2 Answers

Starting from version 3.7.0, flake8 supports per file ignores out of the box. You can check the documentation on the command line flag / config file option here

like image 161
Ocab19 Avatar answered Dec 31 '25 09:12

Ocab19


Putting

[flake8]
ignore = E405

in your .flake8 config file will work.

Flake8 itself does not support per-file configuration, see the post: https://gitlab.com/pycqa/flake8/issues/156

But for advanced configuration, e.g. per-file, recommended way is to use flake8-putty

The homepage gives you an example:

Disable only D102 on foo.py

putty-ignore = foo.py : D102
like image 42
grapes Avatar answered Dec 31 '25 09:12

grapes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!