Commit Graph

106 Commits

Author SHA1 Message Date
w0rp 3bebcb5d48
#2132 - Replace command_chain and chain_with with ale#command#Run 2019-04-07 14:58:06 +01:00
w0rp 883978ece9
#2132 - Replace all uses of foo_callback with foo 2019-02-22 18:05:04 +00:00
w0rp 8012e5b60f
Merge pull request #2303 from kevinoid/bandit-use-config
python/bandit: Use .bandit configuration file
2019-02-20 09:58:02 +00:00
Kevin Locke 52c2400786 python/bandit: Use .bandit configuration file
Bandit automatically [uses any .bandit file] within the directories on
which it is invoked.  Since ALE invokes bandit on stdin, it does not
load a .bandit file automatically.  Add support for automatically
finding a .bandit file and passing it to bandit via the --ini option
along with a variable to disable this behavior if desired.

Note: This is useful for the skips and tests configuration options, but
not exclude which would require invoking bandit using a file name, which
may or may not be a good trade-off.

[uses any .bandit file]: https://github.com/PyCQA/bandit/blob/1.5.1/bandit/cli/main.py#L70-L73

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2019-02-17 14:24:18 -07:00
Kevin Locke 3300b1aca7 python/pylint: Change directory to project root
Pylint only [checks for pylintrc] (and .pylintrc) files in the packages
aboves its current directory before falling back to user and global
pylintrc.  For projects with a src dir, running pylint from the
directory containing the file will not use the project pylintrc.

Adopt the convention used by many other Python linters of running from
the project root, which solves this issue.  Add pylintrc and .pylintrc
to FindProjectRoot.  Update docs.

[checks for pylintrc]: https://github.com/PyCQA/pylint/blob/pylint-2.2.2/pylint/config.py#L106

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2019-02-17 10:40:50 -07:00
Kevin Locke a6caa85a58 pylama: Use %s instead of %t
Although using %t to lint changes was desirable, many pylama checks use
surrounding paths and file contents (e.g. C0103 module name, E0402
relative import beyond top, etc.)  The more such errors I find during
testing, the less %t seems like a good idea.  Switch to %s.

Also set `lint_file` to 1 and mark Pylama as a file linter in the docs.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2019-02-12 10:45:26 -07:00
w0rp 7a48750610
Complain about binary operators on the ends of lines 2019-02-10 11:43:48 +00:00
Kevin Locke a24f0b4d5f Support pylama for python (#2266)
* Add pylama for python
* Consolidate python traceback handling
2019-02-08 21:44:34 +00:00
w0rp 3e11cbd18d
Update syntax checking
* Line continuation characters should be on the same lines.
* .vim file line indentation should be a multiple of 4.
2019-02-06 18:05:13 +00:00
w0rp f03370e183
Merge pull request #2207 from pmacosta/master
Fixed parsing of pydocstyle errors
2019-01-27 11:01:14 +00:00
w0rp d882c434a1
Merge pull request #2215 from irwand/master
support older flake8 output, still used by hacking module from openstack style guide
2019-01-27 10:57:42 +00:00
Martino Pilia 0a5de2b42b
Add bandit linter for Python 2019-01-26 11:48:03 +01:00
yut23 f2db164268 Add support for pyls configuration options
Resolves #1443.
Heavily inspired by the analogous support added for elixir-ls.
2019-01-20 23:59:46 -05:00
Irwan Djajadi 08affaad7a support older flake8 output, still used by hacking module from open style guide 2019-01-16 10:59:05 -06:00
Pablo Acosta-Serafini 86af4be0d0 Fixed parsing of pydocstyle errors
ale#Escape function seems to prepend and append ' to the file name, which
are not present in the pydocstyle output. Having the parsing regexp match
the file name was overkill anyway, since there is an obvious 1:1
correspondence between the buffer number and the (potential) errors
reported by pydocstyle.
2019-01-14 20:36:14 -05:00
pmacosta fdd37acc1f Add support for pydocstyle linter (#2085)
The linter can correctly parse pydocstyle output with any of the following
command-line options enabled: --explain, --source, --debug, and/or
--verbose
2018-12-06 11:27:03 -07:00
Marius Gedminas 9481f307fb flake8 reports visual columns
Fixes #2092.
2018-11-22 11:57:02 +02:00
Eddie Lebow dbe9352935 Add `python_auto_pipenv` config var for all python linters.
This allows a user to set one variable instead of eight.
2018-09-15 22:10:46 -04:00
Eddie Lebow 56e67c5811 Add python_[linter]_auto_pipenv options for python linters (fixes #1656)
When set to true, and the buffer is currently inside a pipenv,
GetExecutable will return "pipenv", which will trigger the existing
functionality to append the correct pipenv arguments to run each linter.

Defaults to false.

I was going to implement ale#python#PipenvPresent by invoking
`pipenv --venv` or `pipenv --where`, but it seemed to be abominably
slow, even to the point where the test suite wasn't even finishing
("Tried to run tests 3 times"). The diff is:

diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim
index 7baae079..8c100d41 100644
--- a/autoload/ale/python.vim
+++ b/autoload/ale/python.vim
@@ -106,5 +106,9 @@ endfunction

" Detects whether a pipenv environment is present.
function! ale#python#PipenvPresent(buffer) abort
-    return findfile('Pipfile.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
+    let l:cd_string = ale#path#BufferCdString(a:buffer)
+    let l:output = systemlist(l:cd_string . 'pipenv --where')[0]
+    " `pipenv --where` returns the path to the dir containing the Pipfile
+    " if in a pipenv, or some error text otherwise.
+    return strpart(l:output, 0, 18) !=# "No Pipfile present"
 endfunction

Using vim's `findfile` is much faster, behaves correctly in the majority
of situations, and also works reliably when the `pipenv` command doesn't
exist.
2018-09-15 22:10:46 -04:00
actionless eb38c4b3f1 fix(linters: python): mark as lint_file 2018-07-26 14:45:28 +02:00
Yauhen Kirylau 8517e901ff Add support for 'vulture' for Python 2018-07-26 08:41:27 +01:00
w0rp 9ddf1b6a05
Make the language option for LSP linters optional 2018-07-04 13:12:58 +01:00
w0rp db85b931ec
Remove deprecated code for the 2.0 release 2018-07-04 08:36:34 +01:00
Derek P Sifford ea6d720fec add pyre lsp linter to python linters 2018-07-01 14:59:49 -04:00
w0rp b047271051
Merge pull request #1682 from fennerm/fix_prospector_e474
Fix prospector empty string error
2018-06-27 21:34:28 +01:00
Fenner Macrae 1ca2334846 Fix prospector empty string error
Prospector linter is raising error when no warnings are present in file
(#1680). Copied fix from #779.
2018-06-26 16:58:34 -07:00
Eddie Lebow ca88e67af0 Allow all Python linter executables to be set to `pipenv`.
It appends ` run {linter_name}`, analogously to the Ruby linters when
the executable is set to `bundle`
2018-06-05 00:33:26 -04:00
Eddie Lebow dd642b117c Allow flake8 executable to be set to `pipenv`.
It appends ` run flake8`, analogously to the Ruby tools when the
executable is set to `bundle`
2018-06-02 21:49:12 -04:00
w0rp 191967cfee
#1587 - Add deprecation warnings for old linter options 2018-05-28 19:52:27 +01:00
w0rp 8a659b7cc6
Fix #1566 - Add g:ale_python_flake8_change_directory 2018-05-28 16:34:54 +01:00
w0rp 6ab3fdc4d0
Close #1521 - Allow the language to be set with simple strings for LSP linters 2018-04-27 22:52:11 +01:00
Andreas Kloeckner 603e61ad71 flake8: Move to the buffer's directory before running flake8 command 2018-04-26 18:53:44 -05:00
w0rp d8a673515a
Close #1162 - Implement completion support with LSP servers 2018-04-22 12:28:19 +01:00
w0rp f9ba3d924f
Fix #1507 - Add an option for disabling switching directories for pylint 2018-04-17 13:30:30 +01:00
w0rp 3f0e1cd05d Fix #1492 - Make pylint error parsing work on Windows 2018-04-10 15:18:16 +01:00
w0rp 719b790574
Close #542 - Add an option for disabling running locally installed executables by default 2018-04-09 19:11:20 +01:00
rhysd 4903b966a7 pylint: Move to the buffer's directory before running pylint command (Fix #1472) 2018-04-09 16:43:10 +09:00
w0rp 5972b97223 #476 Make F401 a warning and E112 a syntax error 2018-02-18 09:44:04 +00:00
w0rp adba2bd919 Allow syntax errors for mypy to be ignored 2018-01-11 16:43:10 +00:00
Carlos Coêlho daee4a4722 Add prospector for checking Python code (#1183) 2017-12-01 17:04:30 +00:00
w0rp a43ada93e4 Allow warnings about trailing whitespace to be disabled for pycodestyle, and cover the flake8 code with tests 2017-11-28 10:12:49 +00:00
w0rp 0ab689db0a Allow warnings about trailing blank lines to be hidden for flake8 and pycodestyle 2017-11-28 10:08:34 +00:00
w0rp 52f3ad7c75 Escape the pyls executable in the command, and support running virtualenv pyls executables 2017-11-21 23:51:18 +00:00
w0rp 49ccfb1a00 Fix #516 - Add support for pyflakes for Python 2017-11-17 18:11:28 +00:00
w0rp 1d65e5692f #852 Capture error codes for pycodestyle, and consider every code except E999 to be style errors or warnings 2017-11-15 17:47:24 +00:00
w0rp cf538c3a58 #852 Capture error codes for pylint, throw away the msgid values 2017-11-15 17:35:34 +00:00
w0rp d8f9aef84a #852 - Capture error codes for flake8 2017-11-14 09:41:29 +00:00
w0rp d425b8a18a Simplfy semver handling and share the semver version cache across everything 2017-11-09 23:42:54 +00:00
Auri 8a4cf923a8 Add PyLS linter (#1097)
* Support PyLS (python language server)
* Replace pyls#GetProjectRoot and add more config types to ale#python#FindProjectRoot
2017-11-08 17:58:56 +00:00
Michael 8f8d015dae Add pycodestyle Python linter support (#872)
Add a pycodestyle linter
2017-08-25 12:46:56 +01:00