summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/report-a-bug.md5
-rw-r--r--README.md4
-rw-r--r--ale_linters/java/javalsp.vim6
-rw-r--r--ale_linters/python/pydocstyle.vim74
-rw-r--r--ale_linters/sass/sasslint.vim27
-rw-r--r--ale_linters/scala/scalac.vim2
-rw-r--r--ale_linters/scss/sasslint.vim28
-rw-r--r--autoload/ale/handlers/sasslint.vim8
-rw-r--r--doc/ale-java.txt12
-rw-r--r--doc/ale-python.txt40
-rw-r--r--doc/ale-sass.txt6
-rw-r--r--doc/ale-scss.txt27
-rw-r--r--doc/ale.txt5
-rwxr-xr-xtest/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint0
-rwxr-xr-xtest/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js0
-rw-r--r--test/command_callback/test_javalsp_command_callback.vader6
-rw-r--r--test/command_callback/test_pydocstyle_command_callback.vader39
-rw-r--r--test/command_callback/test_sass_sasslint_command_callback.vader43
-rw-r--r--test/command_callback/test_sasslint_command_callback.vader11
-rw-r--r--test/command_callback/test_scalac_command_callback.vader2
-rw-r--r--test/command_callback/test_scss_sasslint_command_callback.vader43
-rw-r--r--test/handler/test_pydocstyle_handler.vader116
22 files changed, 459 insertions, 45 deletions
diff --git a/.github/ISSUE_TEMPLATE/report-a-bug.md b/.github/ISSUE_TEMPLATE/report-a-bug.md
index e617893f..6d345c4a 100644
--- a/.github/ISSUE_TEMPLATE/report-a-bug.md
+++ b/.github/ISSUE_TEMPLATE/report-a-bug.md
@@ -27,8 +27,9 @@ Operating System: <!-- Describe your operating system version. -->
<!-- Describe what went wrong here. Be specific. -->
-Something went wrong in specifically this place, and I also searched through
-both open and closed issues for the same problem before reporting a bug here.
+Something went wrong in specifically this place, and I also searched through both open and closed issues for the same problem before reporting a bug here.
+
+Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](https://vi.stackexchange.com/) or perhaps on [Reddit](https://www.reddit.com/r/vim/) instead. The GitHub issue tracker should be used for reporting bugs or asking for new features.
## Reproducing the bug
diff --git a/README.md b/README.md
index 7a8196f3..5fcca8c7 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Asynchronous Lint Engine [![Travis CI Build Status](https://travis-ci.org/w0rp/ale.svg?branch=master)](https://travis-ci.org/w0rp/ale) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/w0rp/ale)
+# Asynchronous Lint Engine [![Travis CI Build Status](https://travis-ci.org/w0rp/ale.svg?branch=master)](https://travis-ci.org/w0rp/ale) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/w0rp/ale) [![Join the chat at https://gitter.im/vim-ale/Lobby](https://badges.gitter.im/vim-ale/Lobby.svg)](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
![ALE Logo by Mark Grealish - https://www.bhalash.com/](img/logo.jpg?raw=true)
@@ -175,7 +175,7 @@ formatting.
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
| Puppet | [languageserver](https://github.com/lingua-pupuli/puppet-editor-services), [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
-| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](https://github.com/PyCQA/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pyre](https://github.com/facebook/pyre-check), [pylint](https://www.pylint.org/) !!, [vulture](https://github.com/jendrikseipp/vulture) !!, [yapf](https://github.com/google/yapf) |
+| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](https://github.com/PyCQA/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pydocstyle](https://www.pydocstyle.org/), [pyls](https://github.com/palantir/python-language-server), [pyre](https://github.com/facebook/pyre-check), [pylint](https://www.pylint.org/) !!, [vulture](https://github.com/jendrikseipp/vulture) !!, [yapf](https://github.com/google/yapf) |
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
| R | [lintr](https://github.com/jimhester/lintr) |
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
diff --git a/ale_linters/java/javalsp.vim b/ale_linters/java/javalsp.vim
index 5d1a0c63..1436a52c 100644
--- a/ale_linters/java/javalsp.vim
+++ b/ale_linters/java/javalsp.vim
@@ -2,15 +2,17 @@
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
call ale#Set('java_javalsp_jar', 'javacs.jar')
+call ale#Set('java_javalsp_executable', 'java')
function! ale_linters#java#javalsp#Executable(buffer) abort
- return 'java'
+ return ale#Var(a:buffer, 'java_javalsp_executable')
endfunction
function! ale_linters#java#javalsp#Command(buffer) abort
let l:jar = ale#Var(a:buffer, 'java_javalsp_jar')
+ let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
- return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main')
+ return ale#Escape(l:executable) . ' -cp ' . l:jar . ' -Xverify:none org.javacs.Main'
endfunction
call ale#linter#Define('java', {
diff --git a/ale_linters/python/pydocstyle.vim b/ale_linters/python/pydocstyle.vim
new file mode 100644
index 00000000..ebf92bf1
--- /dev/null
+++ b/ale_linters/python/pydocstyle.vim
@@ -0,0 +1,74 @@
+" Author: Pablo Acosta <pmasdev@gmail.com>
+" Description: pydocstyle for python files
+
+call ale#Set('python_pydocstyle_executable', 'pydocstyle')
+call ale#Set('python_pydocstyle_options', '')
+call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('python_pydocstyle_auto_pipenv', 0)
+
+function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
+ if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv'))
+ \ && ale#python#PipenvPresent(a:buffer)
+ return 'pipenv'
+ endif
+
+ return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
+endfunction
+
+function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
+ let l:dir = fnamemodify(bufname(a:buffer), ':p:h')
+ let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
+
+ let l:exec_args = l:executable =~? 'pipenv$'
+ \ ? ' run pydocstyle'
+ \ : ''
+
+ return ale#path#CdString(l:dir)
+ \ . ale#Escape(l:executable) . l:exec_args
+ \ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options')
+ \ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
+endfunction
+
+function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort
+ " Matches patterns like the following:
+ " mydir/myfile.py:33 in public function `myfunction`:
+ " DXXX: Error description
+ let l:fname = ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
+ let l:line1_pattern = '\v^' . l:fname . ':\s*(\d+)\s+.*$'
+ let l:line2_pattern = '\v^.*([a-zA-Z]\d+):\s*(.*)$'
+ let l:output = []
+
+ let l:num_lines = len(a:lines)
+ let l:index = 0
+
+ while l:index < l:num_lines
+ let l:lnum = matchlist(a:lines[l:index], l:line1_pattern)
+
+ if !empty(l:lnum) && (l:index + 1 < l:num_lines)
+ let l:desc = matchlist(a:lines[l:index + 1], l:line2_pattern)
+
+ if !empty(l:desc)
+ call add(l:output, {
+ \ 'lnum': l:lnum[1] + 0,
+ \ 'col': 1,
+ \ 'type': 'W',
+ \ 'text': l:desc[2],
+ \ 'code': l:desc[1],
+ \})
+ endif
+
+ let l:index = l:index + 2
+ else
+ let l:index = l:index + 1
+ endif
+ endwhile
+
+ return l:output
+endfunction
+
+call ale#linter#Define('python', {
+\ 'name': 'pydocstyle',
+\ 'executable_callback': 'ale_linters#python#pydocstyle#GetExecutable',
+\ 'command_callback': 'ale_linters#python#pydocstyle#GetCommand',
+\ 'callback': 'ale_linters#python#pydocstyle#Handle',
+\})
diff --git a/ale_linters/sass/sasslint.vim b/ale_linters/sass/sasslint.vim
index 4df56dfd..8d24185d 100644
--- a/ale_linters/sass/sasslint.vim
+++ b/ale_linters/sass/sasslint.vim
@@ -1,9 +1,28 @@
-" Author: KabbAmine - https://github.com/KabbAmine,
-" Ben Falconer <ben@falconers.me.uk>
+" Author: sQVe - https://github.com/sQVe
+
+call ale#Set('sass_sasslint_executable', 'sass-lint')
+call ale#Set('sass_sasslint_options', '')
+call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))
+
+function! ale_linters#sass#sasslint#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'sass_sasslint', [
+ \ 'node_modules/sass-lint/bin/sass-lint.js',
+ \ 'node_modules/.bin/sass-lint',
+ \])
+endfunction
+
+function! ale_linters#sass#sasslint#GetCommand(buffer) abort
+ let l:executable = ale_linters#sass#sasslint#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
+
+ return ale#node#Executable(a:buffer, l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' -v -q -f compact %t'
+endfunction
call ale#linter#Define('sass', {
\ 'name': 'sasslint',
-\ 'executable': 'sass-lint',
-\ 'command_callback': 'ale#handlers#sasslint#GetCommand',
+\ 'executable_callback': 'ale_linters#sass#sasslint#GetExecutable',
+\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})
diff --git a/ale_linters/scala/scalac.vim b/ale_linters/scala/scalac.vim
index ba105927..3dbdd925 100644
--- a/ale_linters/scala/scalac.vim
+++ b/ale_linters/scala/scalac.vim
@@ -9,7 +9,7 @@ endfunction
call ale#linter#Define('scala', {
\ 'name': 'scalac',
\ 'executable_callback': {buf -> s:IsSbt(buf) ? '' : 'scalac'},
-\ 'command': '%e -Ystop-before:jvm %t',
+\ 'command': '%e -Ystop-after:parser %t',
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
\ 'output_stream': 'stderr',
\})
diff --git a/ale_linters/scss/sasslint.vim b/ale_linters/scss/sasslint.vim
index f6075001..8b725ba6 100644
--- a/ale_linters/scss/sasslint.vim
+++ b/ale_linters/scss/sasslint.vim
@@ -1,18 +1,28 @@
-" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
-" <ben@falconers.me.uk>
+" Author: sQVe - https://github.com/sQVe
+
+call ale#Set('scss_sasslint_executable', 'sass-lint')
+call ale#Set('scss_sasslint_options', '')
+call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))
+
+function! ale_linters#scss#sasslint#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'scss_sasslint', [
+ \ 'node_modules/sass-lint/bin/sass-lint.js',
+ \ 'node_modules/.bin/sass-lint',
+ \])
+endfunction
function! ale_linters#scss#sasslint#GetCommand(buffer) abort
- return ale#path#BufferCdString(a:buffer)
- \ . ale#Escape('sass-lint')
- \ . ' -v'
- \ . ' -q'
- \ . ' -f compact'
- \ . ' %t'
+ let l:executable = ale_linters#scss#sasslint#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'scss_sasslint_options')
+
+ return ale#node#Executable(a:buffer, l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' -v -q -f compact %t'
endfunction
call ale#linter#Define('scss', {
\ 'name': 'sasslint',
-\ 'executable': 'sass-lint',
+\ 'executable_callback': 'ale_linters#scss#sasslint#GetExecutable',
\ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})
diff --git a/autoload/ale/handlers/sasslint.vim b/autoload/ale/handlers/sasslint.vim
deleted file mode 100644
index 399bf47c..00000000
--- a/autoload/ale/handlers/sasslint.vim
+++ /dev/null
@@ -1,8 +0,0 @@
-" Author: KabbAmine - https://github.com/KabbAmine,
-" Ben Falconer <ben@falconers.me.uk>
-
-function! ale#handlers#sasslint#GetCommand(buffer) abort
- return ale#path#BufferCdString(a:buffer)
- \ . ale#Escape('sass-lint')
- \ . ' -v -q -f compact %t'
-endfunction
diff --git a/doc/ale-java.txt b/doc/ale-java.txt
index 7bba12a3..8e40aea0 100644
--- a/doc/ale-java.txt
+++ b/doc/ale-java.txt
@@ -88,14 +88,20 @@ This generates a out/fat-jar.jar file that contains the language server. To
let ALE use this language server you need to set the g:ale_java_javalsp_jar
variable to the absolute path of this jar file.
+g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
+ *b:ale_java_javalsp_executable*
+ Type: |String|
+ Default: `'java'`
+
+This variable can be changed to use a different executable for java.
+
g:ale_java_javalsp_jar *g:ale_java_javalsp_jar*
*b:ale_java_javalsp_jar*
- Type: String
- Default: 'fat-jar.jar
+ Type: |String|
+ Default: `'fat-jar.jar'`
Path to the location of the vscode-javac language server plugin.
- and -d. They are added automatically.
===============================================================================
diff --git a/doc/ale-python.txt b/doc/ale-python.txt
index 0b8e1746..f3f2801a 100644
--- a/doc/ale-python.txt
+++ b/doc/ale-python.txt
@@ -329,6 +329,46 @@ g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv*
===============================================================================
+pydocstyle *ale-python-pydocstyle*
+
+
+g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable*
+ *b:ale_python_pydocstyle_executable*
+ Type: |String|
+ Default: `'pydocstyle'`
+
+ See |ale-integrations-local-executables|
+
+ Set this to `'pipenv'` to invoke `'pipenv` `run` `pydocstyle'`.
+
+
+g:ale_python_pydocstyle_options *g:ale_python_pydocstyle_options*
+ *b:ale_python_pydocstyle_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be changed to add command-line arguments to the
+ pydocstyle invocation.
+
+
+g:ale_python_pydocstyle_use_global *g:ale_python_pydocstyle_use_global*
+ *b:ale_python_pydocstyle_use_global*
+ Type: |Number|
+ Default: `get(g:, 'ale_use_global_executables', 0)`
+
+ See |ale-integrations-local-executables|
+
+
+g:ale_python_pydocstyle_auto_pipenv *g:ale_python_pydocstyle_auto_pipenv*
+ *b:ale_python_pydocstyle_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+===============================================================================
pyflakes *ale-python-pyflakes*
diff --git a/doc/ale-sass.txt b/doc/ale-sass.txt
index 08e9a381..735f44b2 100644
--- a/doc/ale-sass.txt
+++ b/doc/ale-sass.txt
@@ -3,6 +3,12 @@ ALE SASS Integration *ale-sass-options*
===============================================================================
+sasslint *ale-sass-sasslint*
+
+See |ale-scss-sasslint| for information about the available options.
+
+
+===============================================================================
stylelint *ale-sass-stylelint*
g:ale_sass_stylelint_executable *g:ale_sass_stylelint_executable*
diff --git a/doc/ale-scss.txt b/doc/ale-scss.txt
index 3ad84fc1..07a94fe1 100644
--- a/doc/ale-scss.txt
+++ b/doc/ale-scss.txt
@@ -9,6 +9,33 @@ See |ale-javascript-prettier| for information about the available options.
===============================================================================
+sasslint *ale-scss-sasslint*
+
+g:ale_scss_sasslint_executable *g:ale_scss_sasslint_executable*
+ *b:ale_scss_sasslint_executable*
+ Type: |String|
+ Default: `'sass-lint'`
+
+ See |ale-integrations-local-executables|
+
+
+g:ale_scss_sasslint_options *g:ale_scss_sasslint_options*
+ *b:ale_scss_sasslint_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be set to pass additional options to sass-lint.
+
+
+g:ale_scss_sasslint_use_global *g:ale_scss_sasslint_use_global*
+ *b:ale_scss_sasslint_use_global*
+ Type: |Number|
+ Default: `get(g:, 'ale_use_global_executables', 0)`
+
+ See |ale-integrations-local-executables|
+
+
+===============================================================================
stylelint *ale-scss-stylelint*
g:ale_scss_stylelint_executable *g:ale_scss_stylelint_executable*
diff --git a/doc/ale.txt b/doc/ale.txt
index 48d7bc13..68d685d9 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -260,6 +260,7 @@ CONTENTS *ale-contents*
mypy................................|ale-python-mypy|
prospector..........................|ale-python-prospector|
pycodestyle.........................|ale-python-pycodestyle|
+ pydocstyle..........................|ale-python-pydocstyle|
pyflakes............................|ale-python-pyflakes|
pylint..............................|ale-python-pylint|
pyls................................|ale-python-pyls|
@@ -290,6 +291,7 @@ CONTENTS *ale-contents*
rustc...............................|ale-rust-rustc|
rustfmt.............................|ale-rust-rustfmt|
sass..................................|ale-sass-options|
+ sasslint............................|ale-sass-sasslint|
stylelint...........................|ale-sass-stylelint|
scala.................................|ale-scala-options|
sbtserver...........................|ale-scala-sbtserver|
@@ -297,6 +299,7 @@ CONTENTS *ale-contents*
scalastyle..........................|ale-scala-scalastyle|
scss..................................|ale-scss-options|
prettier............................|ale-scss-prettier|
+ sasslint............................|ale-scss-sasslint|
stylelint...........................|ale-scss-stylelint|
sh....................................|ale-sh-options|
sh-language-server..................|ale-sh-language-server|
@@ -476,7 +479,7 @@ Notes:
* proto: `protoc-gen-lint`
* Pug: `pug-lint`
* Puppet: `languageserver`, `puppet`, `puppet-lint`
-* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pyre`, `pylint`!!, `vulture`!!, `yapf`
+* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pydocstyle`, `pyls`, `pyre`, `pylint`!!, `vulture`!!, `yapf`
* QML: `qmlfmt`, `qmllint`
* R: `lintr`
* ReasonML: `merlin`, `ols`, `refmt`
diff --git a/test/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint b/test/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint
diff --git a/test/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js b/test/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js
diff --git a/test/command_callback/test_javalsp_command_callback.vader b/test/command_callback/test_javalsp_command_callback.vader
index 1fbfddfb..aedb4a4b 100644
--- a/test/command_callback/test_javalsp_command_callback.vader
+++ b/test/command_callback/test_javalsp_command_callback.vader
@@ -6,5 +6,9 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The javalsp callback should return the correct default value):
- AssertLinter 'java', ale#Escape('java -cp javacs.jar -Xverify:none org.javacs.Main')
+ AssertLinter 'java', ale#Escape('java') . ' -cp javacs.jar -Xverify:none org.javacs.Main'
+Execute(The javalsp java executable should be configurable):
+ let b:ale_java_javalsp_executable = '/bin/foobar'
+
+ AssertLinter '/bin/foobar', ale#Escape('/bin/foobar') . ' -cp javacs.jar -Xverify:none org.javacs.Main'
diff --git a/test/command_callback/test_pydocstyle_command_callback.vader b/test/command_callback/test_pydocstyle_command_callback.vader
new file mode 100644
index 00000000..7e0df9ca
--- /dev/null
+++ b/test/command_callback/test_pydocstyle_command_callback.vader
@@ -0,0 +1,39 @@
+Before:
+ call ale#assert#SetUpLinterTest('python', 'pydocstyle')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The pydocstyle command callback should return default string):
+ AssertLinter 'pydocstyle',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('pydocstyle') . ' ' . ale#Escape('dummy.txt')
+
+Execute(The pydocstyle command callback should allow options):
+ let g:ale_python_pydocstyle_options = '--verbose'
+
+ AssertLinter 'pydocstyle',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('pydocstyle') . ' --verbose ' . ale#Escape('dummy.txt')
+
+Execute(The pydocstyle executable should be configurable):
+ let g:ale_python_pydocstyle_executable = '~/.local/bin/pydocstyle'
+
+ AssertLinter '~/.local/bin/pydocstyle',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('~/.local/bin/pydocstyle') . ' ' . ale#Escape('dummy.txt')
+
+Execute(Setting executable to 'pipenv' appends 'run pydocstyle'):
+ let g:ale_python_pydocstyle_executable = 'path/to/pipenv'
+
+ AssertLinter 'path/to/pipenv',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('path/to/pipenv') . ' run pydocstyle ' . ale#Escape('dummy.txt')
+
+Execute(Pipenv is detected when python_pydocstyle_auto_pipenv is set):
+ let g:ale_python_pydocstyle_auto_pipenv = 1
+ call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
+
+ AssertLinter 'pipenv',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('pipenv') . ' run pydocstyle ' . ale#Escape('whatever.py')
diff --git a/test/command_callback/test_sass_sasslint_command_callback.vader b/test/command_callback/test_sass_sasslint_command_callback.vader
new file mode 100644
index 00000000..9b9bf906
--- /dev/null
+++ b/test/command_callback/test_sass_sasslint_command_callback.vader
@@ -0,0 +1,43 @@
+Before:
+ call ale#assert#SetUpLinterTest('sass', 'sasslint')
+ call ale#test#SetFilename('test.sass')
+ unlet! b:executable
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(should default to source, bin/sass-lint.js):
+ call ale#test#SetFilename('sasslint-test-files/with-source/test.sass')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js'
+ \)
+
+ AssertLinter b:executable,
+ \ (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(b:executable)
+ \ . ' -v -q -f compact %t'
+
+Execute(should fallback to bin, .bin/sass-lint):
+ call ale#test#SetFilename('sasslint-test-files/with-bin/test.sass')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-bin/node_modules/.bin/sass-lint'
+ \)
+
+ AssertLinter b:executable, ale#Escape(b:executable) . ' -v -q -f compact %t'
+
+Execute(should fallback to global bin):
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' -v -q -f compact %t'
+
+Execute(The global executable should be configurable):
+ let b:ale_sass_sasslint_executable = 'foo'
+
+ AssertLinter 'foo', ale#Escape('foo') . ' -v -q -f compact %t'
+
+Execute(The options should be configurable):
+ let b:ale_sass_sasslint_options = '--bar'
+
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' --bar -v -q -f compact %t'
diff --git a/test/command_callback/test_sasslint_command_callback.vader b/test/command_callback/test_sasslint_command_callback.vader
deleted file mode 100644
index 9142c441..00000000
--- a/test/command_callback/test_sasslint_command_callback.vader
+++ /dev/null
@@ -1,11 +0,0 @@
-Before:
- call ale#assert#SetUpLinterTest('sass', 'sasslint')
- call ale#test#SetFilename('test.sass')
-
-After:
- call ale#assert#TearDownLinterTest()
-
-Execute(The default sasslint command should be correct):
- AssertLinter 'sass-lint',
- \ ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape('sass-lint') . ' -v -q -f compact %t'
diff --git a/test/command_callback/test_scalac_command_callback.vader b/test/command_callback/test_scalac_command_callback.vader
index 5184aa0b..ea5ae109 100644
--- a/test/command_callback/test_scalac_command_callback.vader
+++ b/test/command_callback/test_scalac_command_callback.vader
@@ -6,7 +6,7 @@ After:
Given scala(An empty Scala file):
Execute(The default executable and command should be correct):
- AssertLinter 'scalac', ale#Escape('scalac') . ' -Ystop-before:jvm %t'
+ AssertLinter 'scalac', ale#Escape('scalac') . ' -Ystop-after:parser %t'
Given scala.sbt(An empty SBT file):
Execute(scalac should not be run for sbt files):
diff --git a/test/command_callback/test_scss_sasslint_command_callback.vader b/test/command_callback/test_scss_sasslint_command_callback.vader
new file mode 100644
index 00000000..1695190a
--- /dev/null
+++ b/test/command_callback/test_scss_sasslint_command_callback.vader
@@ -0,0 +1,43 @@
+Before:
+ call ale#assert#SetUpLinterTest('scss', 'sasslint')
+ call ale#test#SetFilename('test.scss')
+ unlet! b:executable
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(should default to source, bin/sass-lint.js):
+ call ale#test#SetFilename('sasslint-test-files/with-source/test.scss')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js'
+ \)
+
+ AssertLinter b:executable,
+ \ (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(b:executable)
+ \ . ' -v -q -f compact %t'
+
+Execute(should fallback to bin, .bin/sass-lint):
+ call ale#test#SetFilename('sasslint-test-files/with-bin/test.scss')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-bin/node_modules/.bin/sass-lint'
+ \)
+
+ AssertLinter b:executable, ale#Escape(b:executable) . ' -v -q -f compact %t'
+
+Execute(should fallback to global bin):
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' -v -q -f compact %t'
+
+Execute(The global executable should be configurable):
+ let b:ale_scss_sasslint_executable = 'foo'
+
+ AssertLinter 'foo', ale#Escape('foo') . ' -v -q -f compact %t'
+
+Execute(The options should be configurable):
+ let b:ale_scss_sasslint_options = '--bar'
+
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' --bar -v -q -f compact %t'
diff --git a/test/handler/test_pydocstyle_handler.vader b/test/handler/test_pydocstyle_handler.vader
new file mode 100644
index 00000000..d155dc9a
--- /dev/null
+++ b/test/handler/test_pydocstyle_handler.vader
@@ -0,0 +1,116 @@
+Before:
+ Save g:ale_warn_about_trailing_whitespace
+
+ let g:ale_warn_about_trailing_whitespace = 1
+
+ runtime ale_linters/python/pydocstyle.vim
+
+After:
+ Restore
+
+ call ale#linter#Reset()
+
+ silent file something_else.py
+
+" File sample.py
+" # sample.py file
+"
+" def main():
+" """
+" This is a multi-line description that should produce multiple errors to be
+" tested by the handler
+" """
+" return Fales
+"
+"
+" if __name__ == '__main__':
+" main()
+"
+" The command to generate the handler input is:
+"
+" $ python -m pydocstyle --verbose --source --explain sample.py
+" [...]
+" $
+
+Execute(Basic pydocstyle warnings should be handled):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'text': 'Missing docstring in public module',
+ \ 'code': 'D100',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 4,
+ \ 'col': 1,
+ \ 'text': '1 blank line required between summary line and description (found 0)',
+ \ 'code': 'D205',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 4,
+ \ 'col': 1,
+ \ 'text': 'First line should end with a period (not ''e'')',
+ \ 'code': 'D400',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 4,
+ \ 'col': 1,
+ \ 'text': 'First line should be in imperative mood; try rephrasing (found ''This'')',
+ \ 'code': 'D401',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#python#pydocstyle#Handle(bufnr(''), [
+ \ 'Checking file ' . fnamemodify(bufname(bufnr('')), ':p') . '.',
+ \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':1 at module level:',
+ \ ' D100: Missing docstring in public module',
+ \ '',
+ \ ' All modules should normally have docstrings. [...] all functions and',
+ \ ' classes exported by a module should also have docstrings. Public',
+ \ ' methods (including the __init__ constructor) should also have',
+ \ ' docstrings.',
+ \ ' Note: Public (exported) definitions are either those with names listed',
+ \ ' in __all__ variable (if present), or those that do not start',
+ \ ' with a single underscore.',
+ \ '',
+ \ ' 1: # 2: 3: s 4: a 5: m 6: p 7: l ...',
+ \ '',
+ \ '',
+ \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:',
+ \ ' D205: 1 blank line required between summary line and description (found 0)',
+ \ '',
+ \ ' Multi-line docstrings consist of a summary line just like a one-line',
+ \ ' docstring, followed by a blank line, followed by a more elaborate',
+ \ ' description. The summary line may be used by automatic indexing tools;',
+ \ ' it is important that it fits on one line and is separated from the',
+ \ ' rest of the docstring by a blank line.',
+ \ '',
+ \ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...',
+ \ '',
+ \ '',
+ \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:',
+ \ ' D400: First line should end with a period (not ''e'')',
+ \ '',
+ \ ' The [first line of a] docstring is a phrase ending in a period.',
+ \ '',
+ \ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...',
+ \ '',
+ \ '',
+ \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:',
+ \ ' D401: First line should be in imperative mood; try rephrasing (found ''This'')',
+ \ '',
+ \ ' [Docstring] prescribes the function or method''s effect as a command:',
+ \ ' ("Do this", "Return that"), not as a description; e.g. don''t write',
+ \ ' "Returns the pathname ...".',
+ \ '',
+ \ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...',
+ \ ])
+
+Execute(Handler should handle empty output):
+ AssertEqual
+ \ [],
+ \ ale_linters#python#pydocstyle#Handle(bufnr(''), [])