New to Sublime and trying to get flake8 python linter to work with Sublime …
TL/DR: no luck with changing to useful settings in Sublime.
(0)
I’ve installed flake8 using:
pip install flake8
both in my virtualenv (at /Users/paul.keyser/task-status-updater/.venv/bin/flake8) and also globally (at /Library/Frameworks/Python.framework/Versions/2.7/bin/flake8). In the virtualenv, I can run it on some python (whole directory or just one file), and it will print errors, like “./tests.py:107:100: E501 line too long (124 > 99 characters)”.
After playing around for a long while, I found Tools => Command Palette => (dialog opens) => (search for “install”) => “Package Control: Install Package” => (new dialog) => (search for “flake8”) => click to install. The result of that is:
…$ ls ~/Library/Application\ Support/Sublime\ Text\ 3/Installed\ Packages/*
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Installed Packages/0_package_control_loader.sublime-package
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Installed Packages/SublimeLinter-flake8.sublime-package
(See also below, longer listing from related directory)
So I think it is installed correctly …
(1)
I played around with the syntax-specific settings in:
ls ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Py*
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/User/Python.sublime-settings, and they now look like this (no idea if these are right, but using the global-install path “/Library/Frameworks/Python.framework/Versions/2.7/bin/flake8” makes no difference):
(apologies, cannot get the editor display this correctly…)
{
“paths”: {
“linux”: [],
“osx”: [
“/Users/paul.keyser/task-status-updater/.venv/bin/flake8”
],
“windows”: []
},
“settings”:
{
“SublimeLinter.linters.flake8.disable”: false
}
}
I found out that to turn on the linter, you must save the file. But then I see a bunch of stuff I don’t want, and not stuff I do want: triggers on the default line-length; includes gazillions of D errors.
To adjust the max-line-length, I tried to Edit the Project and add to the JSON file:
"SublimeLinter": { "linters": { "flake8": { "disable": false, "args": [ "--exclude=__pycache__,.pyc", "--max-line-length=99", "--select=E,F,W,C90", ], } } }
Neither the “max-line-length” nor the “select” has any effect that I can detect.
How is this actually done? (Yes, I’ve tried quit and restart, many times.)
If the flake8 integration is broken, can you tell me what Python-linter’s integration is not broken, and I’ll just use that?
thanks,
Paul
…$ ls ~/Library/Application\ Support/Sublime\ Text\ 3/Installed\ Packages/*
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Installed Packages/0_package_control_loader.sublime-package
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Installed Packages/SublimeLinter-flake8.sublime-package
(.venv) C02WQ2LVHTD6:src paul.keyser$
(.venv) C02WQ2LVHTD6:src paul.keyser$
(.venv) C02WQ2LVHTD6:src paul.keyser$
(.venv) C02WQ2LVHTD6:src paul.keyser$ ls ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/Python\ Flake8\ Lint/*
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Default (Linux).sublime-keymap
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Default (OSX).sublime-keymap
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Default (Windows).sublime-keymap
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Default.sublime-commands
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Flake8Lint.py
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Flake8Lint.sublime-settings
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Main.sublime-menu
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/README.md
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/color_theme.py
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/lint.py
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/messages.json
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/package-metadata.json
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/contrib:
elementtree_contrib flake8_debugger.py mccabe.py pep8ext_naming.py pyflakes
flake8 flake8_import_order pep8.py pydocstyle.py
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/gutter-themes:
LICENSE alpha-warning.png bright-warning.png dark-warning.png hard-warning.png simple-warning.png
alpha-critical.png bright-critical.png dark-critical.png hard-critical.png simple-critical.png success.png
alpha-error.png bright-error.png dark-error.png hard-error.png simple-error.png
/Users/paul.keyser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/messages:
1.4.0.txt 1.5.0.txt 2.0.0.txt 2.4.0.txt install.txt