Closed tomleo closed 5 years ago
Yes sure! Actually we don't do anything here, and rely on the lookup algo of flake8 itself.
Iirc flake8 looks for its config starting from the current working dir. The working dir is set to the 'open' folder in Sublime by default but you could change that in the settings. Ref http://www.sublimelinter.com/en/stable/linter_settings.html#working-dir
You could also use http://www.sublimelinter.com/en/stable/linter_settings.html#args and pass any argument you want to flake8. (E.g. --config
)
Note: some variables are allowed http://www.sublimelinter.com/en/stable/settings.html#settings-expansion
@kaste So I've tried a few different flake8 configurations for a project I'm working on:
// Project File
{
"folders": [
{"path": "."}
],
"settings":
{
"linters": {
"flake8": {
"working_dir": "${project_path}/level_2",
"args": "--config=${project_path}/level_2/.flake8 --max-line-length=119",
}
}
},
}
However it's show errors around max-line-length
being greater than 79 characters
I can confirm that using flake8 from the command-line works as expected. When I reload sublime-linter I don't see any errors in the sublimetext console. So I'm not entirely shore what the next steps are here.
Ah. In the project settings we have flat key-value pairs (similar to VSCode). Ref http://www.sublimelinter.com/en/stable/settings.html#project-settings
Something like:
...
"settings": {
"SublimeLinter.linters.flake8.args": ...,
"SublimeLinter.linters.flake8.working_dir": ...
}
You probably don't need to set both though.
That did the trick!
My
.flake8
configuration is in the following directory for a project:project/level_2/.flake8
I'm wondering if
SublimeLinter-flake8
can pick-up.flake8
files in sub-directories.