diff options
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | ale_linters/cpp/clangd.vim | 22 | ||||
-rw-r--r-- | ale_linters/go/gobuild.vim | 34 | ||||
-rw-r--r-- | ale_linters/objc/clangd.vim | 22 | ||||
-rw-r--r-- | ale_linters/objcpp/clangd.vim | 22 | ||||
-rw-r--r-- | ale_linters/php/phpcs.vim | 6 | ||||
-rw-r--r-- | autoload/ale/fix/registry.vim | 10 | ||||
-rw-r--r-- | autoload/ale/fixers/hlint.vim | 16 | ||||
-rw-r--r-- | autoload/ale/fixers/stylish_haskell.vim | 15 | ||||
-rw-r--r-- | doc/ale-cpp.txt | 19 | ||||
-rw-r--r-- | doc/ale-haskell.txt | 20 | ||||
-rw-r--r-- | doc/ale-objc.txt | 19 | ||||
-rw-r--r-- | doc/ale-objcpp.txt | 19 | ||||
-rw-r--r-- | doc/ale-php.txt | 7 | ||||
-rw-r--r-- | doc/ale.txt | 15 | ||||
-rw-r--r-- | test/command_callback/test_gobuild_command_callback.vader | 25 | ||||
-rw-r--r-- | test/command_callback/test_phpcs_command_callback.vader | 6 | ||||
-rw-r--r-- | test/fixers/test_hlint_fixer_callback.vader | 25 | ||||
-rw-r--r-- | test/fixers/test_stylish_haskell_fixer_callback.vader | 24 |
19 files changed, 273 insertions, 61 deletions
@@ -98,7 +98,7 @@ formatting. | Bash | [language-server](https://github.com/mads-hartmann/bash-language-server), shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) | | Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) | | C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) | -| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) | +| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) | | CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) | | C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration| | Chef | [foodcritic](http://www.foodcritic.io/) | @@ -129,7 +129,7 @@ formatting. | Hack | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/hhvm/tree/master/hphp/hack/hackfmt), [hhast](https://github.com/hhvm/hhast) (disabled by default; see `:help ale-integration-hack`) | | Haml | [haml-lint](https://github.com/brigade/haml-lint) | | Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) | -| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [cabal-ghc](https://www.haskell.org/cabal/), [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), [hie](https://github.com/haskell/haskell-ide-engine) | +| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [cabal-ghc](https://www.haskell.org/cabal/), [stylish-haskell](https://github.com/jaspervdj/stylish-haskell), [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), [hie](https://github.com/haskell/haskell-ide-engine) | | HTML | [alex](https://github.com/wooorm/alex) !!, [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), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/) | @@ -149,8 +149,8 @@ formatting. | Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! | | nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) | | nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)| -| Objective-C | [clang](http://clang.llvm.org/) | -| Objective-C++ | [clang](http://clang.llvm.org/) | +| Objective-C | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html) | +| Objective-C++ | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html) | | OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) | | Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic), [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) | | PHP | [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer), [php-cs-fixer](http://cs.sensiolabs.org/) | diff --git a/ale_linters/cpp/clangd.vim b/ale_linters/cpp/clangd.vim new file mode 100644 index 00000000..1d716c33 --- /dev/null +++ b/ale_linters/cpp/clangd.vim @@ -0,0 +1,22 @@ +" Author: Andrey Melentyev <andrey.melentyev@protonmail.com> +" Description: Clangd language server + +call ale#Set('cpp_clangd_executable', 'clangd') +call ale#Set('cpp_clangd_options', '') + +function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' +endfunction + +function! ale_linters#cpp#clangd#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options')) +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'clangd', +\ 'lsp': 'stdio', +\ 'executable_callback': ale#VarFunc('cpp_clangd_executable'), +\ 'command_callback': 'ale_linters#cpp#clangd#GetCommand', +\ 'project_root_callback': 'ale_linters#cpp#clangd#GetProjectRoot', +\}) diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim index c4608071..2d6febdd 100644 --- a/ale_linters/go/gobuild.vim +++ b/ale_linters/go/gobuild.vim @@ -5,35 +5,11 @@ call ale#Set('go_gobuild_options', '') -function! ale_linters#go#gobuild#ResetEnv() abort - unlet! s:go_env -endfunction - -function! ale_linters#go#gobuild#GoEnv(buffer) abort - if exists('s:go_env') - return '' - endif - - return 'go env GOPATH GOROOT' -endfunction - -function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort +function! ale_linters#go#gobuild#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_gobuild_options') - if !exists('s:go_env') - let s:go_env = { - \ 'GOPATH': a:goenv_output[0], - \ 'GOROOT': a:goenv_output[1], - \} - endif - - let l:gopath_env_command = has('win32') - \ ? 'set GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' && ' - \ : 'GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' ' - " Run go test in local directory with relative path - return l:gopath_env_command - \ . ale#path#BufferCdString(a:buffer) + return ale#path#BufferCdString(a:buffer) \ . 'go test' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -c -o /dev/null ./' @@ -73,10 +49,8 @@ call ale#linter#Define('go', { \ 'name': 'gobuild', \ 'aliases': ['go build'], \ 'executable': 'go', -\ 'command_chain': [ -\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#go#gobuild#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command_callback': 'ale_linters#go#gobuild#GetCommand', +\ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', \ 'lint_file': 1, \}) diff --git a/ale_linters/objc/clangd.vim b/ale_linters/objc/clangd.vim new file mode 100644 index 00000000..161d2cc7 --- /dev/null +++ b/ale_linters/objc/clangd.vim @@ -0,0 +1,22 @@ +" Author: Andrey Melentyev <andrey.melentyev@protonmail.com> +" Description: Clangd language server + +call ale#Set('objc_clangd_executable', 'clangd') +call ale#Set('objc_clangd_options', '') + +function! ale_linters#objc#clangd#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' +endfunction + +function! ale_linters#objc#clangd#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'objc_clangd_options')) +endfunction + +call ale#linter#Define('objc', { +\ 'name': 'clangd', +\ 'lsp': 'stdio', +\ 'executable_callback': ale#VarFunc('objc_clangd_executable'), +\ 'command_callback': 'ale_linters#objc#clangd#GetCommand', +\ 'project_root_callback': 'ale_linters#objc#clangd#GetProjectRoot', +\}) diff --git a/ale_linters/objcpp/clangd.vim b/ale_linters/objcpp/clangd.vim new file mode 100644 index 00000000..7e06796f --- /dev/null +++ b/ale_linters/objcpp/clangd.vim @@ -0,0 +1,22 @@ +" Author: Andrey Melentyev <andrey.melentyev@protonmail.com> +" Description: Clangd language server + +call ale#Set('objcpp_clangd_executable', 'clangd') +call ale#Set('objcpp_clangd_options', '') + +function! ale_linters#objcpp#clangd#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' +endfunction + +function! ale_linters#objcpp#clangd#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'objcpp_clangd_options')) +endfunction + +call ale#linter#Define('objcpp', { +\ 'name': 'clangd', +\ 'lsp': 'stdio', +\ 'executable_callback': ale#VarFunc('objcpp_clangd_executable'), +\ 'command_callback': 'ale_linters#objcpp#clangd#GetCommand', +\ 'project_root_callback': 'ale_linters#objcpp#clangd#GetProjectRoot', +\}) diff --git a/ale_linters/php/phpcs.vim b/ale_linters/php/phpcs.vim index 25e53714..408c2652 100644 --- a/ale_linters/php/phpcs.vim +++ b/ale_linters/php/phpcs.vim @@ -3,6 +3,7 @@ let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '') +call ale#Set('php_phpcs_options', '') call ale#Set('php_phpcs_executable', 'phpcs') call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0)) @@ -11,8 +12,11 @@ function! ale_linters#php#phpcs#GetCommand(buffer) abort let l:standard_option = !empty(l:standard) \ ? '--standard=' . l:standard \ : '' + let l:options = ale#Var(a:buffer, 'php_phpcs_options') - return '%e -s --report=emacs --stdin-path=%s' . ale#Pad(l:standard_option) + return '%e -s --report=emacs --stdin-path=%s' + \ . ale#Pad(l:standard_option) + \ . ale#Pad(l:options) endfunction function! ale_linters#php#phpcs#Handle(buffer, lines) abort diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index ef287358..dfcdc98f 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -170,6 +170,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with brittany.', \ }, +\ 'hlint': { +\ 'function': 'ale#fixers#hlint#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Refactor Haskell files with hlint.', +\ }, +\ 'stylish-haskell': { +\ 'function': 'ale#fixers#stylish_haskell#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Refactor Haskell files with stylish-haskell.', +\ }, \ 'refmt': { \ 'function': 'ale#fixers#refmt#Fix', \ 'suggested_filetypes': ['reason'], diff --git a/autoload/ale/fixers/hlint.vim b/autoload/ale/fixers/hlint.vim new file mode 100644 index 00000000..94dd736e --- /dev/null +++ b/autoload/ale/fixers/hlint.vim @@ -0,0 +1,16 @@ +" Author: eborden <evan@evan-borden.com> +" Description: Integration of hlint refactor with ALE. +" +call ale#Set('haskell_hlint_executable', 'hlint') + +function! ale#fixers#hlint#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' --refactor' + \ . ' --refactor-options="--inplace"' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/autoload/ale/fixers/stylish_haskell.vim b/autoload/ale/fixers/stylish_haskell.vim new file mode 100644 index 00000000..a352312f --- /dev/null +++ b/autoload/ale/fixers/stylish_haskell.vim @@ -0,0 +1,15 @@ +" Author: eborden <evan@evan-borden.com> +" Description: Integration of stylish-haskell formatting with ALE. +" +call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell') + +function! ale#fixers#stylish_haskell#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' --inplace' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/doc/ale-cpp.txt b/doc/ale-cpp.txt index be7e840c..c42d20a2 100644 --- a/doc/ale-cpp.txt +++ b/doc/ale-cpp.txt @@ -33,6 +33,25 @@ g:ale_cpp_clang_options *g:ale_cpp_clang_options* =============================================================================== +clangd *ale-cpp-clangd* + +g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* + *b:ale_cpp_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* + *b:ale_cpp_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + + +=============================================================================== clangcheck *ale-cpp-clangcheck* `clang-check` will be run only when files are saved to disk, so that diff --git a/doc/ale-haskell.txt b/doc/ale-haskell.txt index 379cd987..c1f1e889 100644 --- a/doc/ale-haskell.txt +++ b/doc/ale-haskell.txt @@ -68,6 +68,16 @@ g:ale_haskell_hfmt_executable *g:ale_haskell_hfmt_executable* This variable can be changed to use a different executable for hfmt. =============================================================================== +hlint *ale-haskell-hlint* + +g:ale_haskell_hlint_executable *g:ale_haskell_hlint_executable* + *b:ale_haskell_hlint_executable* + Type: |String| + Default: `'hlint'` + + This variable can be changed to use a different executable for hlint. + +=============================================================================== stack-build *ale-haskell-stack-build* g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* @@ -78,6 +88,16 @@ g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* We default to using `'--fast'`. Since Stack generates binaries, your programs will be slower unless you separately rebuild them outside of ALE. +=============================================================================== +stylish-haskell *ale-haskell-stylish-haskell* + +g:ale_haskell_stylish_haskell_executable + *g:ale_haskell_stylish_haskell_executable* + *b:ale_haskell_stylish_haskell_executable* + Type: |String| + Default: `'stylish-haskell'` + + This variable can be changed to use a different executable for stylish-haskell. =============================================================================== hie *ale-haskell-hie* diff --git a/doc/ale-objc.txt b/doc/ale-objc.txt index 35b9a795..9e7db367 100644 --- a/doc/ale-objc.txt +++ b/doc/ale-objc.txt @@ -14,4 +14,23 @@ g:ale_objc_clang_options *g:ale_objc_clang_options* =============================================================================== +clangd *ale-objc-clangd* + +g:ale_objc_clangd_executable *g:ale_objc_clangd_executable* + *b:ale_objc_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_objc_clangd_options *g:ale_objc_clangd_options* + *b:ale_objc_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + + +=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-objcpp.txt b/doc/ale-objcpp.txt index 73d68a2e..1f76aecb 100644 --- a/doc/ale-objcpp.txt +++ b/doc/ale-objcpp.txt @@ -14,4 +14,23 @@ g:ale_objcpp_clang_options *g:ale_objcpp_clang_options* =============================================================================== +clangd *ale-objcpp-clangd* + +g:ale_objcpp_clangd_executable *g:ale_objcpp_clangd_executable* + *b:ale_objcpp_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_objcpp_clangd_options *g:ale_objcpp_clangd_options* + *b:ale_objcpp_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + + +=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-php.txt b/doc/ale-php.txt index ba53db89..f38c3f88 100644 --- a/doc/ale-php.txt +++ b/doc/ale-php.txt @@ -114,6 +114,13 @@ g:ale_php_phpcs_use_global *g:ale_php_phpcs_use_global* See |ale-integrations-local-executables| +g:ale_php_phpcs_options *g:ale_php_phpcs_options* + *b:ale_php_phpcs_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to php-cs + =============================================================================== phpmd *ale-php-phpmd* diff --git a/doc/ale.txt b/doc/ale.txt index 13184e84..d1e6d0b0 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -43,6 +43,7 @@ CONTENTS *ale-contents* cmakelint...........................|ale-cmake-cmakelint| cpp...................................|ale-cpp-options| clang...............................|ale-cpp-clang| + clangd..............................|ale-cpp-clangd| clangcheck..........................|ale-cpp-clangcheck| clang-format........................|ale-cpp-clangformat| clangtidy...........................|ale-cpp-clangtidy| @@ -109,7 +110,9 @@ CONTENTS *ale-contents* cabal-ghc...........................|ale-haskell-cabal-ghc| hdevtools...........................|ale-haskell-hdevtools| hfmt................................|ale-haskell-hfmt| + hlint...............................|ale-haskell-hlint| stack-build.........................|ale-haskell-stack-build| + stylish-haskell.....................|ale-haskell-stylish-haskell| hie.................................|ale-haskell-hie| html..................................|ale-html-options| htmlhint............................|ale-html-htmlhint| @@ -167,8 +170,10 @@ CONTENTS *ale-contents* write-good..........................|ale-nroff-write-good| objc..................................|ale-objc-options| clang...............................|ale-objc-clang| + clangd..............................|ale-objc-clangd| objcpp................................|ale-objcpp-options| clang...............................|ale-objcpp-clang| + clangd..............................|ale-objcpp-clangd| ocaml.................................|ale-ocaml-options| merlin..............................|ale-ocaml-merlin| ols.................................|ale-ocaml-ols| @@ -346,7 +351,7 @@ Notes: * Bash: `language-server`, `shell` (-n flag), `shellcheck`, `shfmt` * Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt` * C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc` -* C++ (filetype cpp): `clang`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc` +* C++ (filetype cpp): `clang`, `clangd`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc` * CUDA: `nvcc`!! * C#: `mcs`, `mcsc`!! * Chef: `foodcritic` @@ -377,7 +382,7 @@ Notes: * Hack: `hack`, `hackfmt`, `hhast` * Haml: `haml-lint` * Handlebars: `ember-template-lint` -* Haskell: `brittany`, `ghc`, `cabal-ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie` +* Haskell: `brittany`, `ghc`, `cabal-ghc`, `stylish-haskell`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie` * HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good` * Idris: `idris` * Java: `checkstyle`, `javac`, `google-java-format`, `PMD` @@ -397,8 +402,8 @@ Notes: * Nim: `nim check`!! * nix: `nix-instantiate` * nroff: `alex`!!, `proselint`, `write-good` -* Objective-C: `clang` -* Objective-C++: `clang` +* Objective-C: `clang`, `clangd` +* Objective-C++: `clang`, `clangd` * OCaml: `merlin` (see |ale-ocaml-merlin|), `ols` * Perl: `perl -c`, `perl-critic`, `perltidy` * PHP: `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`, `php-cs-fixer` @@ -2689,7 +2694,7 @@ ALEFixPost *ALEFixPost-autocmd* augroup ALEProgress autocmd! autocmd User ALELintPre hi Statusline ctermfg=darkgrey - autocmd User ALELintPOST hi Statusline ctermfg=NONE + autocmd User ALELintPost hi Statusline ctermfg=NONE augroup end < Or to display the progress in the statusline: diff --git a/test/command_callback/test_gobuild_command_callback.vader b/test/command_callback/test_gobuild_command_callback.vader index 86113728..f9673213 100644 --- a/test/command_callback/test_gobuild_command_callback.vader +++ b/test/command_callback/test_gobuild_command_callback.vader @@ -1,36 +1,19 @@ Before: call ale#assert#SetUpLinterTest('go', 'gobuild') - let g:env_prefix = has('win32') - \ ? 'set GOPATH=' . ale#Escape('/foo/bar') . ' && ' - \ : 'GOPATH=' . ale#Escape('/foo/bar') . ' ' - call ale_linters#go#gobuild#ResetEnv() - WithChainResults ['/foo/bar', '/foo/baz'] After: - unlet! g:env_prefix call ale#assert#TearDownLinterTest() Execute(The default commands should be correct): - AssertLinter 'go', [ - \ 'go env GOPATH GOROOT', - \ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' - \ . 'go test -c -o /dev/null ./' - \] - - " We shouldn't run `go env` many times after we've got it. - AssertLinter 'go', [ - \ '', - \ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' + AssertLinter 'go', + \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ . 'go test -c -o /dev/null ./' - \] Execute(Extra options should be supported): let g:ale_go_gobuild_options = '--foo-bar' - AssertLinter 'go', [ - \ 'go env GOPATH GOROOT', - \ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' + AssertLinter 'go', + \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ . 'go test --foo-bar -c -o /dev/null ./' - \] diff --git a/test/command_callback/test_phpcs_command_callback.vader b/test/command_callback/test_phpcs_command_callback.vader index 941a92d6..e5d2f449 100644 --- a/test/command_callback/test_phpcs_command_callback.vader +++ b/test/command_callback/test_phpcs_command_callback.vader @@ -27,3 +27,9 @@ Execute(Projects without local executables should use the global one): AssertLinter 'phpcs', \ ale#Escape('phpcs') . ' -s --report=emacs --stdin-path=%s' + +Execute(User provided options are used): + let g:ale_php_phpcs_options = '--my-user-provided-option my-value' + + AssertLinter 'phpcs', + \ ale#Escape('phpcs') . ' -s --report=emacs --stdin-path=%s --my-user-provided-option my-value' diff --git a/test/fixers/test_hlint_fixer_callback.vader b/test/fixers/test_hlint_fixer_callback.vader new file mode 100644 index 00000000..48f26c7c --- /dev/null +++ b/test/fixers/test_hlint_fixer_callback.vader @@ -0,0 +1,25 @@ +Before: + Save g:ale_haskell_hlint_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_haskell_hlint_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The hlint callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' --refactor' + \ . ' --refactor-options="--inplace"' + \ . ' %t', + \ }, + \ ale#fixers#hlint#Fix(bufnr('')) diff --git a/test/fixers/test_stylish_haskell_fixer_callback.vader b/test/fixers/test_stylish_haskell_fixer_callback.vader new file mode 100644 index 00000000..755d3430 --- /dev/null +++ b/test/fixers/test_stylish_haskell_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_haskell_stylish_haskell_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_haskell_stylish_haskell_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The stylish-haskell callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' --inplace' + \ . ' %t', + \ }, + \ ale#fixers#stylish_haskell#Fix(bufnr('')) |