linter-flake8
linter-flake8 copied to clipboard
Files not being excluded via Atom, but command line flake8 does
This is the setup.cfg
file. I know that the linter reads the file because ignore
is honored so there's something going on with the exclude
. The first screenshot shows the linter raising an error in apollo/config/settings/local.py
while the second screenshot clearly shows that this file was ignored. Let me know what additional info is needed.
Using Mac OS, virtualenvwrapper
[flake8]
ignore = D100, D210, D400, D413
exclude =
.git,
__pycache__,
__init__.py,
*/migrations/*,
apollo/config/settings/*.py,
apollo/manage.py
max-line-length = 99
max-complexity = 10
Location of flake8
: ~/Developer/.virtualenvs/apollo/bin/flake8
Project structure
.
├── apollo
│ ├── config
│ │ ├── __init__.py
│ │ ├── settings
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── local.py
│ │ │ ├── production.py
│ │ │ ├── settings.py
│ │ │ ├── staging.py
│ │ │ └── test.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ └── manage.py
└── setup.cfg
Screenshots
I was going to comment that flake8
has no method of specifying the file name for stdin
content, but apparently it does as of v3.0 so this might be possible to fix now.
Ping on this?
v2.3.0 should fix this, let us know if it doesn't 😉.
@Arcanemagus I'm on 2.3.0 and still seeing this issue.
I am looking into this.
Currently, the linter executes Flake8 inside of the project's root directory and it expects the configuration file to be located there. By project's root, I mean the topmost directory of the project according to Atom.
In the example provided by the OP, the files are correctly ignored. However, in any other situation where the configuration file is not in the project's root, Flake8 does not recognize the file.
@Arcanemagus I am not sure what the best approach would be. How the other linters solve this kind of issue? Should we try to locate the nearest configuration file and execute Flake8 inside that directory?
@lucasdf I can reproduce this with my config in the root of my project. I use a setup.cfg
file as most Python tooling supports reading it.
However, in any other situation where the configuration file is not in the project's root, Flake8 does not recognize the file.
@lucasdf Ideally these providers should be "the same as running the tool in the CLI", unfortunately what that actually means can get really tricky. I generally follow the rules of:
- "if you are in the directory of the file and run the CLI tool, the provider should match that"
- "if you are in the project root (as seen by Atom) and run the CLI tool, the provider should match that"
Which one of those a provider falls under is just the start of the trickiness 😉.
I think this provider should follow the second one, unless this issue is describing a situation where that doesn't match what running flake8
in the CLI does, in which case we may need to change it?