2

I've installed the linter-flake8 Atom package, and keep getting the following warnings:

F821 — undefined name 'self' at line __ col _

Following this question, is there a way to specify builtins="self" in Atom?
I can't seem to find it. And if not, is there a workaround?

Community
  • 1
  • 1
galah92
  • 3,621
  • 2
  • 29
  • 55

1 Answers1

0

there is a special file which you require in your home directory (or per project basis) called a flake8 file.

For a global version, if not already existing create a file located at ~/.config/flake8

Within this directory add all your customizations, my flake8 file looks like this for example:

[flake8]
max-line-length = 120
ignore = W293, E402

So for your's you'd probably wish to do something similar, with ignore=F821.

For a per project version please see the flake8 documentation on configuration:

http://flake8.pycqa.org/en/latest/user/configuration.html

within the page they highlight a number of possible configuration locations. Good luck!

jmercouris
  • 348
  • 5
  • 17
  • Should I create a config file named `flake8`, or a folder named `flake8` which contains a config file (and what's the config name?)? – galah92 Sep 27 '16 at 19:24
  • You should create a folder named '.config' within your home directory. Within this folder is a file simply named 'flake8', within this file add your customizations and save it. – jmercouris Sep 27 '16 at 19:26
  • Thanks, I tried to add `builtins="self"` but it doesn't seem to work. Do you how can I use `builtins`? I don't wanna ignore the whole `F821`. – galah92 Sep 27 '16 at 19:33
  • Did you see this: --builtins="_", and this thread here: http://stackoverflow.com/questions/37840142/how-to-avoid-flake8s-f821-undefined-name-when-has-been-installed-by-get – jmercouris Sep 27 '16 at 19:35
  • Of course, it's in my question. For some reason, it doesn't seen to work. – galah92 Sep 27 '16 at 19:37
  • I'm sorry, I missed that link somehow, did you try restarting your editor? or putting it in your global file? Did you try manually running the flake8 tool to see if it respects the configuration? – jmercouris Sep 27 '16 at 19:38