Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Files not being excluded via Atom, but command line flake8 does #454

Open
nogurenn opened this issue Jun 1, 2017 · 8 comments
Open

Files not being excluded via Atom, but command line flake8 does #454

nogurenn opened this issue Jun 1, 2017 · 8 comments

Comments

@nogurenn
Copy link

nogurenn commented Jun 1, 2017

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
screen shot 2017-06-01 at 7 02 18 pm
screen shot 2017-06-01 at 7 02 02 pm

@nogurenn nogurenn changed the title Files not being excluded, but CLI flake8 does Files not being excluded via Atom, but command line flake8 does Jun 1, 2017
@Arcanemagus
Copy link
Member

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.

lucasdf added a commit to lucasdf/linter-flake8 that referenced this issue Aug 4, 2017
Pass the filename as the argument "stdin-display-name".
Change the working directory where flask8 is executed to the same directory as the configuration file. This ensures that relative patterns defined in the configuration file work properly.
Add test.

This commit implements AtomLinter#454
lucasdf added a commit to lucasdf/linter-flake8 that referenced this issue Aug 7, 2017
Pass the filename as the argument "stdin-display-name".
Change the working directory where flask8 is executed to the same directory as the configuration file. This ensures that relative patterns defined in the configuration file work properly.
Add test.

This commit implements AtomLinter#454

Add message asking to update Flake8

Add message asking to update Flake8 when an exception occurs since some errors may arise from using an outdated version.

Fix eslint compliance.

Fix test failling.

Move fixtures using a config file to its own directory so the configuration file does not change the default values expected by the other tests.
lucasdf added a commit to lucasdf/linter-flake8 that referenced this issue Aug 7, 2017
Pass the filename as the argument "stdin-display-name".
Change the working directory where flask8 is executed to the same directory as the configuration file. This ensures that relative patterns defined in the configuration file work properly.
Add test.

This commit implements AtomLinter#454
lucasdf added a commit to lucasdf/linter-flake8 that referenced this issue Aug 19, 2017
Pass the filename as the argument "stdin-display-name".
Change the working directory where flask8 is executed to the same directory as the configuration file. This ensures that relative patterns defined in the configuration file work properly.
Add test.

This commit implements AtomLinter#454
@danpalmer
Copy link

Ping on this?

@Arcanemagus
Copy link
Member

v2.3.0 should fix this, let us know if it doesn't 😉.

@danpalmer
Copy link

@Arcanemagus I'm on 2.3.0 and still seeing this issue.

@Arcanemagus Arcanemagus reopened this Dec 12, 2017
@lucasdf
Copy link
Member

lucasdf commented Dec 12, 2017

I am looking into this.

@lucasdf
Copy link
Member

lucasdf commented Dec 16, 2017

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?

@danpalmer
Copy link

@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.

@Arcanemagus
Copy link
Member

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants