summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ISSUE_TEMPLATE.md32
-rw-r--r--README.md6
-rw-r--r--ale_linters/ansible/ansible_lint.vim2
-rw-r--r--ale_linters/rust/cargo.vim2
-rw-r--r--ale_linters/solidity/solhint.vim30
-rw-r--r--ale_linters/typescript/tslint.vim8
-rw-r--r--autoload/ale/fix/registry.vim10
-rw-r--r--autoload/ale/fixers/brittany.vim15
-rw-r--r--autoload/ale/fixers/goimports.vim2
-rw-r--r--autoload/ale/fixers/google_java_format.vim23
-rw-r--r--autoload/ale/highlight.vim10
-rw-r--r--doc/ale-haskell.txt10
-rw-r--r--doc/ale-java.txt19
-rw-r--r--doc/ale-rust.txt2
-rw-r--r--doc/ale-solidity.txt8
-rw-r--r--doc/ale.txt9
-rwxr-xr-xrun-tests45
-rw-r--r--test/command_callback/test_cargo_command_callbacks.vader14
-rw-r--r--test/fixers/test_brittany_fixer_callback.vader23
-rw-r--r--test/fixers/test_goimports_fixer_callback.vader4
-rw-r--r--test/fixers/test_goofle_java_format_fixer_callback.vader27
-rw-r--r--test/handler/test_ansible_lint_handler.vader20
-rw-r--r--test/handler/test_solhint_handler.vader60
-rw-r--r--test/handler/test_tslint_handler.vader30
-rwxr-xr-xtest/script/run-vader-tests18
25 files changed, 377 insertions, 52 deletions
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index 45d5350a..0276a659 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -1,8 +1,28 @@
<!--
-For bugs, paste output from your clipboard after running :ALEInfoToClipboard
-here. If that doesn't work for some reason, try running :ALEInfo and copying
-the output from that here instead. If everything is broken, run around in
-circles and scream.
-
-Whatever the case, describe the your issue here.
+ This is a template for bug reports. If you want to request a new feature,
+ you can clear this entire form field and write a short description of what
+ you want.
-->
+
+## Information
+
+**VIM version**
+
+PASTE JUST THE FIRST TWO LINES OF `:version` HERE.
+
+Operating System: WHAT OS WERE YOU USING?
+
+### :ALEInfo
+
+PASTE OUTPUT OF `:ALEInfo` HERE. YOU CAN TRY `:ALEInfoToClipboard`.
+
+## What went wrong
+
+WRITE WHAT WENT WRONG HERE.
+
+## Reproducing the bug
+
+Steps for repeating the bug:
+
+1. Write a list of steps.
+2. Otherwise nobody will fix the bug.
diff --git a/README.md b/README.md
index fd919c09..6d390135 100644
--- a/README.md
+++ b/README.md
@@ -105,10 +105,10 @@ formatting.
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint) |
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
-| Haskell | [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) |
+| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) |
| HTML | [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
| Idris | [idris](http://www.idris-lang.org/) |
-| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
+| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format) |
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), prettier-eslint >= 4.2.0, prettier-standard, [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
| JSON | [jsonlint](http://zaa.ch/jsonlint/), [prettier](https://github.com/prettier/prettier) |
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
@@ -145,7 +145,7 @@ formatting.
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
| SML | [smlnj](http://www.smlnj.org/) |
-| Solidity | [solium](https://github.com/duaraghav8/Solium) |
+| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
| SQL | [sqlint](https://github.com/purcell/sqlint) |
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
diff --git a/ale_linters/ansible/ansible_lint.vim b/ale_linters/ansible/ansible_lint.vim
index 27c96320..0b3b39c8 100644
--- a/ale_linters/ansible/ansible_lint.vim
+++ b/ale_linters/ansible/ansible_lint.vim
@@ -21,7 +21,7 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:code = l:match[4]
- if l:code is# 'EANSIBLE002'
+ if l:code is# 'EANSIBLE0002'
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim
index ae26fab4..a0e123a4 100644
--- a/ale_linters/rust/cargo.vim
+++ b/ale_linters/rust/cargo.vim
@@ -2,7 +2,7 @@
" Description: rustc invoked by cargo for rust files
call ale#Set('rust_cargo_use_check', 1)
-call ale#Set('rust_cargo_check_all_targets', 1)
+call ale#Set('rust_cargo_check_all_targets', 0)
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
diff --git a/ale_linters/solidity/solhint.vim b/ale_linters/solidity/solhint.vim
new file mode 100644
index 00000000..519fd49d
--- /dev/null
+++ b/ale_linters/solidity/solhint.vim
@@ -0,0 +1,30 @@
+" Author: Franco Victorio - https://github.com/fvictorio
+" Description: Report errors in Solidity code with solhint
+
+function! ale_linters#solidity#solhint#Handle(buffer, lines) abort
+ " Matches patterns like the following:
+ " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars)
+
+ let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ let l:isError = l:match[3] is? 'error'
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': l:match[2] + 0,
+ \ 'text': l:match[4],
+ \ 'code': l:match[5],
+ \ 'type': l:isError ? 'E' : 'W',
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('solidity', {
+\ 'name': 'solhint',
+\ 'executable': 'solhint',
+\ 'command': 'solhint --formatter compact %t',
+\ 'callback': 'ale_linters#solidity#solhint#Handle',
+\})
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index a1bfbb71..f4b48169 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -29,7 +29,6 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
endif
let l:item = {
- \ 'filename': ale#path#GetAbsPath(l:dir, l:error.name),
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
\ 'text': l:error.failure,
\ 'lnum': l:error.startPosition.line + 1,
@@ -38,6 +37,13 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
\ 'end_col': l:error.endPosition.character + 1,
\}
+ let l:filename = ale#path#GetAbsPath(l:dir, l:error.name)
+
+ " Assume temporary files are this file.
+ if !ale#path#IsTempName(l:filename)
+ let l:item.filename = l:filename
+ endif
+
if has_key(l:error, 'ruleName')
let l:item.code = l:error.ruleName
endif
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 5c09e785..53df7ccb 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -139,6 +139,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Fix Haskell files with hfmt.',
\ },
+\ 'brittany': {
+\ 'function': 'ale#fixers#brittany#Fix',
+\ 'suggested_filetypes': ['haskell'],
+\ 'description': 'Fix Haskell files with brittany.',
+\ },
\ 'refmt': {
\ 'function': 'ale#fixers#refmt#Fix',
\ 'suggested_filetypes': ['reason'],
@@ -149,6 +154,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['sh'],
\ 'description': 'Fix sh files with shfmt.',
\ },
+\ 'google_java_format': {
+\ 'function': 'ale#fixers#google_java_format#Fix',
+\ 'suggested_filetypes': ['java'],
+\ 'description': 'Fix Java files with google-java-format.',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/brittany.vim b/autoload/ale/fixers/brittany.vim
new file mode 100644
index 00000000..fed5eb8b
--- /dev/null
+++ b/autoload/ale/fixers/brittany.vim
@@ -0,0 +1,15 @@
+" Author: eborden <evan@evan-borden.com>
+" Description: Integration of brittany with ALE.
+
+call ale#Set('haskell_brittany_executable', 'brittany')
+
+function! ale#fixers#brittany#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
+
diff --git a/autoload/ale/fixers/goimports.vim b/autoload/ale/fixers/goimports.vim
index f5695136..783d0206 100644
--- a/autoload/ale/fixers/goimports.vim
+++ b/autoload/ale/fixers/goimports.vim
@@ -14,7 +14,7 @@ function! ale#fixers#goimports#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
- \ . ' -l -w'
+ \ . ' -l -w -srcdir %s'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
diff --git a/autoload/ale/fixers/google_java_format.vim b/autoload/ale/fixers/google_java_format.vim
new file mode 100644
index 00000000..92632e84
--- /dev/null
+++ b/autoload/ale/fixers/google_java_format.vim
@@ -0,0 +1,23 @@
+" Author: butlerx <butlerx@notthe,cloud>
+" Description: Integration of Google-java-format with ALE.
+
+call ale#Set('google_java_format_executable', 'google-java-format')
+call ale#Set('google_java_format_use_global', 0)
+call ale#Set('google_java_format_options', '')
+
+function! ale#fixers#google_java_format#Fix(buffer) abort
+ let l:options = ale#Var(a:buffer, 'google_java_format_options')
+ let l:executable = ale#Var(a:buffer, 'google_java_format_executable')
+
+ if !executable(l:executable)
+ return 0
+ endif
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' ' . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' --replace'
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/highlight.vim b/autoload/ale/highlight.vim
index e3c749fb..ae1f3e7d 100644
--- a/autoload/ale/highlight.vim
+++ b/autoload/ale/highlight.vim
@@ -95,6 +95,12 @@ function! ale#highlight#UpdateHighlights() abort
" If highlights are enabled and signs are not enabled, we should still
" offer line highlights by adding a separate set of highlights.
if !g:ale_set_signs
+ let l:available_groups = {
+ \ 'ALEWarningLine': hlexists('ALEWarningLine'),
+ \ 'ALEInfoLine': hlexists('ALEInfoLine'),
+ \ 'ALEErrorLine': hlexists('ALEErrorLine'),
+ \}
+
for l:item in l:item_list
if l:item.type is# 'W'
let l:group = 'ALEWarningLine'
@@ -104,7 +110,9 @@ function! ale#highlight#UpdateHighlights() abort
let l:group = 'ALEErrorLine'
endif
- call matchaddpos(l:group, [l:item.lnum])
+ if l:available_groups[l:group]
+ call matchaddpos(l:group, [l:item.lnum])
+ endif
endfor
endif
endfunction
diff --git a/doc/ale-haskell.txt b/doc/ale-haskell.txt
index 4a490efc..0ea40377 100644
--- a/doc/ale-haskell.txt
+++ b/doc/ale-haskell.txt
@@ -3,6 +3,16 @@ ALE Haskell Integration *ale-haskell-options*
===============================================================================
+brittany *ale-haskell-brittany*
+
+g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable*
+ *b:ale_haskell_brittany_executable*
+ Type: |String|
+ Default: `'brittany'`
+
+ This variable can be changed to use a different executable for brittany.
+
+===============================================================================
hdevtools *ale-haskell-hdevtools*
g:ale_haskell_hdevtools_executable *g:ale_haskell_hdevtools_executable*
diff --git a/doc/ale-java.txt b/doc/ale-java.txt
index 13decb41..ce47542d 100644
--- a/doc/ale-java.txt
+++ b/doc/ale-java.txt
@@ -34,4 +34,23 @@ g:ale_java_javac_options *g:ale_java_javac_options*
===============================================================================
+google-java-format *ale-java-google-java-format*
+
+
+g:ale_java_google_java_format_executable *g:ale_java_google_java_format_executable*
+ *b:ale_java_google_java_format_executable*
+ Type: |String|
+ Default: `'google-java-format'`
+
+ See |ale-integrations-local-executables|
+
+
+g:ale_java_google_java_format_options *g:ale_java_google_java_format_options*
+ *b:ale_java_google_java_format_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be set to pass additional options
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-rust.txt b/doc/ale-rust.txt
index a32c90b0..64d5293c 100644
--- a/doc/ale-rust.txt
+++ b/doc/ale-rust.txt
@@ -53,7 +53,7 @@ g:ale_rust_cargo_use_check *g:ale_rust_cargo_use_check*
g:ale_rust_cargo_check_all_targets *g:ale_rust_cargo_check_all_targets*
*b:ale_rust_cargo_check_all_targets*
Type: |Number|
- Default: `1`
+ Default: `0`
When set to `1`, ALE will set the `--all-targets` option when `cargo check`
is used. See |g:ale_rust_cargo_use_check|,
diff --git a/doc/ale-solidity.txt b/doc/ale-solidity.txt
index 3dea123e..4b74a27a 100644
--- a/doc/ale-solidity.txt
+++ b/doc/ale-solidity.txt
@@ -3,6 +3,14 @@ ALE Solidity Integration *ale-solidity-options*
===============================================================================
+solhint *ale-solidity-solhint*
+
+ Solhint should work out-of-the-box. You can further configure it using a
+ `.solihint.json` file. See https://github.com/protofire/solhint for more
+ information.
+
+
+===============================================================================
solium *ale-solidity-solium*
Use of Solium linter for Solidity source code requires a .soliumrc.json
diff --git a/doc/ale.txt b/doc/ale.txt
index 79101c6a..b818f871 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -80,6 +80,7 @@ CONTENTS *ale-contents*
handlebars............................|ale-handlebars-options|
ember-template-lint.................|ale-handlebars-embertemplatelint|
haskell...............................|ale-haskell-options|
+ brittany............................|ale-haskell-brittany|
hdevtools...........................|ale-haskell-hdevtools|
hfmt................................|ale-haskell-hfmt|
stack-build.........................|ale-haskell-stack-build|
@@ -92,6 +93,7 @@ CONTENTS *ale-contents*
java..................................|ale-java-options|
checkstyle..........................|ale-java-checkstyle|
javac...............................|ale-java-javac|
+ google-java-format..................|ale-java-google-java-format|
javascript............................|ale-javascript-options|
eslint..............................|ale-javascript-eslint|
flow................................|ale-javascript-flow|
@@ -193,6 +195,7 @@ CONTENTS *ale-contents*
sml...................................|ale-sml-options|
smlnj...............................|ale-sml-smlnj|
solidity..............................|ale-solidity-options|
+ solhint.............................|ale-solidity-solhint|
solium..............................|ale-solidity-solium|
spec..................................|ale-spec-options|
rpmlint.............................|ale-spec-rpmlint|
@@ -302,10 +305,10 @@ Notes:
* GraphQL: `eslint`, `gqlint`
* Haml: `haml-lint`
* Handlebars: `ember-template-lint`
-* Haskell: `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`
+* Haskell: `brittany`, `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`
* HTML: `HTMLHint`, `proselint`, `tidy`, `write-good`
* Idris: `idris`
-* Java: `checkstyle`, `javac`
+* Java: `checkstyle`, `javac`, `google-java-format`
* JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint` >= 4.2.0, `prettier-standard`, `standard`, `xo`
* JSON: `jsonlint`, `prettier`
* Kotlin: `kotlinc`, `ktlint`
@@ -342,7 +345,7 @@ Notes:
* Scala: `scalac`, `scalastyle`
* Slim: `slim-lint`
* SML: `smlnj`
-* Solidity: `solium`
+* Solidity: `solhint, solium`
* Stylus: `stylelint`
* SQL: `sqlint`
* Swift: `swiftlint`, `swiftformat`
diff --git a/run-tests b/run-tests
index 4c2c45f3..6004911a 100755
--- a/run-tests
+++ b/run-tests
@@ -11,7 +11,6 @@
current_image_id=d5a1b5915b09
image=w0rp/ale
-exit_code=0
tests='test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader'
# These flags are forwarded to the script for running Vader tests.
@@ -91,20 +90,50 @@ find test -name '*.swp' -delete
docker images -q w0rp/ale | grep "^$current_image_id" > /dev/null \
|| docker pull "$image"
+output_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
+
+trap '{ rm -rf "$output_dir"; }' EXIT
+
+file_number=0
+pid_list=''
+
for vim in $(docker run --rm "$image" ls /vim-build/bin | grep '^neovim\|^vim' ); do
- if [[ $vim =~ ^neovim ]] && ((run_neovim_tests)); then
- test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" || exit_code=$?
- elif ((run_vim_tests)); then
- test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" || exit_code=$?
+ if ((run_vim_tests)) || [[ $vim =~ ^neovim ]] && ((run_neovim_tests)); then
+ echo "Starting Vim: $vim..."
+ file_number=$((file_number+1))
+ test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" \
+ > "$output_dir/$file_number" 2>&1 &
+ pid_list="$pid_list $!"
fi
done
if ((run_vint)); then
- test/script/run-vint || exit_code=$?
+ echo "Starting Vint..."
+ file_number=$((file_number+1))
+ test/script/run-vint > "$output_dir/$file_number" 2>&1 &
+ pid_list="$pid_list $!"
fi
if ((run_custom_checks)); then
- test/script/custom-checks || exit_code=$?
+ echo "Starting Custom checks..."
+ file_number=$((file_number+1))
+ test/script/custom-checks &> "$output_dir/$file_number" 2>&1 &
+ pid_list="$pid_list $!"
fi
-exit $exit_code
+echo
+
+failed=0
+index=0
+
+for pid in $pid_list; do
+ index=$((index+1))
+
+ if ! wait "$pid"; then
+ failed=1
+ fi
+
+ cat "$output_dir/$index"
+done
+
+exit $failed
diff --git a/test/command_callback/test_cargo_command_callbacks.vader b/test/command_callback/test_cargo_command_callbacks.vader
index 10535516..65ea5a80 100644
--- a/test/command_callback/test_cargo_command_callbacks.vader
+++ b/test/command_callback/test_cargo_command_callbacks.vader
@@ -85,32 +85,32 @@ Execute(`cargo build` should be used when g:ale_rust_cargo_use_check is set to 0
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
-Execute(`cargo check --all-targets` should be used when the version is new enough):
+Execute(`cargo check` should be used when the version is new enough):
AssertEqual
- \ 'cargo check --all-targets' . g:suffix,
+ \ 'cargo check' . g:suffix,
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
\ ])
" We should cache the version check
AssertEqual
- \ 'cargo check --all-targets' . g:suffix,
+ \ 'cargo check' . g:suffix,
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
-Execute(--all-targets should not be used when g:ale_rust_cargo_check_all_targets is set to 0):
- let g:ale_rust_cargo_check_all_targets = 0
+Execute(--all-targets should be used when g:ale_rust_cargo_check_all_targets is set to 1):
+ let g:ale_rust_cargo_check_all_targets = 1
AssertEqual
- \ 'cargo check' . g:suffix,
+ \ 'cargo check --all-targets' . g:suffix,
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
\ ])
" We should cache the version check
AssertEqual
- \ 'cargo check' . g:suffix,
+ \ 'cargo check --all-targets' . g:suffix,
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
diff --git a/test/fixers/test_brittany_fixer_callback.vader b/test/fixers/test_brittany_fixer_callback.vader
new file mode 100644
index 00000000..a0182b52
--- /dev/null
+++ b/test/fixers/test_brittany_fixer_callback.vader
@@ -0,0 +1,23 @@
+Before:
+ Save g:ale_haskell_brittany_executable
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_haskell_brittany_executable = 'xxxinvalid'
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The brittany callback should return the correct default values):
+ call ale#test#SetFilename('../haskell_files/testfile.hs')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' %t',
+ \ },
+ \ ale#fixers#brittany#Fix(bufnr(''))
diff --git a/test/fixers/test_goimports_fixer_callback.vader b/test/fixers/test_goimports_fixer_callback.vader
index 1d2763ce..cec06354 100644
--- a/test/fixers/test_goimports_fixer_callback.vader
+++ b/test/fixers/test_goimports_fixer_callback.vader
@@ -25,7 +25,7 @@ Execute(The goimports callback should the command when the executable test passe
AssertEqual
\ {
\ 'read_temporary_file': 1,
- \ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w %t'
+ \ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w -srcdir %s %t'
\ },
\ ale#fixers#goimports#Fix(bufnr(''))
@@ -36,6 +36,6 @@ Execute(The goimports callback should include extra options):
AssertEqual
\ {
\ 'read_temporary_file': 1,
- \ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w --xxx %t'
+ \ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w -srcdir %s --xxx %t'
\ },
\ ale#fixers#goimports#Fix(bufnr(''))
diff --git a/test/fixers/test_goofle_java_format_fixer_callback.vader b/test/fixers/test_goofle_java_format_fixer_callback.vader
new file mode 100644
index 00000000..d64e2788
--- /dev/null
+++ b/test/fixers/test_goofle_java_format_fixer_callback.vader
@@ -0,0 +1,27 @@
+Before:
+ Save g:ale_google_java_format_executable
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_google_java_format_executable = 'xxxinvalid'
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The google-java-format callback should return 0 when the executable isn't executable):
+ AssertEqual
+ \ 0,
+ \ ale#fixers#google_java_format#Fix(bufnr(''))
+
+Execute(The google-java-format callback should run the command when the executable test passes):
+ let g:ale_google_java_format_executable = has('win32') ? 'cmd' : 'echo'
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape(ale_google_java_format_executable) . ' --replace %t'
+ \ },
+ \ ale#fixers#google_java_format#Fix(bufnr(''))
diff --git a/test/handler/test_ansible_lint_handler.vader b/test/handler/test_ansible_lint_handler.vader
index cd6e513e..796277e6 100644
--- a/test/handler/test_ansible_lint_handler.vader
+++ b/test/handler/test_ansible_lint_handler.vader
@@ -1,9 +1,13 @@
Before:
- runtime ale_linters/ansible/ansible_lint.vim
- call ale#test#SetFilename('main.yml')
+ runtime ale_linters/ansible/ansible_lint.vim
+ call ale#test#SetFilename('main.yml')
+
+ let b:ale_warn_about_trailing_whitespace = 1
After:
- call ale#linter#Reset()
+ unlet! b:ale_warn_about_trailing_whitespace
+
+ call ale#linter#Reset()
Execute(The ansible-lint handler should handle basic errors):
AssertEqual
@@ -20,6 +24,16 @@ Execute(The ansible-lint handler should handle basic errors):
\ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace',
\ ])
+Execute(The ansible-lint handler should supress trailing whitespace output when the option is used):
+ let b:ale_warn_about_trailing_whitespace = 0
+
+ AssertEqual
+ \ [
+ \ ],
+ \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
+ \ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace',
+ \ ])
+
Execute (The ansible-lint handler should handle names with spaces):
AssertEqual
\ [
diff --git a/test/handler/test_solhint_handler.vader b/test/handler/test_solhint_handler.vader
new file mode 100644
index 00000000..a3ed5d57
--- /dev/null
+++ b/test/handler/test_solhint_handler.vader
@@ -0,0 +1,60 @@
+Before:
+ runtime ale_linters/solidity/solhint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The vint handler should parse error messages correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 17,
+ \ 'text': 'Compiler version must be fixed',
+ \ 'code': 'compiler-fixed',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 4,
+ \ 'col': 8,
+ \ 'text': 'Use double quotes for string literals',
+ \ 'code': 'quotes',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 5,
+ \ 'col': 8,
+ \ 'text': 'Use double quotes for string literals',
+ \ 'code': 'quotes',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 13,
+ \ 'col': 3,
+ \ 'text': 'Expected indentation of 4 spaces but found 2',
+ \ 'code': 'indent',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 14,
+ \ 'col': 3,
+ \ 'text': 'Expected indentation of 4 spaces but found 2',
+ \ 'code': 'indent',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 47,
+ \ 'col': 3,
+ \ 'text': 'Function order is incorrect, public function can not go after internal function.',
+ \ 'code': 'func-order',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#solidity#solhint#Handle(bufnr(''), [
+ \ 'contracts/Bounty.sol: line 1, col 17, Warning - Compiler version must be fixed (compiler-fixed)',
+ \ 'contracts/Bounty.sol: line 4, col 8, Error - Use double quotes for string literals (quotes)',
+ \ 'contracts/Bounty.sol: line 5, col 8, Error - Use double quotes for string literals (quotes)',
+ \ 'contracts/Bounty.sol: line 13, col 3, Error - Expected indentation of 4 spaces but found 2 (indent)',
+ \ 'contracts/Bounty.sol: line 14, col 3, Error - Expected indentation of 4 spaces but found 2 (indent)',
+ \ 'contracts/Bounty.sol: line 47, col 3, Error - Function order is incorrect, public function can not go after internal function. (func-order)',
+ \ ])
diff --git a/test/handler/test_tslint_handler.vader b/test/handler/test_tslint_handler.vader
index d6ed353b..4c551dc3 100644
--- a/test/handler/test_tslint_handler.vader
+++ b/test/handler/test_tslint_handler.vader
@@ -278,5 +278,33 @@ Execute(The tslint handler should not report no-implicit-dependencies errors):
\ 'character': 0,
\ 'line': 1,
\ 'position': 1
- \ }
+ \ },
\ }])])
+
+Execute(The tslint handler should set filename keys for temporary files):
+ if !has('win32')
+ " The temporay filename below is hacked into being a relative path so we can
+ " test that we resolve the temporary filename first.
+ AssertEqual
+ \ [
+ \ {'lnum': 47, 'col': 1, 'code': 'curly', 'end_lnum': 47, 'type': 'E', 'end_col': 26, 'text': 'if statements must be braced'},
+ \ ],
+ \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
+ \ {
+ \ 'endPosition': {
+ \ 'character':25,
+ \ 'line':46,
+ \ 'position':1383,
+ \ },
+ \ 'failure': 'if statements must be braced',
+ \ 'name': substitute(substitute(substitute(expand('%:p'), '[^/\\]', '', 'g'), '.', '../', 'g') . tempname(), '\([A-Z]:\\\)[A-Z]:', '\1', ''),
+ \ 'ruleName': 'curly',
+ \ 'ruleSeverity':'ERROR',
+ \ 'startPosition': {
+ \ 'character':0,
+ \ 'line':46,
+ \ 'position':1358,
+ \ }
+ \ },
+ \ ])])
+ endif
diff --git a/test/script/run-vader-tests b/test/script/run-vader-tests
index d5daec29..a10b8baf 100755
--- a/test/script/run-vader-tests
+++ b/test/script/run-vader-tests
@@ -106,18 +106,10 @@ echo "Running tests for $vim"
echo '========================================'
echo
-if [[ $vim =~ ^neovim ]]; then
- set -o pipefail
- docker run -it -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \
- "/vim-build/bin/$vim" -u test/vimrc \
- --headless "+Vader! $tests" | filter-vader-output | color-vader-output || exit_code=$?
- set +o pipefail
-else
- set -o pipefail
- docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \
- "/vim-build/bin/$vim" -u test/vimrc \
- "+Vader! $tests" 2>&1 | filter-vader-output | color-vader-output || exit_code=$?
- set +o pipefail
-fi
+set -o pipefail
+docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \
+ "/vim-build/bin/$vim" -u test/vimrc \
+ "+Vader! $tests" 2>&1 | filter-vader-output | color-vader-output || exit_code=$?
+set +o pipefail
exit "$exit_code"