summaryrefslogtreecommitdiff
path: root/ale_linters/python
AgeCommit message (Collapse)Author
2021-09-10[python/pyre.vim] Fix pyre persistent behavior (#3895)Oliver Albertini
It's necessary to provide a `-l` option to pyre with the closest parent directory containing a `.pyre_configuration.local` file, or simply change directory (cwd) to the root of the pyre project. Thanks to Ken Verbosky for the code that fixes this. Error seen when not using such a solution: ``` 1031.473923 on 6: Dropping message 'ƛ Background task unexpectedly quited: Invalid configuration: Cannot find any source files to analyze. Either `source_directories` or `targets` must be specified. ``` Issue with this approach is that if you are editing files under different projects, the `pyre persistent` process is not re-created for each file. We have to do `:ALEStopAlllsps` in order for the process to start with the new working directory. Co-authored-by: Oliver Ruben Albertini <ora@fb.com>
2021-07-25Python support poetry (#3834)Daniel Roseman
* 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-09chore: replace python-language-server to supported pylsp (#3810)Gerardo Gómez Rodríguez
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-03-18issue 3033 (#3620)Nathan Henrie
* Add ale_python_pyls_options * Add extra explanatory detail * Fix alignment * Fix test
2021-03-01Close #2281 - Separate cwd commands from commandsw0rp
Working directories are now set seperately from the commands so they can later be swapped out when running linters over projects is supported, and also better support filename mapping for running linters on other machines in future.
2021-02-11mypy: Pass user options before any others (#3582)Daniel Leong
This enables us to use a custom `python` exe as the "mypy" executable and pass `-m mypy` in `mypy_options`
2020-11-14Support for LSP/tsserver Code Actions (#3437)Dalius Dobravolskas
* Added tsserver and LSP code action support. * tsserver refactors support added. * Handling special case when new text is added after new line symbol. * ale#code_action#ApplyChanges simplified. * Initial attempt on LSP Code Actions. * workspace/executeCommand added. * Some null checks added. * Add last column to LSP Code Action message. * Pass diagnostics to LSP code action. Previously ApplyChanges code was applied from top-to-bottom that required extra parameters to track progress and there was bug. I have changed code to bottom-to-top approach as that does not require those extra parameters and solved the bug. Tested with typescript-language-server and it is working.
2020-09-09Close #2522 - Check pylint on the flyw0rp
Newer versions of pylint will now check your code as you type. Older versions will still only check the file on disk. Co-authored-by: Oliver Wiegers <oliver.wiegers@gmail.com>
2020-08-31Fix flake8 cd logic for invalid optionsw0rp
2020-08-30Run flake8 from project root by default.Konstantin Alekseev
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-28Close #3325 - Apply new formatting where possiblew0rp
2020-08-07Close #2472 - Add support for pyrightw0rp
2020-01-02Mypy: try to find folder containing mypy.ini to use as cwd. (#2385)Harry Percival
* When deciding which directory to run mypy from, prefer a folder with mypy.ini in it * Add a test for mypy.ini-finding behaviour
2020-01-02Fix #2704 - Show mypy notes; can be disabledw0rp
2019-08-15mypy linter capture stderr for error reporting in ALEInfoRichard French
2019-05-09Add option to show msg id when pylint is used (#2445)Katsuya Horiuchi
* 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-04-07#2132 - Replace command_chain and chain_with with ale#command#Runw0rp
2019-02-22#2132 - Replace all uses of foo_callback with foow0rp
2019-02-20Merge pull request #2303 from kevinoid/bandit-use-configw0rp
python/bandit: Use .bandit configuration file
2019-02-17python/bandit: Use .bandit configuration fileKevin Locke
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-17python/pylint: Change directory to project rootKevin Locke
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-12pylama: Use %s instead of %tKevin Locke
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-10Complain about binary operators on the ends of linesw0rp
2019-02-08Support pylama for python (#2266)Kevin Locke
* Add pylama for python * Consolidate python traceback handling
2019-02-06Update syntax checkingw0rp
* Line continuation characters should be on the same lines. * .vim file line indentation should be a multiple of 4.
2019-01-27Merge pull request #2207 from pmacosta/masterw0rp
Fixed parsing of pydocstyle errors
2019-01-27Merge pull request #2215 from irwand/masterw0rp
support older flake8 output, still used by hacking module from openstack style guide
2019-01-26Add bandit linter for PythonMartino Pilia
2019-01-20Add support for pyls configuration optionsyut23
Resolves #1443. Heavily inspired by the analogous support added for elixir-ls.
2019-01-16support older flake8 output, still used by hacking module from open style guideIrwan Djajadi
2019-01-14Fixed parsing of pydocstyle errorsPablo Acosta-Serafini
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.
2018-12-06Add support for pydocstyle linter (#2085)pmacosta
The linter can correctly parse pydocstyle output with any of the following command-line options enabled: --explain, --source, --debug, and/or --verbose
2018-11-22flake8 reports visual columnsMarius Gedminas
Fixes #2092.
2018-09-15Add `python_auto_pipenv` config var for all python linters.Eddie Lebow
This allows a user to set one variable instead of eight.
2018-09-15Add python_[linter]_auto_pipenv options for python linters (fixes #1656)Eddie Lebow
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-07-26fix(linters: python): mark as lint_fileactionless
2018-07-26Add support for 'vulture' for PythonYauhen Kirylau
2018-07-04Make the language option for LSP linters optionalw0rp
2018-07-04Remove deprecated code for the 2.0 releasev2.0.0w0rp
2018-07-01add pyre lsp linter to python lintersDerek P Sifford
2018-06-27Merge pull request #1682 from fennerm/fix_prospector_e474w0rp
Fix prospector empty string error
2018-06-26Fix prospector empty string errorFenner Macrae
Prospector linter is raising error when no warnings are present in file (#1680). Copied fix from #779.
2018-06-05Allow all Python linter executables to be set to `pipenv`.Eddie Lebow
It appends ` run {linter_name}`, analogously to the Ruby linters when the executable is set to `bundle`
2018-06-02Allow flake8 executable to be set to `pipenv`.Eddie Lebow
It appends ` run flake8`, analogously to the Ruby tools when the executable is set to `bundle`
2018-05-28#1587 - Add deprecation warnings for old linter optionsw0rp
2018-05-28Fix #1566 - Add g:ale_python_flake8_change_directoryw0rp
2018-04-27Close #1521 - Allow the language to be set with simple strings for LSP lintersw0rp
2018-04-26flake8: Move to the buffer's directory before running flake8 commandAndreas Kloeckner
2018-04-22Close #1162 - Implement completion support with LSP serversw0rp
2018-04-17Fix #1507 - Add an option for disabling switching directories for pylintw0rp