#659 - Add options for Python fixers, and cut down on duplicated documentation
This commit is contained in:
parent
fb682be199
commit
629ff513ec
@ -102,7 +102,7 @@ name. That seems to be the fairest way to arrange this table.
|
|||||||
| Pod | [proselint](http://proselint.com/)|
|
| Pod | [proselint](http://proselint.com/)|
|
||||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||||
| Python | [flake8](http://flake8.pycqa.org/en/latest/), [mypy](http://mypy-lang.org/), [pylint](https://www.pylint.org/) |
|
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [pylint](https://www.pylint.org/), [yapf](https://github.com/google/yapf) |
|
||||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions
|
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions
|
||||||
| reStructuredText | [proselint](http://proselint.com/)|
|
| reStructuredText | [proselint](http://proselint.com/)|
|
||||||
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
||||||
|
@ -1,13 +1,26 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Fixing files with autopep8.
|
" Description: Fixing files with autopep8.
|
||||||
|
|
||||||
|
call ale#Set('python_autopep8_executable', 'autopep8')
|
||||||
|
call ale#Set('python_autopep8_use_global', 0)
|
||||||
|
call ale#Set('python_autopep8_options', '')
|
||||||
|
|
||||||
function! ale#fixers#autopep8#Fix(buffer) abort
|
function! ale#fixers#autopep8#Fix(buffer) abort
|
||||||
let l:executable = ale#python#GetExecutable(a:buffer, 'autopep8')
|
let l:executable = ale#python#FindExecutable(
|
||||||
|
\ a:buffer,
|
||||||
|
\ 'python_autopep8',
|
||||||
|
\ ['/bin/autopep8'],
|
||||||
|
\)
|
||||||
|
|
||||||
if empty(l:executable)
|
if empty(l:executable)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let l:options = ale#Var(a:buffer, 'python_autopep8_options')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable) . ' -'
|
\ 'command': ale#Escape(l:executable)
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' -',
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Fixing Python imports with isort.
|
" Description: Fixing Python imports with isort.
|
||||||
|
|
||||||
|
call ale#Set('python_isort_executable', 'isort')
|
||||||
|
call ale#Set('python_isort_use_global', 0)
|
||||||
|
|
||||||
function! ale#fixers#isort#Fix(buffer) abort
|
function! ale#fixers#isort#Fix(buffer) abort
|
||||||
let l:executable = ale#python#GetExecutable(a:buffer, 'isort')
|
let l:executable = ale#python#FindExecutable(
|
||||||
|
\ a:buffer,
|
||||||
|
\ 'python_isort',
|
||||||
|
\ ['/bin/isort'],
|
||||||
|
\)
|
||||||
|
|
||||||
if empty(l:executable)
|
if empty(l:executable)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Fixing Python files with yapf.
|
" Description: Fixing Python files with yapf.
|
||||||
|
|
||||||
|
call ale#Set('python_yapf_executable', 'yapf')
|
||||||
|
call ale#Set('python_yapf_use_global', 0)
|
||||||
|
|
||||||
function! ale#fixers#yapf#Fix(buffer) abort
|
function! ale#fixers#yapf#Fix(buffer) abort
|
||||||
let l:executable = ale#python#GetExecutable(a:buffer, 'yapf')
|
let l:executable = ale#python#FindExecutable(
|
||||||
|
\ a:buffer,
|
||||||
|
\ 'python_yapf',
|
||||||
|
\ ['/bin/yapf'],
|
||||||
|
\)
|
||||||
|
|
||||||
if empty(l:executable)
|
if empty(l:executable)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
@ -9,27 +9,6 @@ let g:ale_virtualenv_dir_names = get(g:, 'ale_virtualenv_dir_names', [
|
|||||||
\ 'virtualenv',
|
\ 'virtualenv',
|
||||||
\])
|
\])
|
||||||
|
|
||||||
" Given a buffer number and a command name, find the path to the executable.
|
|
||||||
" First search on a virtualenv for Python, if nothing is found, try the global
|
|
||||||
" command. Returns an empty string if cannot find the executable
|
|
||||||
function! ale#python#GetExecutable(buffer, cmd_name) abort
|
|
||||||
let l:virtualenv = ale#python#FindVirtualenv(a:buffer)
|
|
||||||
|
|
||||||
if !empty(l:virtualenv)
|
|
||||||
let l:ve_executable = l:virtualenv . '/bin/' . a:cmd_name
|
|
||||||
|
|
||||||
if executable(l:ve_executable)
|
|
||||||
return l:ve_executable
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if executable(a:cmd_name)
|
|
||||||
return a:cmd_name
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Given a buffer number, find the project root directory for Python.
|
" Given a buffer number, find the project root directory for Python.
|
||||||
" The root directory is defined as the first directory found while searching
|
" The root directory is defined as the first directory found while searching
|
||||||
" upwards through paths, including the current directory, until a path
|
" upwards through paths, including the current directory, until a path
|
||||||
@ -58,3 +37,32 @@ function! ale#python#FindVirtualenv(buffer) abort
|
|||||||
|
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Given a buffer number and a command name, find the path to the executable.
|
||||||
|
" First search on a virtualenv for Python, if nothing is found, try the global
|
||||||
|
" command. Returns an empty string if cannot find the executable
|
||||||
|
function! ale#python#FindExecutable(buffer, base_var_name, path_list) abort
|
||||||
|
if ale#Var(a:buffer, a:base_var_name . '_use_global')
|
||||||
|
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:virtualenv = ale#python#FindVirtualenv(a:buffer)
|
||||||
|
|
||||||
|
if !empty(l:virtualenv)
|
||||||
|
for l:path in a:path_list
|
||||||
|
let l:ve_executable = l:virtualenv . l:path
|
||||||
|
|
||||||
|
if executable(l:ve_executable)
|
||||||
|
return l:ve_executable
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:global_executable = ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||||
|
|
||||||
|
if executable(l:global_executable)
|
||||||
|
return l:global_executable
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
@ -10,11 +10,7 @@ g:ale_css_stylelint_executable *g:ale_css_stylelint_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'stylelint'`
|
Default: `'stylelint'`
|
||||||
|
|
||||||
ALE will first discover the stylelint path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of stylelint, set
|
|
||||||
|g:ale_css_stylelint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_css_stylelint_options *g:ale_css_stylelint_options*
|
g:ale_css_stylelint_options *g:ale_css_stylelint_options*
|
||||||
@ -30,10 +26,7 @@ g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
stylelint first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of stylelint, in preference to locally installed versions of
|
|
||||||
stylelint in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -10,11 +10,7 @@ g:ale_handlebars_embertemplatelint_executable
|
|||||||
Type: |String| *b:ale_handlebars_embertemplatelint_executable*
|
Type: |String| *b:ale_handlebars_embertemplatelint_executable*
|
||||||
Default: `'ember-template-lint'`
|
Default: `'ember-template-lint'`
|
||||||
|
|
||||||
ALE will look for ember-template-lint executable in ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. When it cannot find it, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of ember-template-lint,
|
|
||||||
set |g:ale_handlebars_embertemplatelint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_handlebars_embertemplatelint_use_global
|
g:ale_handlebars_embertemplatelint_use_global
|
||||||
@ -22,10 +18,7 @@ g:ale_handlebars_embertemplatelint_use_global
|
|||||||
Type: |Number| *b:ale_handlebars_embertemplatelint_use_global*
|
Type: |Number| *b:ale_handlebars_embertemplatelint_use_global*
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local
|
See |ale-integrations-local-executables|
|
||||||
ember-template-lint executable first. If this variable is set to `1`, then
|
|
||||||
ALE will always use the global version of ember-template-lint, in preference
|
|
||||||
to version installed in local node_modules directory.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -5,6 +5,14 @@ ALE HTML Integration *ale-html-options*
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
htmlhint *ale-html-htmlhint*
|
htmlhint *ale-html-htmlhint*
|
||||||
|
|
||||||
|
g:ale_html_htmlhint_executable *g:ale_html_htmlhint_executable*
|
||||||
|
*b:ale_html_htmlhint_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'htmlhint'`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
g:ale_html_htmlhint_options *g:ale_html_htmlhint_options*
|
g:ale_html_htmlhint_options *g:ale_html_htmlhint_options*
|
||||||
*b:ale_html_htmlhint_options*
|
*b:ale_html_htmlhint_options*
|
||||||
Type: |String|
|
Type: |String|
|
||||||
@ -13,27 +21,12 @@ g:ale_html_htmlhint_options *g:ale_html_htmlhint_options*
|
|||||||
This variable can be changed to modify flags given to HTMLHint.
|
This variable can be changed to modify flags given to HTMLHint.
|
||||||
|
|
||||||
|
|
||||||
g:ale_html_htmlhint_executable *g:ale_html_htmlhint_executable*
|
|
||||||
*b:ale_html_htmlhint_executable*
|
|
||||||
Type: |String|
|
|
||||||
Default: `'htmlhint'`
|
|
||||||
|
|
||||||
ALE will first discover the htmlhint path in an ancestor node_modules
|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of htmlhint, set
|
|
||||||
|g:ale_html_htmlhint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_html_htmlhint_use_global *g:ale_html_htmlhint_use_global*
|
g:ale_html_htmlhint_use_global *g:ale_html_htmlhint_use_global*
|
||||||
*b:ale_html_htmlhint_use_global*
|
*b:ale_html_htmlhint_use_global*
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
htmlhint first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of htmlhint, in preference to locally installed versions of
|
|
||||||
htmlhint in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -31,14 +31,7 @@ g:ale_javascript_eslint_executable *g:ale_javascript_eslint_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'eslint'`
|
Default: `'eslint'`
|
||||||
|
|
||||||
ALE will first discover the eslint path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
This variable can be set to change the path to eslint. If you have eslint_d
|
|
||||||
installed, you can set this option to use eslint_d instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of eslint, set
|
|
||||||
|g:ale_javascript_eslint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_javascript_eslint_options *g:ale_javascript_eslint_options*
|
g:ale_javascript_eslint_options *g:ale_javascript_eslint_options*
|
||||||
@ -54,10 +47,7 @@ g:ale_javascript_eslint_use_global *g:ale_javascript_eslint_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
eslint first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of eslint, in preference to locally installed versions of
|
|
||||||
eslint in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -68,11 +58,7 @@ g:ale_javascript_prettier_executable *g:ale_javascript_prettier_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'prettier'`
|
Default: `'prettier'`
|
||||||
|
|
||||||
ALE will first discover the prettier path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of prettier set
|
|
||||||
|g:ale_javascript_prettier_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_javascript_prettier_options *g:ale_javascript_prettier_options*
|
g:ale_javascript_prettier_options *g:ale_javascript_prettier_options*
|
||||||
@ -88,9 +74,7 @@ g:ale_javascript_prettier_use_global *g:ale_javascript_prettier_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
prettier first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of Prettier.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -102,11 +86,7 @@ g:ale_javascript_prettier_eslint_executable
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'prettier-eslint'`
|
Default: `'prettier-eslint'`
|
||||||
|
|
||||||
ALE will first discover the prettier-eslint path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of prettier-eslint set
|
|
||||||
|g:ale_javascript_prettier_eslint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_javascript_prettier_eslint_options
|
g:ale_javascript_prettier_eslint_options
|
||||||
@ -124,9 +104,7 @@ g:ale_javascript_prettier_eslint_use_global
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
prettier-eslint first. If this variable is set to `1`, then ALE will always
|
|
||||||
use the global version of Prettier-eslint.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -137,11 +115,7 @@ g:ale_javascript_flow_executable *g:ale_javascript_flow_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'flow'`
|
Default: `'flow'`
|
||||||
|
|
||||||
ALE will first discover the flow path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of flow, set
|
|
||||||
|g:ale_javascript_flow_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_javascript_flow_use_global *g:ale_javascript_flow_use_global*
|
g:ale_javascript_flow_use_global *g:ale_javascript_flow_use_global*
|
||||||
@ -149,10 +123,7 @@ g:ale_javascript_flow_use_global *g:ale_javascript_flow_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
flow first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of flow, in preference to locally installed versions of
|
|
||||||
flow in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -163,13 +134,7 @@ g:ale_javascript_jshint_executable *g:ale_javascript_jshint_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'jshint'`
|
Default: `'jshint'`
|
||||||
|
|
||||||
ALE will first discover the jshint path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
This variable can be changed to change the path to jshint.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of jshint, set
|
|
||||||
|g:ale_javascript_jshint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_javascript_jshint_use_global *g:ale_javascript_jshint_use_global*
|
g:ale_javascript_jshint_use_global *g:ale_javascript_jshint_use_global*
|
||||||
@ -177,10 +142,7 @@ g:ale_javascript_jshint_use_global *g:ale_javascript_jshint_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
jshint first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of jshint, in preference to locally installed versions of
|
|
||||||
jshint in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -191,9 +153,7 @@ g:ale_javascript_standard_executable *g:ale_javascript_standard_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'standard'`
|
Default: `'standard'`
|
||||||
|
|
||||||
Same as the eslint option.
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
See: |g:ale_javascript_eslint_executable|
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_javascript_standard_options *g:ale_javascript_standard_options*
|
g:ale_javascript_standard_options *g:ale_javascript_standard_options*
|
||||||
@ -209,9 +169,7 @@ g:ale_javascript_standard_use_global *g:ale_javascript_standard_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
Same as the eslint option.
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
See: |g:ale_javascript_eslint_use_global|
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -222,9 +180,7 @@ g:ale_javascript_xo_executable *g:ale_javascript_xo_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'xo'`
|
Default: `'xo'`
|
||||||
|
|
||||||
Same as the eslint option.
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
See: |g:ale_javascript_eslint_executable|
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_javascript_xo_options *g:ale_javascript_xo_options*
|
g:ale_javascript_xo_options *g:ale_javascript_xo_options*
|
||||||
@ -240,9 +196,7 @@ g:ale_javascript_xo_use_global *g:ale_javascript_xo_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
Same as the eslint option.
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
See: |g:ale_javascript_eslint_use_global|
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -17,6 +17,33 @@ g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names*
|
|||||||
the directory containing the Python file to find virtualenv paths.
|
the directory containing the Python file to find virtualenv paths.
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
autopep8 *ale-python-autopep8*
|
||||||
|
|
||||||
|
g:ale_python_autopep8_executable *g:ale_python_autopep8_executable*
|
||||||
|
*b:ale_python_autopep8_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'autopep8'`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_python_autopep8_options *g:ale_python_autopep8_options*
|
||||||
|
*b:ale_python_autopep8_options*
|
||||||
|
Type: |String|
|
||||||
|
Default: `''`
|
||||||
|
|
||||||
|
This variable can be set to pass extra options to autopep8.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_python_autopep8_use_global *g:ale_python_autopep8_use_global*
|
||||||
|
*b:ale_python_autopep8_use_global*
|
||||||
|
Type: |Number|
|
||||||
|
Default: `0`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
flake8 *ale-python-flake8*
|
flake8 *ale-python-flake8*
|
||||||
|
|
||||||
@ -58,6 +85,25 @@ g:ale_python_flake8_use_global *g:ale_python_flake8_use_global*
|
|||||||
Both variables can be set with `b:` buffer variables instead.
|
Both variables can be set with `b:` buffer variables instead.
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
isort *ale-python-isort*
|
||||||
|
|
||||||
|
g:ale_python_isort_executable *g:ale_python_isort_executable*
|
||||||
|
*b:ale_python_isort_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'isort'`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_python_isort_use_global *g:ale_python_isort_use_global*
|
||||||
|
*b:ale_python_isort_use_global*
|
||||||
|
Type: |Number|
|
||||||
|
Default: `0`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
mypy *ale-python-mypy*
|
mypy *ale-python-mypy*
|
||||||
|
|
||||||
@ -66,7 +112,7 @@ g:ale_python_mypy_executable *g:ale_python_mypy_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'mypy'`
|
Default: `'mypy'`
|
||||||
|
|
||||||
This variable can be changed to modify the executable used for mypy.
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
g:ale_python_mypy_options *g:ale_python_mypy_options*
|
g:ale_python_mypy_options *g:ale_python_mypy_options*
|
||||||
@ -83,11 +129,7 @@ g:ale_python_mypy_use_global *g:ale_python_mypy_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for mypy in a
|
See |ale-integrations-local-executables|
|
||||||
virtualenv directory first. If this variable is set to `1`, then ALE will
|
|
||||||
always use |g:ale_python_mypy_executable| for the executable path.
|
|
||||||
|
|
||||||
Both variables can be set with `b:` buffer variables instead.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -98,7 +140,7 @@ g:ale_python_pylint_executable *g:ale_python_pylint_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'pylint'`
|
Default: `'pylint'`
|
||||||
|
|
||||||
This variable can be changed to modify the executable used for pylint.
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
g:ale_python_pylint_options *g:ale_python_pylint_options*
|
g:ale_python_pylint_options *g:ale_python_pylint_options*
|
||||||
@ -126,11 +168,26 @@ g:ale_python_pylint_use_global *g:ale_python_pylint_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for pylint in a
|
See |ale-integrations-local-executables|
|
||||||
virtualenv directory first. If this variable is set to `1`, then ALE will
|
|
||||||
always use |g:ale_python_pylint_executable| for the executable path.
|
|
||||||
|
|
||||||
Both variables can be set with `b:` buffer variables instead.
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
yapf *ale-python-yapf*
|
||||||
|
|
||||||
|
g:ale_python_yapf_executable *g:ale_python_yapf_executable*
|
||||||
|
*b:ale_python_yapf_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'yapf'`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_python_yapf_use_global *g:ale_python_yapf_use_global*
|
||||||
|
*b:ale_python_yapf_use_global*
|
||||||
|
Type: |Number|
|
||||||
|
Default: `0`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -10,11 +10,7 @@ g:ale_sass_stylelint_executable *g:ale_sass_stylelint_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'stylelint'`
|
Default: `'stylelint'`
|
||||||
|
|
||||||
ALE will first discover the stylelint path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of stylelint, set
|
|
||||||
|g:ale_sass_stylelint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_sass_stylelint_use_global *g:ale_sass_stylelint_use_global*
|
g:ale_sass_stylelint_use_global *g:ale_sass_stylelint_use_global*
|
||||||
@ -22,10 +18,7 @@ g:ale_sass_stylelint_use_global *g:ale_sass_stylelint_use_global*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
stylelint first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of stylelint, in preference to locally installed versions of
|
|
||||||
stylelint in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -10,11 +10,7 @@ g:ale_scss_stylelint_executable *g:ale_scss_stylelint_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'stylelint'`
|
Default: `'stylelint'`
|
||||||
|
|
||||||
ALE will first discover the stylelint path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of stylelint, set
|
|
||||||
|g:ale_scss_stylelint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global*
|
g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global*
|
||||||
@ -22,10 +18,7 @@ g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
stylelint first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of stylelint, in preference to locally installed versions of
|
|
||||||
stylelint in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -10,11 +10,7 @@ g:ale_typescript_tslint_executable *g:ale_typescript_tslint_executable*
|
|||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'tslint'`
|
Default: `'tslint'`
|
||||||
|
|
||||||
ALE will first discover the tslint path in an ancestor node_modules
|
See |ale-integrations-local-executables|
|
||||||
directory. If no such path exists, this variable will be used instead.
|
|
||||||
|
|
||||||
If you wish to use only a globally installed version of tslint, set
|
|
||||||
|g:ale_typescript_tslint_use_global| to `1`.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_typescript_tslint_config_path *g:ale_typescript_tslint_config_path*
|
g:ale_typescript_tslint_config_path *g:ale_typescript_tslint_config_path*
|
||||||
@ -31,10 +27,7 @@ g:ale_typescript_tslint_use_global *g:ale_typescript_tslint_use_global*
|
|||||||
Type: |Number|
|
Type: |Number|
|
||||||
Default: `0`
|
Default: `0`
|
||||||
|
|
||||||
This variable controls whether or not ALE will search for a local path for
|
See |ale-integrations-local-executables|
|
||||||
tslint first. If this variable is set to `1`, then ALE will always use the
|
|
||||||
global version of tslint, in preference to locally installed versions of
|
|
||||||
tslint in node_modules.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
27
doc/ale.txt
27
doc/ale.txt
@ -70,9 +70,12 @@ CONTENTS *ale-contents*
|
|||||||
phpcs...............................|ale-php-phpcs|
|
phpcs...............................|ale-php-phpcs|
|
||||||
phpmd...............................|ale-php-phpmd|
|
phpmd...............................|ale-php-phpmd|
|
||||||
python................................|ale-python-options|
|
python................................|ale-python-options|
|
||||||
|
autopep8............................|ale-python-autopep8|
|
||||||
flake8..............................|ale-python-flake8|
|
flake8..............................|ale-python-flake8|
|
||||||
|
isort...............................|ale-python-isort|
|
||||||
mypy................................|ale-python-mypy|
|
mypy................................|ale-python-mypy|
|
||||||
pylint..............................|ale-python-pylint|
|
pylint..............................|ale-python-pylint|
|
||||||
|
yapf................................|ale-python-yapf|
|
||||||
ruby..................................|ale-ruby-options|
|
ruby..................................|ale-ruby-options|
|
||||||
reek................................|ale-ruby-reek|
|
reek................................|ale-ruby-reek|
|
||||||
rubocop.............................|ale-ruby-rubocop|
|
rubocop.............................|ale-ruby-rubocop|
|
||||||
@ -177,7 +180,7 @@ The following languages and tools are supported.
|
|||||||
* Pod: 'proselint'
|
* Pod: 'proselint'
|
||||||
* Pug: 'pug-lint'
|
* Pug: 'pug-lint'
|
||||||
* Puppet: 'puppet', 'puppet-lint'
|
* Puppet: 'puppet', 'puppet-lint'
|
||||||
* Python: 'flake8', 'mypy', 'pylint'
|
* Python: 'autopep8', 'flake8', 'isort', 'mypy', 'pylint', 'yapf'
|
||||||
* ReasonML: 'merlin'
|
* ReasonML: 'merlin'
|
||||||
* reStructuredText: 'proselint'
|
* reStructuredText: 'proselint'
|
||||||
* RPM spec: 'spec'
|
* RPM spec: 'spec'
|
||||||
@ -871,6 +874,28 @@ Every option for programs can be set globally, or individually for each
|
|||||||
buffer. For example, `b:ale_python_flake8_executable` will override any
|
buffer. For example, `b:ale_python_flake8_executable` will override any
|
||||||
values set for `g:ale_python_flake8_executable`.
|
values set for `g:ale_python_flake8_executable`.
|
||||||
|
|
||||||
|
*ale-integrations-local-executables*
|
||||||
|
|
||||||
|
Some tools will prefer to search for locally-installed executables, unless
|
||||||
|
configured otherwise. For example, the `eslint` linter will search for
|
||||||
|
various executable paths in `node_modules`. The `flake8` linter will search
|
||||||
|
for virtualenv directories.
|
||||||
|
|
||||||
|
If you prefer to use global executables for those tools, set the relevant
|
||||||
|
`_use_global` and `_executable` options for those linters. >
|
||||||
|
|
||||||
|
" Use the global executable with a special name for eslint.
|
||||||
|
let g:ale_javascript_eslint_executable = 'special-eslint'
|
||||||
|
let g:ale_javascript_eslint_use_global = 1
|
||||||
|
|
||||||
|
" Use the global executable with a special name for flake8.
|
||||||
|
let g:ale_python_flake8_executable = '/foo/bar/flake8'
|
||||||
|
let g:ale_python_flake8_use_global = 1
|
||||||
|
<
|
||||||
|
|
||||||
|
The option |g:ale_virtualenv_dir_names| controls the local virtualenv paths
|
||||||
|
ALE will use to search for Python executables.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
6. Commands/Keybinds *ale-commands*
|
6. Commands/Keybinds *ale-commands*
|
||||||
|
39
test/fixers/test_autopep8_fixer_callback.vader
Normal file
39
test/fixers/test_autopep8_fixer_callback.vader
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_python_autopep8_executable
|
||||||
|
Save g:ale_python_autopep8_options
|
||||||
|
|
||||||
|
" Use an invalid global executable, so we don't match it.
|
||||||
|
let g:ale_python_autopep8_executable = 'xxxinvalid'
|
||||||
|
let g:ale_python_autopep8_options = ''
|
||||||
|
|
||||||
|
silent! execute 'cd /testplugin/test/command_callback'
|
||||||
|
silent cd ..
|
||||||
|
silent cd command_callback
|
||||||
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
silent execute 'cd ' . fnameescape(g:dir)
|
||||||
|
" Set the file to something else,
|
||||||
|
" or we'll cause issues when running other tests
|
||||||
|
silent file 'dummy.py'
|
||||||
|
unlet! g:dir
|
||||||
|
|
||||||
|
Execute(The autopep8 callback should return the correct default values):
|
||||||
|
AssertEqual
|
||||||
|
\ 0,
|
||||||
|
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||||
|
|
||||||
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
|
AssertEqual
|
||||||
|
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/autopep8' -" },
|
||||||
|
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||||
|
|
||||||
|
Execute(The autopep8 callback should include options):
|
||||||
|
let g:ale_python_autopep8_options = '--some-option'
|
||||||
|
|
||||||
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
|
AssertEqual
|
||||||
|
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/autopep8' --some-option -" },
|
||||||
|
\ ale#fixers#autopep8#Fix(bufnr(''))
|
29
test/fixers/test_isort_fixer_callback.vader
Normal file
29
test/fixers/test_isort_fixer_callback.vader
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_python_isort_executable
|
||||||
|
|
||||||
|
" Use an invalid global executable, so we don't match it.
|
||||||
|
let g:ale_python_isort_executable = 'xxxinvalid'
|
||||||
|
|
||||||
|
silent! execute 'cd /testplugin/test/command_callback'
|
||||||
|
silent cd ..
|
||||||
|
silent cd command_callback
|
||||||
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
silent execute 'cd ' . fnameescape(g:dir)
|
||||||
|
" Set the file to something else,
|
||||||
|
" or we'll cause issues when running other tests
|
||||||
|
silent file 'dummy.py'
|
||||||
|
unlet! g:dir
|
||||||
|
|
||||||
|
Execute(The isort callback should return the correct default values):
|
||||||
|
AssertEqual
|
||||||
|
\ 0,
|
||||||
|
\ ale#fixers#isort#Fix(bufnr(''))
|
||||||
|
|
||||||
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
|
AssertEqual
|
||||||
|
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/isort' -" },
|
||||||
|
\ ale#fixers#isort#Fix(bufnr(''))
|
@ -1,58 +0,0 @@
|
|||||||
Before:
|
|
||||||
silent! execute 'cd /testplugin/test/command_callback'
|
|
||||||
let g:dir = getcwd()
|
|
||||||
|
|
||||||
After:
|
|
||||||
" Set the file to something else,
|
|
||||||
" or we'll cause issues when running other tests
|
|
||||||
silent file 'dummy.py'
|
|
||||||
unlet! g:dir
|
|
||||||
|
|
||||||
Execute(The python GetExecutable callbacks should return the correct path):
|
|
||||||
AssertEqual
|
|
||||||
\ '',
|
|
||||||
\ ale#python#GetExecutable(bufnr(''), 'isort')
|
|
||||||
|
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
||||||
AssertEqual
|
|
||||||
\ g:dir . '/python_paths/with_virtualenv/env/bin/isort',
|
|
||||||
\ ale#python#GetExecutable(bufnr(''), 'isort')
|
|
||||||
AssertEqual
|
|
||||||
\ g:dir . '/python_paths/with_virtualenv/env/bin/autopep8',
|
|
||||||
\ ale#python#GetExecutable(bufnr(''), 'autopep8')
|
|
||||||
AssertEqual
|
|
||||||
\ g:dir . '/python_paths/with_virtualenv/env/bin/yapf',
|
|
||||||
\ ale#python#GetExecutable(bufnr(''), 'yapf')
|
|
||||||
|
|
||||||
|
|
||||||
Execute(The autopep8 callbacks should return the correct default values):
|
|
||||||
AssertEqual
|
|
||||||
\ 0,
|
|
||||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
|
||||||
|
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
||||||
AssertEqual
|
|
||||||
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/autopep8' -" },
|
|
||||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
|
||||||
|
|
||||||
|
|
||||||
Execute(The isort callbacks should return the correct default values):
|
|
||||||
AssertEqual
|
|
||||||
\ 0,
|
|
||||||
\ ale#fixers#isort#Fix(bufnr(''))
|
|
||||||
|
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
||||||
AssertEqual
|
|
||||||
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/isort' -" },
|
|
||||||
\ ale#fixers#isort#Fix(bufnr(''))
|
|
||||||
|
|
||||||
|
|
||||||
Execute(The yapf callbacks should return the correct default values):
|
|
||||||
AssertEqual
|
|
||||||
\ 0,
|
|
||||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
|
||||||
|
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
|
||||||
AssertEqual
|
|
||||||
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/yapf' --no-local-style" },
|
|
||||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
|
29
test/fixers/test_yapf_fixer_callback.vader
Normal file
29
test/fixers/test_yapf_fixer_callback.vader
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_python_yapf_executable
|
||||||
|
|
||||||
|
" Use an invalid global executable, so we don't match it.
|
||||||
|
let g:ale_python_yapf_executable = 'xxxinvalid'
|
||||||
|
|
||||||
|
silent! execute 'cd /testplugin/test/command_callback'
|
||||||
|
silent cd ..
|
||||||
|
silent cd command_callback
|
||||||
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
silent execute 'cd ' . fnameescape(g:dir)
|
||||||
|
" Set the file to something else,
|
||||||
|
" or we'll cause issues when running other tests
|
||||||
|
silent file 'dummy.py'
|
||||||
|
unlet! g:dir
|
||||||
|
|
||||||
|
Execute(The yapf callback should return the correct default values):
|
||||||
|
AssertEqual
|
||||||
|
\ 0,
|
||||||
|
\ ale#fixers#yapf#Fix(bufnr(''))
|
||||||
|
|
||||||
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
|
AssertEqual
|
||||||
|
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/yapf' --no-local-style" },
|
||||||
|
\ ale#fixers#yapf#Fix(bufnr(''))
|
Loading…
Reference in New Issue
Block a user