0

I'm using the excellent Elpy. I have with a Python project with a .flake8 config file at the top of the project source tree. I have this content in the .flake8 file:

[flake8] ignore = E251, E501, E303, E271, E221, E226 per-file-ignores = admin/export-data:E241,E304 

(export-data is a Python script in the subdirectory admin/ of the project.) Elpy running Flymake clearly reads the configuration file and correctly reads the globally-ignored error codes: I can see the effect of adding or removing error code values in the ignore line. However, the per-file settings for the file admin/export-data are not being recognized. At first, I thought the problem was the file path, so I tried variations such as just export-data, using the absolute path to export-data, and so on, and nothing seems to change the behavior: the per-file-ignores setting is itself ignored. Yet it works if I run flake8 in a terminal, outside of Emacs.

Is there a trick to getting the flake8/Elpy/Flymake combination to recognize the per-file-ignores setting?

1 Answer 1

1

flymake doesn't call flake8 directly. Instead it builds a python3 command-line and (if I remember correctly) feeds it the buffer contents via stdin. Naturally there's no filename in this case, but flymake handles this by using flake8's --stdin-display-name= option. According to this issue at the flymake repo, this works in the case of simple filenames, but there is apparently a flake8 bug in recognizing relative paths.

tl;dr: It sorta works, but in your case it's not working because of an outstanding flake8 bug.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.