Commit Graph

70 Commits

Author SHA1 Message Date
infokiller 91e8422d6d
Add pyflyby fixer (using its tidy-imports script) (#4219)
* add pyflyby fixer

updates

* pyflyby: add docs

updates

* add tests to pyflyby fixer
2022-06-16 22:41:57 +09:00
Paul Thompson 9bdc923624
re-worded confusing grammar (#4223) 2022-06-04 15:58:36 +09:00
Fionn Fitzmaurice e6ca599e87
Look for .mypy.ini when finding project root (#4202)
We already check for mypy.ini, but the fallback .mypy.ini was ignored.
2022-05-15 12:20:16 +09:00
Sébastien NOBILI 82a3e444b2
fix: duplicate tags in doc (#4059)
* fix: duplicate tag in doc

* fix: duplicate tags in doc

Co-authored-by: Sébastien NOBILI <code@pipoprods.org>
2022-02-08 11:12:26 +00:00
Jon Parise 8b1ea33cc0
Add a unimport linter for Python files (#4058)
Unimport (https://github.com/hakancelik96/unimport/) is a linter,
formatter for finding and removing unused import statements.

This introduces linting support, although fixer support could come
later.
2022-02-08 15:54:25 +09:00
David Houston ea643b97ab
Add cspell Linter (#3981)
* Add cspell linter

Add cspell linter, with the languages it supports.

Signed-off-by: David Houston <houstdav000@gmail.com>

* Add cspell Global Variables Documentation

Add documentation to /doc/ale.txt with cspell configuration options.

Signed-off-by: David Houston <houstdav000@gmail.com>

* Add cspell to docs, Minor Cleanup

Add cspell for each supported language, adding some spaces and removing
others when caught navigating the file.

Signed-off-by: David Houston <houstdav000@gmail.com>
2021-11-19 07:41:05 +09:00
a666 f9deee0e41
Add flakehell python linter (#3295) (#3921) 2021-10-02 16:37:57 +09:00
Oliver Albertini f769f64c07
[ale-python-root] add `.pyre_configuration.local` to list of files (#3900)
Without this, we have one `pyre` process running across different pyre
projects. With this change, files in different projects can be linted
with pyre at the same time.

Co-authored-by: Oliver Ruben Albertini <ora@fb.com>
2021-09-15 21:07:45 +09:00
Horacio Sanson bf29f6ea92
Fix 3897 - add poetry to isort (#3898)
Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-09-10 15:18:41 +09:00
Daniel Roseman 7d8fb2ba17
Python support poetry (#3834)
* Add poetry support to python linters and black fixer.

* Update python.vim to detect poetry project.

* Update ale.vim, add an option for poetry `g:ale_python_auto_poetry`.

* Update ale-python.txt, add poetry support.

* Add and update poetry related tests.

Co-authored-by: unc0 <unc0@users.noreply.github.com>
2021-07-25 13:39:05 +09:00
foobarbyte c1c3873c89
Correct typo in python config filenames (#3826)
* Correct typo in a config file filename.

.tool_versions should be .tool-versions

* Correct typo in config file names.

.tool_versions should be .tool-versions
2021-07-20 18:14:45 +09:00
foobarbyte 1893abdb19
Python .tool versions (#3820)
* Also check for asdf-vm's .tool_versions file

A minimal python project may only be specifying a python version using a version management tool like asdf-vm, without providing other common python project configuration files. asdf-vm creates a single .tool_versions file in the managed directory. By checking for .tool_versions in addition to other common python config files we ensure that python linters (whose behaviour typically depends on a particular python version) will run with the same version of python used by the project. This will also be the same python version used by vim itself when it is run from inside the project's directories.

* add .tool_versions to ale-python-root documentation

This reflects the corresponding change to autoload/ale/python.vim
2021-07-17 21:46:43 +09:00
Nikolay Zakirov 82a7e9f588
add autoflake fixer (#3779)
* first attempt

* added autoflake executable

* added Windows executable for appveyor

* delete unused files

* corrected wrong sorting
2021-07-13 21:58:18 +09:00
Gerardo Gómez Rodríguez 8b73d98baf
chore: replace python-language-server to supported pylsp (#3810)
As mentioned in #3722 palantir's python-language-server is no longer maintained.
The alternative is to use the community-driven https://github.com/python-lsp/python-lsp-server.
2021-07-09 22:40:31 +09:00
Nathan Henrie ed7f4dee53
issue 3033 (#3620)
* Add ale_python_pyls_options

* Add extra explanatory detail

* Fix alignment

* Fix test
2021-03-18 08:55:50 +09:00
Horacio Sanson aabca5b0ac
Merge pull request #3398 from ecly/update-python-find-root
Update `ale#python#FindProjectRootIni` with poetry.lock and pyproject.toml
2021-01-13 22:07:02 +09:00
Ivor Peles 64471e6ea8 Document ale_python_isort_auto_pipenv option 2020-11-21 19:24:19 -05:00
w0rp b4550f361b
Merge pull request #3409 from lyz-code/feat/add-autoimport-support
feat: add autoimport fixer
2020-11-21 20:45:51 +00:00
Lyz 513e6ee972
feat: add autoimport fixer 2020-10-23 18:53:38 +02:00
ecly f125c11faa Update FindProjectRootIni with poetry.lock and pyproject.toml 2020-10-15 13:35:47 +02:00
rgossiaux 9a8ab764d5
Fix typo in ale-python.txt 2020-10-02 22:51:54 -04:00
Konstantin Alekseev 1462de6685 Run flake8 from project root by default.
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.
2020-08-30 22:56:10 +03:00
w0rp 19229e8e27
Close #2472 - Add support for pyright 2020-08-07 12:16:13 +01:00
w0rp 8c4c8dfd97
Fix #2704 - Show mypy notes; can be disabled 2020-01-02 14:19:21 +00:00
Jake Kaufman 56641e0230 Add support for reorder-python-imports fixer
isort is great, but I've come to prefer reorder-python-imports. The tool
has a focus on smaller diffs than isort. reorder-python-imports is also
a little smarter than isort which is nice.
2019-06-08 19:22:50 -04:00
Eric N. Vander Weele 57736cdccc Change Python project root dir detection for flake8 configuration
The official configuration files for `flake8` are `.flake8`, `tox.ini`,
and `setup.cfg`.

After investigation, it is safe to remove `flake8.cfg` as it appears to
only exist as a typo in other tooling documentation (e.g.,
`python-language-server`).

Even though no linters automatically read `.flake8rc`, it is kept in
case projects may be using it for detecting the projects root directory.
2019-05-19 09:51:26 -04:00
Katsuya Horiuchi f444abdfe6 Add option to show msg id when pylint is used (#2445)
* Add python_pylint_use_msg_id to tweak output of pylint
* Add test for ale_python_pylint_use_msg_id
* Add doc on ale_python_pylint_use_msg_id
2019-05-09 17:28:18 +01: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 82b15fb706 Document and test ale_python_vulture_options
The vulture linter already supports ale_python_vulture_options, but it
is not documented or tested.  Since vulture only supports configuration
via options, it is an important use case.  Add docs and test.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2019-02-10 08:18:55 -07: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
Aiden Scandella de29ff26ff
Respect python black fixer configuration file
Similar to other linters/fixers, by default change to the directory of
the file being fixed before invoking `black`, which allows the tool to
read project-specific configuration (pyproject.toml)

Fixes #2218
2019-01-30 14:44:38 -08: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
w0rp 78724f4cd3
Fix some formatting issues 2019-01-03 20:33:59 +00:00
Miklós Tusz 1c9ad77866 Add documentation for python_black_auto_pipenv 2018-12-21 20:07:14 -08: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
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
Travis Cline 2ac9e454d6
python: add lookup path for flake8 config 2018-08-01 20:07:11 -07:00
Yauhen Kirylau 8517e901ff Add support for 'vulture' for Python 2018-07-26 08:41:27 +01:00
w0rp 72f002de94
Update the Python documentation 2018-07-15 19:26:45 +01:00
w0rp b8591e1034
Fix the doctag alignment 2018-07-05 09:24:57 +01:00
Derek P Sifford 3251d95a91 add options variable to isort 2018-07-04 13:01:16 -04:00
Derek P Sifford ea6d720fec add pyre lsp linter to python linters 2018-07-01 14:59:49 -04: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
w0rp bd92616e2a
Fix #1219 - Mention FindProjectRoot behavior for Python in the documentation 2018-05-30 20:09:33 +01:00
w0rp 8a659b7cc6
Fix #1566 - Add g:ale_python_flake8_change_directory 2018-05-28 16:34:54 +01:00
w0rp f9ba3d924f
Fix #1507 - Add an option for disabling switching directories for pylint 2018-04-17 13:30:30 +01:00