-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide configuration option to run flake8 from project root. #2858
Conversation
This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See |
@w0rp please take a look, that feature can be useful |
I'm surprised this PR has been pending for almost a year over a "considered bug" |
what's blocking this PR? |
ale_linters/python/flake8.vim
Outdated
function! ale_linters#python#flake8#GetCdString(buffer) abort | ||
let l:change_directory = ale#Var(a:buffer, 'python_flake8_change_directory') | ||
|
||
if l:change_directory == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do better than 2
. Let's add strings for the existing options and new option, and also continue to support 1
and 0
. Make sure to update the documentation, including the documented type.
Let's make this new setting the new default, and make sure we fall back on setting the CWD to the directory the file is in, in the Vader tests.
Option `per-file-ignores` was introduced in flake8 version 3.7.0. It allows to ignore specific errors in specific files using glob syntax. For example `per-file-ignores = src/generated/*.py:F401` will ignore `F401` error in all python files in `src/generated`. Thus ale has to run flake8 from project root where .flake8 config is placed otherwise glob won't match linted file.
72ab3a2
to
1462de6
Compare
Hi @w0rp, I updated the pr with changes you requested.
that implicitly tested by unrelated tests, because project root is default now and by default tests run on a file that doesn't have project mark in the parent dirs. If you prefer to have an explicit test for that case let me know. |
Cheers! 🍻 |
Thanks! I've been using something similar to what's in this PR for a while now. I'm happy to be able to simplify my vimrc and use the default ale linter again! The fact that |
Option
per-file-ignores
was introduced in flake8 version 3.7.0.It allows to ignore specific errors in specific files using glob syntax.
For example
per-file-ignores = src/generated/*.py:F401
willignore
F401
error in all python files insrc/generated
.Thus ale have to run flake8 from project root where .flake8 config
is placed otherwise glob won't match linted file.
Not sure how that should be handled in ale style but I'm ready to follow on this pr.