summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml3
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--README.md125
-rw-r--r--ale_linters/asciidoc/write-good.vim9
-rw-r--r--ale_linters/haml/hamllint.vim29
-rw-r--r--ale_linters/help/write-good.vim9
-rw-r--r--ale_linters/html/write-good.vim9
-rw-r--r--ale_linters/mail/proselint.vim9
-rw-r--r--ale_linters/mail/vale.vim9
-rw-r--r--ale_linters/make/checkmake.vim24
-rw-r--r--ale_linters/markdown/remark_lint.vim28
-rw-r--r--ale_linters/markdown/write-good.vim9
-rw-r--r--ale_linters/nroff/write-good.vim9
-rw-r--r--ale_linters/php/phan.vim36
-rw-r--r--ale_linters/php/phpmd.vim2
-rw-r--r--ale_linters/pod/write-good.vim9
-rw-r--r--ale_linters/rst/write-good.vim9
-rw-r--r--ale_linters/rust/cargo.vim2
-rw-r--r--ale_linters/sh/shellcheck.vim5
-rw-r--r--ale_linters/tex/write-good.vim9
-rw-r--r--ale_linters/texinfo/write-good.vim9
-rw-r--r--ale_linters/text/write-good.vim9
-rw-r--r--ale_linters/xhtml/write-good.vim9
-rw-r--r--autoload/ale/engine.vim4
-rw-r--r--autoload/ale/fix/registry.vim17
-rw-r--r--autoload/ale/fixers/hfmt.vim16
-rw-r--r--autoload/ale/fixers/mix_format.vim16
-rw-r--r--autoload/ale/fixers/prettier.vim2
-rw-r--r--autoload/ale/fixers/rustfmt.vim17
-rw-r--r--autoload/ale/gradle.vim15
-rw-r--r--autoload/ale/handlers/gcc.vim102
-rw-r--r--autoload/ale/handlers/writegood.vim61
-rw-r--r--doc/ale-asciidoc.txt12
-rw-r--r--doc/ale-elixir.txt17
-rw-r--r--doc/ale-haskell.txt10
-rw-r--r--doc/ale-html.txt6
-rw-r--r--doc/ale-latex.txt12
-rw-r--r--doc/ale-less.txt12
-rw-r--r--doc/ale-markdown.txt12
-rw-r--r--doc/ale-nroff.txt12
-rw-r--r--doc/ale-php.txt15
-rw-r--r--doc/ale-pod.txt12
-rw-r--r--doc/ale-python.txt2
-rw-r--r--doc/ale-restructuredtext.txt12
-rw-r--r--doc/ale-rust.txt13
-rw-r--r--doc/ale-texinfo.txt12
-rw-r--r--doc/ale-text.txt12
-rw-r--r--doc/ale-vim-help.txt12
-rw-r--r--doc/ale-xhtml.txt12
-rw-r--r--doc/ale.txt94
-rw-r--r--plugin/ale.vim12
-rw-r--r--test/command_callback/test_dartanalyzer_command_callback.vader2
-rw-r--r--test/command_callback/test_haml_hamllint_command_callback.vader72
-rw-r--r--test/command_callback/test_shellcheck_command_callback.vader22
-rw-r--r--test/command_callback/test_write_good_command_callback.vader65
-rw-r--r--test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js0
-rw-r--r--test/command_callback/write-good-node-modules/node_modules/.bin/write-good0
-rw-r--r--test/elixir-test-files/testfile.ex0
-rw-r--r--test/fixers/test_hfmt_fixer_callback.vader24
-rw-r--r--test/fixers/test_mix_format_fixer_callback.vader20
-rw-r--r--test/fixers/test_prettier_fixer_callback.vader14
-rw-r--r--test/fixers/test_rustfmt_fixer_callback.vader38
-rw-r--r--test/hamllint-test-files/haml-lint-and-rubocop/.haml-lint.yml0
-rw-r--r--test/hamllint-test-files/haml-lint-and-rubocop/.rubocop.yml0
-rw-r--r--test/hamllint-test-files/haml-lint-and-rubocop/subdir/file.haml0
-rw-r--r--test/hamllint-test-files/haml-lint-yml/.haml-lint.yml0
-rw-r--r--test/hamllint-test-files/haml-lint-yml/subdir/file.haml0
-rw-r--r--test/hamllint-test-files/rubocop-yml/.rubocop.yml0
-rw-r--r--test/hamllint-test-files/rubocop-yml/subdir/file.haml0
-rw-r--r--test/handler/test_checkmake_handler.vader19
-rw-r--r--test/handler/test_clang_handler.vader12
-rw-r--r--test/handler/test_gcc_handler.vader74
-rw-r--r--test/handler/test_php_phan_handler.vader24
-rw-r--r--test/handler/test_php_phpmd_handler.vader24
-rw-r--r--test/handler/test_remark_lint_handler.vader27
-rw-r--r--test/handler/test_vint_handler.vader6
-rw-r--r--test/handler/test_write_good_handler.vader37
-rw-r--r--test/rust_files/testfile.rs0
-rwxr-xr-xtest/script/check-supported-tools-tables20
-rwxr-xr-xtest/script/check-toc13
-rw-r--r--test/sign/test_linting_sets_signs.vader4
-rw-r--r--test/test_ale_fix.vader140
-rw-r--r--test/test_ale_info.vader4
-rw-r--r--test/test_ale_lint_command.vader10
-rw-r--r--test/test_ale_toggle.vader2
-rw-r--r--test/test_c_import_paths.vader72
-rw-r--r--test/test_command_chain.vader10
-rw-r--r--test/test_csslint_config_detection.vader2
-rw-r--r--test/test_elm_executable_detection.vader2
-rw-r--r--test/test_errors_removed_after_filetype_changed.vader7
-rw-r--r--test/test_eslint_executable_detection.vader8
-rw-r--r--test/test_find_nearest_directory.vader2
-rw-r--r--test/test_flow_command.vader8
-rw-r--r--test/test_format_command.vader45
-rw-r--r--test/test_format_temporary_file_creation.vader4
-rw-r--r--test/test_get_abspath.vader4
-rw-r--r--test/test_gradle_build_classpath_command.vader39
-rw-r--r--test/test_gradle_find_executable.vader24
-rw-r--r--test/test_gradle_find_project_root.vader6
-rw-r--r--test/test_highlight_placement.vader4
-rw-r--r--test/test_history_saving.vader5
-rw-r--r--test/test_lint_on_enter_when_file_changed.vader7
102 files changed, 1506 insertions, 340 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index f6e7d5d3..54113953 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -36,4 +36,5 @@ install:
test_script:
- cd C:\testplugin
- - 'C:\vim\vim\vim80\vim.exe -u test\vimrc "+Vader! test/test_path_uri.vader"'
+ - 'C:\vim\vim\vim80\vim.exe -u test\vimrc "+Vader!
+ test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader"'
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8df52844..26129564 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -129,7 +129,7 @@ giving some unfair preference to any particular tool or language.
The "online documentation" file used for this project lives in `doc/ale.txt`.
This is the file used for generating `:help` text inside Vim itself. There are
-some guidlines to follow for this file.
+some guidelines to follow for this file.
1. Keep all text within a column size of 79 characters, inclusive.
2. Open a section with 79 `=` or `-` characters, for headings and subheadings.
diff --git a/README.md b/README.md
index d0e2024f..a8901785 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
-# Asynchronous Lint Engine [![Build Status](https://travis-ci.org/w0rp/ale.svg?branch=master)](https://travis-ci.org/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/github/w0rp/ale?svg=true)](https://ci.appveyor.com/project/w0rp/ale)
+
![ALE Logo by Mark Grealish - https://www.bhalash.com/](img/logo.jpg?raw=true)
@@ -36,13 +37,14 @@ servers with similar enough protocols, like `tsserver`.
2. [How can I keep the sign gutter open?](#faq-keep-signs)
3. [How can I change the signs ALE uses?](#faq-change-signs)
4. [How can I show errors or warnings in my statusline?](#faq-statusline)
- 5. [How can I change the format for echo messages?](#faq-echo-format)
- 6. [How can I execute some code when ALE stops linting?](#faq-autocmd)
- 7. [How can I navigate between errors quickly?](#faq-navigation)
- 8. [How can I run linters only when I save files?](#faq-lint-on-save)
- 9. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
- 10. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
- 11. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
+ 5. [How can I show errors or warnings in my lightline?](#faq-lightline)
+ 6. [How can I change the format for echo messages?](#faq-echo-format)
+ 7. [How can I execute some code when ALE stops linting?](#faq-autocmd)
+ 8. [How can I navigate between errors quickly?](#faq-navigation)
+ 9. [How can I run linters only when I save files?](#faq-lint-on-save)
+ 10. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
+ 11. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
+ 12. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
<a name="supported-languages"></a>
@@ -69,7 +71,7 @@ formatting.
| -------- | ----- |
| ASM | [gcc](https://gcc.gnu.org) |
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
-| AsciiDoc | [proselint](http://proselint.com/) |
+| AsciiDoc | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
| Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
@@ -97,36 +99,38 @@ formatting.
| GraphQL | [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) |
-| HTML | [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/) |
+| 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) |
+| 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) |
| JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [flow](https://flowtype.org/), [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 |
-| LaTeX | [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/) |
+| LaTeX | [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
-| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
+| Mail | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
+| Make | [checkmake](https://github.com/mrtazz/checkmake) |
+| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [remark-lint](https://github.com/wooorm/remark-lint) !!, [write-good](https://github.com/btford/write-good) |
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
-| nroff | [proselint](http://proselint.com/)|
+| nroff | [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/) |
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions |
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
-| PHP | [hack](http://hacklang.org/), [langserver](https://github.com/felixfbecker/php-language-server), [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) |
-| Pod | [proselint](http://proselint.com/)|
+| PHP | [hack](http://hacklang.org/), [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) |
+| Pod | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
| 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/), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
| R | [lintr](https://github.com/jimhester/lintr) |
| 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/), [write-good](https://github.com/btford/write-good) |
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) |
-| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/) |
+| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
| SCSS | [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint), [prettier](https://github.com/prettier/prettier) |
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
@@ -137,15 +141,15 @@ formatting.
| SQL | [sqlint](https://github.com/purcell/sqlint) |
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
-| Texinfo | [proselint](http://proselint.com/)|
-| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
+| Texinfo | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
+| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| Thrift | [thrift](http://thrift.apache.org/) |
| TypeScript | [eslint](http://eslint.org/), [tslint](https://github.com/palantir/tslint), tsserver, typecheck, [prettier](https://github.com/prettier/prettier) |
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
| Vim | [vint](https://github.com/Kuniwak/vint) |
-| Vim help^ | [proselint](http://proselint.com/)|
-| XHTML | [proselint](http://proselint.com/)|
-| XML | [xmllint](http://xmlsoft.org/xmllint.html)|
+| Vim help^ | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
+| XHTML | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
+| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
<a name="usage"></a>
@@ -408,9 +412,70 @@ set statusline=%{LinterStatus()}
See `:help ale#statusline#Count()` for more information.
+<a name="faq-lightline"></a>
+
+### 5.v. How can I show errors or warnings in my lightline?
+
+[lightline](https://github.com/itchyny/lightline.vim) does not have built-in
+support for ALE, nevertheless it's easy to do it yourself:
+
+```vim
+" This is regular lightline configuration, we just added
+" 'linter_warnings', 'linter_errors' and 'linter_ok' to
+" the active right panel. Feel free to move it anywhere.
+" `component_expand' and `component_type' are required.
+"
+" For more info on how this works, see lightline documentation.
+let g:lightline = {
+ \ 'active': {
+ \ 'right': [ [ 'lineinfo' ],
+ \ [ 'percent' ],
+ \ [ 'linter_warnings', 'linter_errors', 'linter_ok' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype' ] ]
+ \ },
+ \ 'component_expand': {
+ \ 'linter_warnings': 'LightlineLinterWarnings',
+ \ 'linter_errors': 'LightlineLinterErrors',
+ \ 'linter_ok': 'LightlineLinterOK'
+ \ },
+ \ 'component_type': {
+ \ 'linter_warnings': 'warning',
+ \ 'linter_errors': 'error',
+ \ 'linter_ok': 'ok'
+ \ },
+ \ }
+
+autocmd User ALELint call lightline#update()
+
+" ale + lightline
+function! LightlineLinterWarnings() abort
+ let l:counts = ale#statusline#Count(bufnr(''))
+ let l:all_errors = l:counts.error + l:counts.style_error
+ let l:all_non_errors = l:counts.total - l:all_errors
+ return l:counts.total == 0 ? '' : printf('%d --', all_non_errors)
+endfunction
+
+function! LightlineLinterErrors() abort
+ let l:counts = ale#statusline#Count(bufnr(''))
+ let l:all_errors = l:counts.error + l:counts.style_error
+ let l:all_non_errors = l:counts.total - l:all_errors
+ return l:counts.total == 0 ? '' : printf('%d >>', all_errors)
+endfunction
+
+function! LightlineLinterOK() abort
+ let l:counts = ale#statusline#Count(bufnr(''))
+ let l:all_errors = l:counts.error + l:counts.style_error
+ let l:all_non_errors = l:counts.total - l:all_errors
+ return l:counts.total == 0 ? '✓' : ''
+endfunction
+```
+
+See `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration)
+for more information.
+
<a name="faq-echo-format"></a>
-### 5.v. How can I change the format for echo messages?
+### 5.vi. How can I change the format for echo messages?
There are 3 global options that allow customizing the echoed message.
@@ -435,7 +500,7 @@ Will give you:
<a name="faq-autocmd"></a>
-### 5.vi. How can I execute some code when ALE stops linting?
+### 5.vii. How can I execute some code when ALE stops linting?
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
event whenever has a linter has been successfully executed and processed. This
@@ -450,7 +515,7 @@ augroup END
<a name="faq-navigation"></a>
-### 5.vii. How can I navigate between errors quickly?
+### 5.viii. How can I navigate between errors quickly?
ALE offers some commands with `<Plug>` keybinds for moving between warnings and
errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors
@@ -466,7 +531,7 @@ For more information, consult the online documentation with
<a name="faq-lint-on-save"></a>
-### 5.viii. How can I run linters only when I save files?
+### 5.ix. How can I run linters only when I save files?
ALE offers an option `g:ale_lint_on_save` for enabling running the linters
when files are saved. This option is enabled by default. If you only
@@ -486,7 +551,7 @@ files, you can set `g:ale_lint_on_save` to `0`.
<a name="faq-quickfix"></a>
-### 5.ix. How can I use the quickfix list instead of the loclist?
+### 5.x. How can I use the quickfix list instead of the loclist?
The quickfix list can be enabled by turning the `g:ale_set_quickfix`
option on. If you wish to also disable the loclist, you can disable
@@ -513,7 +578,7 @@ let g:ale_keep_list_window_open = 1
<a name="faq-jsx-stylelint-eslint"></a>
-### 5.x. How can I check JSX files with both stylelint and eslint?
+### 5.xi. How can I check JSX files with both stylelint and eslint?
If you configure ALE options correctly in your vimrc file, and install
the right tools, you can check JSX files with stylelint and eslint.
@@ -546,7 +611,7 @@ no linter will be run twice for the same file.
<a name="faq-my-battery-is-sad"></a>
-### 5.xi. Will this plugin eat all of my laptop battery power?
+### 5.xii. Will this plugin eat all of my laptop battery power?
ALE takes advantage of the power of various tools to check your code. This of
course means that CPU time will be used to continuously check your code. If you
diff --git a/ale_linters/asciidoc/write-good.vim b/ale_linters/asciidoc/write-good.vim
new file mode 100644
index 00000000..c986cc6c
--- /dev/null
+++ b/ale_linters/asciidoc/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for AsciiDoc files
+
+call ale#linter#Define('asciidoc', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/haml/hamllint.vim b/ale_linters/haml/hamllint.vim
index b1a6aa57..d6633599 100644
--- a/ale_linters/haml/hamllint.vim
+++ b/ale_linters/haml/hamllint.vim
@@ -1,6 +1,31 @@
-" Author: Patrick Lewis - https://github.com/patricklewis
+" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman
" Description: haml-lint for Haml files
+function! ale_linters#haml#hamllint#GetCommand(buffer) abort
+ let l:prefix = ''
+
+ let l:rubocop_config_file_path = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
+ let l:hamllint_config_file_path = ale#path#FindNearestFile(a:buffer, '.haml-lint.yml')
+
+ " Set HAML_LINT_RUBOCOP_CONF variable as it is needed for haml-lint to
+ " pick up the rubocop config.
+ "
+ " See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89
+ " HamlLint::Linter::RuboCop#rubocop_flags
+ if !empty(l:rubocop_config_file_path)
+ if ale#Has('win32')
+ let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&'
+ else
+ let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path)
+ endif
+ endif
+
+ return (!empty(l:prefix) ? l:prefix . ' ' : '')
+ \ . 'haml-lint'
+ \ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '')
+ \ . ' %t'
+endfunction
+
function! ale_linters#haml#hamllint#Handle(buffer, lines) abort
" Matches patterns like the following:
" <path>:51 [W] RuboCop: Use the new Ruby 1.9 hash syntax.
@@ -21,6 +46,6 @@ endfunction
call ale#linter#Define('haml', {
\ 'name': 'hamllint',
\ 'executable': 'haml-lint',
-\ 'command': 'haml-lint %t',
+\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand',
\ 'callback': 'ale_linters#haml#hamllint#Handle'
\})
diff --git a/ale_linters/help/write-good.vim b/ale_linters/help/write-good.vim
new file mode 100644
index 00000000..11254cd2
--- /dev/null
+++ b/ale_linters/help/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for vim Help files
+
+call ale#linter#Define('help', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/html/write-good.vim b/ale_linters/html/write-good.vim
new file mode 100644
index 00000000..9fae8821
--- /dev/null
+++ b/ale_linters/html/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for nroff files
+
+call ale#linter#Define('html', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/mail/proselint.vim b/ale_linters/mail/proselint.vim
new file mode 100644
index 00000000..82c8d1f8
--- /dev/null
+++ b/ale_linters/mail/proselint.vim
@@ -0,0 +1,9 @@
+" Author: Daniel M. Capella https://github.com/polyzen
+" Description: proselint for mail files
+
+call ale#linter#Define('mail', {
+\ 'name': 'proselint',
+\ 'executable': 'proselint',
+\ 'command': 'proselint %t',
+\ 'callback': 'ale#handlers#unix#HandleAsWarning',
+\})
diff --git a/ale_linters/mail/vale.vim b/ale_linters/mail/vale.vim
new file mode 100644
index 00000000..9b30bf65
--- /dev/null
+++ b/ale_linters/mail/vale.vim
@@ -0,0 +1,9 @@
+" Author: chew-z https://github.com/chew-z
+" Description: vale for Markdown files
+
+call ale#linter#Define('mail', {
+\ 'name': 'vale',
+\ 'executable': 'vale',
+\ 'command': 'vale --output=line %t',
+\ 'callback': 'ale#handlers#unix#HandleAsWarning',
+\})
diff --git a/ale_linters/make/checkmake.vim b/ale_linters/make/checkmake.vim
new file mode 100644
index 00000000..3dd8cc91
--- /dev/null
+++ b/ale_linters/make/checkmake.vim
@@ -0,0 +1,24 @@
+" Author: aurieh - https://github.com/aurieh
+
+function! ale_linters#make#checkmake#Handle(buffer, lines) abort
+ let l:pattern = '\v^(\d+):(.+):(.+)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ let l:text = l:match[2] . ': ' . l:match[3]
+ call add(l:output, {
+ \ 'bufnr': a:buffer,
+ \ 'lnum': l:match[1] + 0,
+ \ 'type': 'E',
+ \ 'text': l:text,
+ \})
+ endfor
+ return l:output
+endfunction
+
+call ale#linter#Define('make', {
+\ 'name': 'checkmake',
+\ 'executable': 'checkmake',
+\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"',
+\ 'callback': 'ale_linters#make#checkmake#Handle',
+\})
diff --git a/ale_linters/markdown/remark_lint.vim b/ale_linters/markdown/remark_lint.vim
new file mode 100644
index 00000000..5b3b3d47
--- /dev/null
+++ b/ale_linters/markdown/remark_lint.vim
@@ -0,0 +1,28 @@
+" Author rhysd https://rhysd.github.io/
+" Description: remark-lint for Markdown files
+
+function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
+ " matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
+ let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': l:match[2] + 0,
+ \ 'type': l:match[3] is# 'error' ? 'E' : 'W',
+ \ 'text': l:match[4],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('markdown', {
+\ 'name': 'remark-lint',
+\ 'executable': 'remark',
+\ 'command': 'remark --no-stdout --no-color %s',
+\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
+\ 'lint_file': 1,
+\ 'output_stream': 'stderr',
+\})
diff --git a/ale_linters/markdown/write-good.vim b/ale_linters/markdown/write-good.vim
new file mode 100644
index 00000000..21dbff1a
--- /dev/null
+++ b/ale_linters/markdown/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for Markdown files
+
+call ale#linter#Define('markdown', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/nroff/write-good.vim b/ale_linters/nroff/write-good.vim
new file mode 100644
index 00000000..d318fb28
--- /dev/null
+++ b/ale_linters/nroff/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for nroff files
+
+call ale#linter#Define('nroff', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/php/phan.vim b/ale_linters/php/phan.vim
new file mode 100644
index 00000000..f3b3d48f
--- /dev/null
+++ b/ale_linters/php/phan.vim
@@ -0,0 +1,36 @@
+" Author: diegoholiveira <https://github.com/diegoholiveira>
+" Description: static analyzer for PHP
+
+" Define the minimum severity
+let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)
+
+function! ale_linters#php#phan#GetCommand(buffer) abort
+ return 'phan -y '
+ \ . ale#Var(a:buffer, 'php_phan_minimum_severity')
+ \ . ' %s'
+endfunction
+
+function! ale_linters#php#phan#Handle(buffer, lines) abort
+ " Matches against lines like the following:
+ "
+ " /path/to/some-filename.php:18 ERRORTYPE message
+ let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'text': l:match[3],
+ \ 'type': 'W',
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('php', {
+\ 'name': 'phan',
+\ 'executable': 'phan',
+\ 'command_callback': 'ale_linters#php#phan#GetCommand',
+\ 'callback': 'ale_linters#php#phan#Handle',
+\})
diff --git a/ale_linters/php/phpmd.vim b/ale_linters/php/phpmd.vim
index 29d8103a..e4192c70 100644
--- a/ale_linters/php/phpmd.vim
+++ b/ale_linters/php/phpmd.vim
@@ -14,7 +14,7 @@ function! ale_linters#php#phpmd#Handle(buffer, lines) abort
" Matches against lines like the following:
"
" /path/to/some-filename.php:18 message
- let l:pattern = '^.*:\(\d\+\)\t\(.\+\)$'
+ let l:pattern = '^.*:\(\d\+\)\s\+\(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
diff --git a/ale_linters/pod/write-good.vim b/ale_linters/pod/write-good.vim
new file mode 100644
index 00000000..14ed5c0c
--- /dev/null
+++ b/ale_linters/pod/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for Pod files
+
+call ale#linter#Define('pod', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/rst/write-good.vim b/ale_linters/rst/write-good.vim
new file mode 100644
index 00000000..12137dbf
--- /dev/null
+++ b/ale_linters/rst/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for reStructuredText files
+
+call ale#linter#Define('rst', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim
index f19061ad..c887ea79 100644
--- a/ale_linters/rust/cargo.vim
+++ b/ale_linters/rust/cargo.vim
@@ -26,6 +26,6 @@ call ale#linter#Define('rust', {
\ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable',
\ 'command_callback': 'ale_linters#rust#cargo#GetCommand',
\ 'callback': 'ale#handlers#rust#HandleRustErrors',
-\ 'output_stream': 'stdout',
+\ 'output_stream': 'both',
\ 'lint_file': 1,
\})
diff --git a/ale_linters/sh/shellcheck.vim b/ale_linters/sh/shellcheck.vim
index b47ba19f..68844a05 100644
--- a/ale_linters/sh/shellcheck.vim
+++ b/ale_linters/sh/shellcheck.vim
@@ -43,11 +43,12 @@ function! ale_linters#sh#shellcheck#GetCommand(buffer) abort
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
- return ale_linters#sh#shellcheck#GetExecutable(a:buffer)
+ return ale#path#BufferCdString(a:buffer)
+ \ . ale#Escape(ale_linters#sh#shellcheck#GetExecutable(a:buffer))
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
- \ . ' -f gcc -'
+ \ . ' -x -f gcc -'
endfunction
call ale#linter#Define('sh', {
diff --git a/ale_linters/tex/write-good.vim b/ale_linters/tex/write-good.vim
new file mode 100644
index 00000000..dc59de2e
--- /dev/null
+++ b/ale_linters/tex/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for TeX files
+
+call ale#linter#Define('tex', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/texinfo/write-good.vim b/ale_linters/texinfo/write-good.vim
new file mode 100644
index 00000000..8104c634
--- /dev/null
+++ b/ale_linters/texinfo/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for Texinfo files
+
+call ale#linter#Define('texinfo', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/text/write-good.vim b/ale_linters/text/write-good.vim
new file mode 100644
index 00000000..ff76ce42
--- /dev/null
+++ b/ale_linters/text/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for text files
+
+call ale#linter#Define('text', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/ale_linters/xhtml/write-good.vim b/ale_linters/xhtml/write-good.vim
new file mode 100644
index 00000000..83d1863b
--- /dev/null
+++ b/ale_linters/xhtml/write-good.vim
@@ -0,0 +1,9 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: write-good for XHTML files
+
+call ale#linter#Define('xhtml', {
+\ 'name': 'write-good',
+\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+\ 'command_callback': 'ale#handlers#writegood#GetCommand',
+\ 'callback': 'ale#handlers#writegood#Handle',
+\})
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 890d3df2..1b22df46 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -841,7 +841,7 @@ function! ale#engine#WaitForJobs(deadline) abort
" Gather all of the jobs from every buffer.
for l:info in values(g:ale_buffer_info)
- call extend(l:job_list, l:info.job_list)
+ call extend(l:job_list, get(l:info, 'job_list', []))
endfor
" NeoVim has a built-in API for this, so use that.
@@ -889,7 +889,7 @@ function! ale#engine#WaitForJobs(deadline) abort
" Check again to see if any jobs are running.
for l:info in values(g:ale_buffer_info)
- for l:job_id in l:info.job_list
+ for l:job_id in get(l:info, 'job_list', [])
if ale#job#IsRunning(l:job_id)
let l:has_new_jobs = 1
break
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 93ddf0f5..bbdcc430 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -27,6 +27,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['javascript', 'typescript'],
\ 'description': 'Apply eslint --fix to a file.',
\ },
+\ 'mix_format': {
+\ 'function': 'ale#fixers#mix_format#Fix',
+\ 'suggested_filetypes': ['elixir'],
+\ 'description': 'Apply mix format to a file.',
+\ },
\ 'format': {
\ 'function': 'ale#fixers#format#Fix',
\ 'suggested_filetypes': ['elm'],
@@ -39,7 +44,7 @@ let s:default_registry = {
\ },
\ 'prettier': {
\ 'function': 'ale#fixers#prettier#Fix',
-\ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'css', 'scss'],
+\ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'css', 'scss', 'less'],
\ 'description': 'Apply prettier to a file.',
\ },
\ 'prettier_eslint': {
@@ -107,6 +112,16 @@ let s:default_registry = {
\ 'suggested_filetypes': ['typescript'],
\ 'description': 'Fix typescript files with tslint --fix.',
\ },
+\ 'rustfmt': {
+\ 'function': 'ale#fixers#rustfmt#Fix',
+\ 'suggested_filetypes': ['rust'],
+\ 'description': 'Fix Rust files with Rustfmt.',
+\ },
+\ 'hfmt': {
+\ 'function': 'ale#fixers#hfmt#Fix',
+\ 'suggested_filetypes': ['haskell'],
+\ 'description': 'Fix Haskell files with hfmt.',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/hfmt.vim b/autoload/ale/fixers/hfmt.vim
new file mode 100644
index 00000000..ea061da4
--- /dev/null
+++ b/autoload/ale/fixers/hfmt.vim
@@ -0,0 +1,16 @@
+" Author: zack <zack@kourouma.me>
+" Description: Integration of hfmt with ALE.
+
+call ale#Set('haskell_hfmt_executable', 'hfmt')
+
+function! ale#fixers#hfmt#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' -w'
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
+
diff --git a/autoload/ale/fixers/mix_format.vim b/autoload/ale/fixers/mix_format.vim
new file mode 100644
index 00000000..04866408
--- /dev/null
+++ b/autoload/ale/fixers/mix_format.vim
@@ -0,0 +1,16 @@
+" Author: carakan <carakan@gmail.com>
+" Description: Fixing files with elixir formatter 'mix format'.
+
+call ale#Set('elixir_mix_executable', 'mix')
+
+function! ale#fixers#mix_format#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'elixir_mix_executable')
+endfunction
+
+function! ale#fixers#mix_format#Fix(buffer) abort
+ return {
+ \ 'command': ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer))
+ \ . ' format %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/fixers/prettier.vim b/autoload/ale/fixers/prettier.vim
index 4adc3b08..d66e00f0 100644
--- a/autoload/ale/fixers/prettier.vim
+++ b/autoload/ale/fixers/prettier.vim
@@ -49,7 +49,7 @@ function! ale#fixers#prettier#Fix(buffer) abort
if match(l:options, '--parser') == -1
if l:filetype is# 'typescript'
let l:parser = 'typescript'
- elseif l:filetype =~# 'css\|scss'
+ elseif l:filetype =~# 'css\|scss\|less'
let l:parser = 'postcss'
elseif l:filetype is# 'json'
let l:parser = 'json'
diff --git a/autoload/ale/fixers/rustfmt.vim b/autoload/ale/fixers/rustfmt.vim
new file mode 100644
index 00000000..fb5ac61c
--- /dev/null
+++ b/autoload/ale/fixers/rustfmt.vim
@@ -0,0 +1,17 @@
+" Author: Kelly Fox <kelly@bumfuddled.com>
+" Description: Integration of rustfmt with ALE.
+
+call ale#Set('rust_rustfmt_executable', 'rustfmt')
+call ale#Set('rust_rustfmt_options', '')
+
+function! ale#fixers#rustfmt#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'rust_rustfmt_executable')
+ let l:options = ale#Var(a:buffer, 'rust_rustfmt_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/gradle.vim b/autoload/ale/gradle.vim
index 89b56a82..dc377fb9 100644
--- a/autoload/ale/gradle.vim
+++ b/autoload/ale/gradle.vim
@@ -2,20 +2,30 @@
" Description: Functions for working with Gradle projects.
let s:script_path = fnamemodify(resolve(expand('<sfile>:p')), ':h')
+let s:init_path = has('win32')
+\ ? s:script_path . '\gradle\init.gradle'
+\ : s:script_path . '/gradle/init.gradle'
+
+function! ale#gradle#GetInitPath() abort
+ return s:init_path
+endfunction
" Given a buffer number, find a Gradle project root.
function! ale#gradle#FindProjectRoot(buffer) abort
let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew')
+
if !empty(l:gradlew_path)
return fnamemodify(l:gradlew_path, ':h')
endif
let l:settings_path = ale#path#FindNearestFile(a:buffer, 'settings.gradle')
+
if !empty(l:settings_path)
return fnamemodify(l:settings_path, ':h')
endif
let l:build_path = ale#path#FindNearestFile(a:buffer, 'build.gradle')
+
if !empty(l:build_path)
return fnamemodify(l:build_path, ':h')
endif
@@ -28,6 +38,7 @@ endfunction
" command. Returns an empty string if cannot find the executable.
function! ale#gradle#FindExecutable(buffer) abort
let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew')
+
if !empty(l:gradlew_path)
return l:gradlew_path
endif
@@ -47,7 +58,9 @@ function! ale#gradle#BuildClasspathCommand(buffer) abort
if !empty(l:executable) && !empty(l:project_root)
return ale#path#CdString(l:project_root)
- \ . l:executable . ' -I ' . s:script_path . '/gradle/init.gradle -q printClasspath'
+ \ . ale#Escape(l:executable)
+ \ . ' -I ' . ale#Escape(s:init_path)
+ \ . ' -q printClasspath'
endif
return ''
diff --git a/autoload/ale/handlers/gcc.vim b/autoload/ale/handlers/gcc.vim
index ad5cab39..256cd01d 100644
--- a/autoload/ale/handlers/gcc.vim
+++ b/autoload/ale/handlers/gcc.vim
@@ -5,17 +5,6 @@ scriptencoding utf-8
let s:pragma_error = '#pragma once in main file'
-function! s:AddIncludedErrors(output, include_lnum, include_lines) abort
- if a:include_lnum > 0
- call add(a:output, {
- \ 'lnum': a:include_lnum,
- \ 'type': 'E',
- \ 'text': 'Problems were found in the header (See :ALEDetail)',
- \ 'detail': join(a:include_lines, "\n"),
- \})
- endif
-endfunction
-
function! s:IsHeaderFile(filename) abort
return a:filename =~? '\v\.(h|hpp)$'
endfunction
@@ -42,10 +31,6 @@ function! ale#handlers#gcc#ParseGCCVersion(lines) abort
endfunction
function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
- let l:include_pattern = '\v^(In file included | *)from ([^:]*):(\d+)'
- let l:include_lnum = 0
- let l:include_lines = []
- let l:included_filename = ''
" Look for lines like the following.
"
" <stdin>:8:5: warning: conversion lacks type at end of format [-Wformat=]
@@ -54,68 +39,43 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$'
let l:output = []
- for l:line in a:lines
- let l:match = matchlist(l:line, l:pattern)
-
- if empty(l:match)
- " Check for matches in includes.
- " We will keep matching lines until we hit the last file, which
- " is our file.
- let l:include_match = matchlist(l:line, l:include_pattern)
-
- if empty(l:include_match)
- " If this isn't another include header line, then we
- " need to collect it.
- call add(l:include_lines, l:line)
- else
- " GCC and clang return the lists of files in different orders,
- " so we'll only grab the line number from lines which aren't
- " header files.
- if !s:IsHeaderFile(l:include_match[2])
- " Get the line number out of the parsed include line,
- " and reset the other variables.
- let l:include_lnum = str2nr(l:include_match[3])
- endif
-
- let l:include_lines = []
- let l:included_filename = ''
- endif
- elseif l:include_lnum > 0
- \&& (empty(l:included_filename) || l:included_filename is# l:match[1])
- " If we hit the first error after an include header, or the
- " errors below have the same name as the first filename we see,
- " then include these lines, and remember what that filename was.
- let l:included_filename = l:match[1]
- call add(l:include_lines, l:line)
- else
- " If we hit a regular error again, then add the previously
- " collected lines as one error, and reset the include variables.
- call s:AddIncludedErrors(l:output, l:include_lnum, l:include_lines)
- let l:include_lnum = 0
- let l:include_lines = []
- let l:included_filename = ''
-
- if s:IsHeaderFile(bufname(bufnr('')))
- \&& l:match[5][:len(s:pragma_error) - 1] is# s:pragma_error
- continue
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ " Filter out the pragma errors
+ if s:IsHeaderFile(bufname(bufnr('')))
+ \&& l:match[5][:len(s:pragma_error) - 1] is# s:pragma_error
+ continue
+ endif
+
+ " If the 'error type' is a note, make it detail related to
+ " the previous error parsed in output
+ if l:match[4] is# 'note'
+ if !empty(l:output)
+ let l:output[-1]['detail'] =
+ \ get(l:output[-1], 'detail', '')
+ \ . s:RemoveUnicodeQuotes(l:match[0]) . "\n"
endif
- let l:item = {
- \ 'lnum': str2nr(l:match[2]),
- \ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
- \ 'text': s:RemoveUnicodeQuotes(l:match[5]),
- \}
+ continue
+ endif
- if !empty(l:match[3])
- let l:item.col = str2nr(l:match[3])
- endif
+ let l:item = {
+ \ 'lnum': str2nr(l:match[2]),
+ \ 'type': l:match[4] is# 'error' ? 'E' : 'W',
+ \ 'text': s:RemoveUnicodeQuotes(l:match[5]),
+ \}
- call add(l:output, l:item)
+ if !empty(l:match[3])
+ let l:item.col = str2nr(l:match[3])
endif
- endfor
- " Add remaining include errors after we go beyond the last line.
- call s:AddIncludedErrors(l:output, l:include_lnum, l:include_lines)
+ " If the filename is something like <stdin>, <nofile> or -, then
+ " this is an error for the file we checked.
+ if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
+ let l:item['filename'] = l:match[1]
+ endif
+
+ call add(l:output, l:item)
+ endfor
return l:output
endfunction
diff --git a/autoload/ale/handlers/writegood.vim b/autoload/ale/handlers/writegood.vim
new file mode 100644
index 00000000..f9d452ea
--- /dev/null
+++ b/autoload/ale/handlers/writegood.vim
@@ -0,0 +1,61 @@
+" Author: Sumner Evans <sumner.evans98@gmail.com>
+" Description: Error handling for errors in the write-good format.
+
+function! ale#handlers#writegood#ResetOptions() abort
+ call ale#Set('writegood_options', '')
+ call ale#Set('writegood_executable', 'write-good')
+ call ale#Set('writegood_use_global', 0)
+endfunction
+
+" Reset the options so the tests can test how they are set.
+call ale#handlers#writegood#ResetOptions()
+
+function! ale#handlers#writegood#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'writegood', [
+ \ 'node_modules/.bin/write-good',
+ \ 'node_modules/write-good/bin/write-good.js',
+ \])
+endfunction
+
+function! ale#handlers#writegood#GetCommand(buffer) abort
+ let l:executable = ale#handlers#writegood#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'writegood_options')
+
+ return ale#node#Executable(a:buffer, l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' %t'
+endfunction
+
+function! ale#handlers#writegood#Handle(buffer, lines) abort
+ " Look for lines like the following.
+ "
+ " "it is" is wordy or unneeded on line 20 at column 53
+ " "easily" can weaken meaning on line 154 at column 29
+ let l:marks_pattern = '\v^ *(\^+) *$'
+ let l:pattern = '\v^(".*"\s.*)\son\sline\s(\d+)\sat\scolumn\s(\d+)$'
+ let l:output = []
+ let l:last_len = 0
+
+ for l:match in ale#util#GetMatches(a:lines, [l:marks_pattern, l:pattern])
+ if empty(l:match[2])
+ let l:last_len = len(l:match[1])
+ else
+ let l:col = l:match[3] + 1
+
+ " Add the linter error. Note that we need to add 1 to the col because
+ " write-good reports the column corresponding to the space before the
+ " offending word or phrase.
+ call add(l:output, {
+ \ 'text': l:match[1],
+ \ 'lnum': l:match[2] + 0,
+ \ 'col': l:col,
+ \ 'end_col': l:last_len ? (l:col + l:last_len - 1) : l:col,
+ \ 'type': 'W',
+ \})
+
+ let l:last_len = 0
+ endif
+ endfor
+
+ return l:output
+endfunction
diff --git a/doc/ale-asciidoc.txt b/doc/ale-asciidoc.txt
new file mode 100644
index 00000000..b6b64fd3
--- /dev/null
+++ b/doc/ale-asciidoc.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE AsciiDoc Integration *ale-asciidoc-options*
+
+
+===============================================================================
+write-good *ale-asciidoc-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-elixir.txt b/doc/ale-elixir.txt
new file mode 100644
index 00000000..a5318c0f
--- /dev/null
+++ b/doc/ale-elixir.txt
@@ -0,0 +1,17 @@
+===============================================================================
+ALE Elixir Integration *ale-elixir-options*
+
+
+===============================================================================
+mix *ale-elixir-mix*
+
+g:ale_elixir_mix_options *g:ale_elixir_mix_options*
+ *b:ale_elixir_mix_options*
+ Type: |String|
+ Default: `'mix'`
+
+
+ This variable can be changed to specify the mix executable.
+
+===============================================================================
+ vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-haskell.txt b/doc/ale-haskell.txt
index bbf99fcf..4a490efc 100644
--- a/doc/ale-haskell.txt
+++ b/doc/ale-haskell.txt
@@ -21,6 +21,16 @@ g:ale_haskell_hdevtools_options *g:ale_haskell_hdevtools_options*
This variable can be changed to modify flags given to hdevtools.
===============================================================================
+hfmt *ale-haskell-hfmt*
+
+g:ale_haskell_hfmt_executable *g:ale_haskell_hfmt_executable*
+ *b:ale_haskell_hfmt_executable*
+ Type: |String|
+ Default: `'hfmt'`
+
+ This variable can be changed to use a different executable for hfmt.
+
+===============================================================================
stack-build *ale-haskell-stack-build*
g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options*
diff --git a/doc/ale-html.txt b/doc/ale-html.txt
index e6f3398f..14e705e0 100644
--- a/doc/ale-html.txt
+++ b/doc/ale-html.txt
@@ -57,4 +57,10 @@ g:ale_html_tidy_options *g:ale_html_tidy_options*
===============================================================================
+write-good *ale-html-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-latex.txt b/doc/ale-latex.txt
new file mode 100644
index 00000000..87fbd4e8
--- /dev/null
+++ b/doc/ale-latex.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE LaTeX Integration *ale-latex-options*
+
+
+===============================================================================
+write-good *ale-latex-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-less.txt b/doc/ale-less.txt
new file mode 100644
index 00000000..a6b5998e
--- /dev/null
+++ b/doc/ale-less.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE Less Integration *ale-less-options*
+
+
+===============================================================================
+prettier *ale-less-prettier*
+
+See |ale-javascript-prettier| for information about the available options.
+
+
+===============================================================================
+
diff --git a/doc/ale-markdown.txt b/doc/ale-markdown.txt
new file mode 100644
index 00000000..3ce9619c
--- /dev/null
+++ b/doc/ale-markdown.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE Markdown Integration *ale-markdown-options*
+
+
+===============================================================================
+write-good *ale-markdown-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-nroff.txt b/doc/ale-nroff.txt
new file mode 100644
index 00000000..62ec7896
--- /dev/null
+++ b/doc/ale-nroff.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE nroff Integration *ale-nroff-options*
+
+
+===============================================================================
+write-good *ale-nroff-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+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 bae6d7d0..8756d60e 100644
--- a/doc/ale-php.txt
+++ b/doc/ale-php.txt
@@ -35,6 +35,21 @@ g:ale_php_langserver_use_global *g:ale_php_langserver_use_global*
===============================================================================
+phan *ale-php-phan*
+
+WARNING: please do not use this linter if you have an configuration file
+for your project because the phan will look into your entirely project and
+ale will display in the current buffer warnings that may belong to other file.
+
+g:ale_php_phan_minimum_severity *g:ale_php_phan_minimum_severity*
+ *b:ale_php_phan_minimum_severity*
+ Type: |Number|
+ Default: `0`
+
+ This variable defines the minimum severity level
+
+
+===============================================================================
phpcbf *ale-php-phpcbf*
g:ale_php_phpcbf_executable *g:ale_php_phpcbf_executable*
diff --git a/doc/ale-pod.txt b/doc/ale-pod.txt
new file mode 100644
index 00000000..c7cc0bbc
--- /dev/null
+++ b/doc/ale-pod.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE Pod Integration *ale-pod-options*
+
+
+===============================================================================
+write-good *ale-pod-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-python.txt b/doc/ale-python.txt
index a8d033e2..755094a3 100644
--- a/doc/ale-python.txt
+++ b/doc/ale-python.txt
@@ -174,7 +174,7 @@ g:ale_python_pylint_options *g:ale_python_pylint_options*
Python 3, you may want to set >
let g:ale_python_pylint_executable = 'python3' " or 'python' for Python 2
- let g:ale_python_pylint_options = '-rcfile /path/to/pylint.rc'
+ let g:ale_python_pylint_options = '--rcfile /path/to/pylint.rc'
" The virtualenv detection needs to be disabled.
let g:ale_python_pylint_use_global = 0
diff --git a/doc/ale-restructuredtext.txt b/doc/ale-restructuredtext.txt
new file mode 100644
index 00000000..02fbc4ad
--- /dev/null
+++ b/doc/ale-restructuredtext.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE reStructuredText Integration *ale-restructuredtext-options*
+
+
+===============================================================================
+write-good *ale-restructuredtext-write-good*
+
+See |ale-write-good-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 52dc3d61..e20aea2c 100644
--- a/doc/ale-rust.txt
+++ b/doc/ale-rust.txt
@@ -22,6 +22,8 @@ Integration Information
over cargo. rls implements the Language Server Protocol for incremental
compilation of Rust code, and can check Rust files while you type. `rls`
requires Rust files to contained in Cargo projects.
+ 4. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
+ consistently reformat your Rust code.
Only cargo is enabled by default. To switch to using rustc instead of cargo,
configure |g:ale_linters| appropriately: >
@@ -71,4 +73,15 @@ g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes*
===============================================================================
+rustfmt *ale-rust-rustfmt*
+
+g:ale_rust_rustfmt_options *g:ale_rust_rustfmt_options*
+ *b:ale_rust_rustfmt_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be set to pass additional options to the rustfmt fixer.
+
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-texinfo.txt b/doc/ale-texinfo.txt
new file mode 100644
index 00000000..f8ed342d
--- /dev/null
+++ b/doc/ale-texinfo.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE Texinfo Integration *ale-texinfo-options*
+
+
+===============================================================================
+write-good *ale-texinfo-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-text.txt b/doc/ale-text.txt
new file mode 100644
index 00000000..a4dfa5e2
--- /dev/null
+++ b/doc/ale-text.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE Text Integration *ale-text-options*
+
+
+===============================================================================
+write-good *ale-text-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-vim-help.txt b/doc/ale-vim-help.txt
new file mode 100644
index 00000000..3cbe20d5
--- /dev/null
+++ b/doc/ale-vim-help.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE Vim help Integration *ale-vim-help-options*
+
+
+===============================================================================
+write-good *ale-vim-help-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-xhtml.txt b/doc/ale-xhtml.txt
new file mode 100644
index 00000000..3cc639ef
--- /dev/null
+++ b/doc/ale-xhtml.txt
@@ -0,0 +1,12 @@
+===============================================================================
+ALE XHTML Integration *ale-xhtml-options*
+
+
+===============================================================================
+write-good *ale-xhtml-write-good*
+
+See |ale-write-good-options|
+
+
+===============================================================================
+vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale.txt b/doc/ale.txt
index eaae2842..1bc639b8 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -13,7 +13,10 @@ CONTENTS *ale-contents*
5. Completion...........................|ale-completion|
6. Global Options.......................|ale-options|
6.1 Highlights........................|ale-highlights|
+ 6.2 Options for write-good Linter.....|ale-write-good-options|
7. Integration Documentation............|ale-integrations|
+ asciidoc..............................|ale-asciidoc-options|
+ write-good..........................|ale-asciidoc-write-good|
asm...................................|ale-asm-options|
gcc.................................|ale-asm-gcc|
awk...................................|ale-awk-options|
@@ -48,6 +51,8 @@ CONTENTS *ale-contents*
dartanalyzer........................|ale-dart-dartanalyzer|
dockerfile............................|ale-dockerfile-options|
hadolint............................|ale-dockerfile-hadolint|
+ elixir................................|ale-elixir-options|
+ mix.................................|ale-elixir-mix|
elm...................................|ale-elm-options|
elm-format..........................|ale-elm-elm-format|
elm-make............................|ale-elm-elm-make|
@@ -70,10 +75,12 @@ CONTENTS *ale-contents*
ember-template-lint.................|ale-handlebars-embertemplatelint|
haskell...............................|ale-haskell-options|
hdevtools...........................|ale-haskell-hdevtools|
+ hfmt................................|ale-haskell-hfmt|
stack-build.........................|ale-haskell-stack-build|
html..................................|ale-html-options|
htmlhint............................|ale-html-htmlhint|
tidy................................|ale-html-tidy|
+ write-good..........................|ale-html-write-good|
idris.................................|ale-idris-options|
idris...............................|ale-idris-idris|
java..................................|ale-java-options|
@@ -95,10 +102,18 @@ CONTENTS *ale-contents*
kotlin................................|ale-kotlin-options|
kotlinc.............................|ale-kotlin-kotlinc|
ktlint..............................|ale-kotlin-ktlint|
+ latex.................................|ale-latex-options|
+ write-good..........................|ale-latex-write-good|
+ less..................................|ale-less-options|
+ prettier............................|ale-less-prettier|
llvm..................................|ale-llvm-options|
llc.................................|ale-llvm-llc|
lua...................................|ale-lua-options|
luacheck............................|ale-lua-luacheck|
+ markdown..............................|ale-markdown-options|
+ write-good..........................|ale-markdown-write-good|
+ nroff.................................|ale-nroff-options|
+ write-good..........................|ale-nroff-write-good|
objc..................................|ale-objc-options|
clang...............................|ale-objc-clang|
objcpp................................|ale-objcpp-options|
@@ -111,10 +126,13 @@ CONTENTS *ale-contents*
php...................................|ale-php-options|
hack................................|ale-php-hack|
langserver..........................|ale-php-langserver|
+ phan................................|ale-php-phan|
phpcbf..............................|ale-php-phpcbf|
phpcs...............................|ale-php-phpcs|
phpmd...............................|ale-php-phpmd|
phpstan.............................|ale-php-phpstan|
+ pod...................................|ale-pod-options|
+ write-good..........................|ale-pod-write-good|
pug...................................|ale-pug-options|
puglint.............................|ale-pug-puglint|
puppet................................|ale-puppet-options|
@@ -131,6 +149,8 @@ CONTENTS *ale-contents*
lintr...............................|ale-r-lintr|
reasonml..............................|ale-reasonml-options|
merlin..............................|ale-reasonml-merlin|
+ restructuredtext......................|ale-restructuredtext-options|
+ write-good..........................|ale-restructuredtext-write-good|
ruby..................................|ale-ruby-options|
brakeman............................|ale-ruby-brakeman|
rails_best_practices................|ale-ruby-rails_best_practices|
@@ -140,6 +160,7 @@ CONTENTS *ale-contents*
cargo...............................|ale-rust-cargo|
rls.................................|ale-rust-rls|
rustc...............................|ale-rust-rustc|
+ rustfmt.............................|ale-rust-rustfmt|
sass..................................|ale-sass-options|
stylelint...........................|ale-sass-stylelint|
scala.................................|ale-scala-options|
@@ -163,6 +184,10 @@ CONTENTS *ale-contents*
tex...................................|ale-tex-options|
chktex..............................|ale-tex-chktex|
lacheck.............................|ale-tex-lacheck|
+ texinfo...............................|ale-texinfo-options|
+ write-good..........................|ale-texinfo-write-good|
+ text..................................|ale-text-options|
+ write-good..........................|ale-text-write-good|
thrift................................|ale-thrift-options|
thrift..............................|ale-thrift-thrift|
typescript............................|ale-typescript-options|
@@ -175,6 +200,10 @@ CONTENTS *ale-contents*
verilator...........................|ale-verilog-verilator|
vim...................................|ale-vim-options|
vint................................|ale-vim-vint|
+ vim help..............................|ale-vim-help-options|
+ write-good..........................|ale-vim-help-write-good|
+ xhtml.................................|ale-xhtml-options|
+ write-good..........................|ale-xhtml-write-good|
xml...................................|ale-xml-options|
xmllint.............................|ale-xml-xmllint|
yaml..................................|ale-yaml-options|
@@ -221,7 +250,7 @@ Notes:
* ASM: `gcc`
* Ansible: `ansible-lint`
-* AsciiDoc: `proselint`
+* AsciiDoc: `proselint`, `write-good`
* Awk: `gawk`
* Bash: `shell` (-n flag), `shellcheck`
* Bourne Shell: `shell` (-n flag), `shellcheck`
@@ -249,36 +278,38 @@ Notes:
* GraphQL: `gqlint`
* Haml: `haml-lint`
* Handlebars: `ember-template-lint`
-* Haskell: `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`
-* HTML: `HTMLHint`, `proselint`, `tidy`
+* Haskell: `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`
+* HTML: `HTMLHint`, `proselint`, `tidy`, `write-good`
* Idris: `idris`
* Java: `checkstyle`, `javac`
* JavaScript: `eslint`, `jscs`, `jshint`, `flow`, `prettier`, `prettier-eslint` >= 4.2.0, `prettier-standard`, `standard`, `xo`
* JSON: `jsonlint`, `prettier`
* Kotlin: `kotlinc`, `ktlint`
-* LaTeX (tex): `chktex`, `lacheck`, `proselint`
+* LaTeX (tex): `chktex`, `lacheck`, `proselint`, `write-good`
* LLVM: `llc`
* Lua: `luacheck`
-* Markdown: `mdl`, `proselint`, `vale`
+* Mail: `proselint`, `vale`
+* Make: `checkmake`
+* Markdown: `mdl`, `proselint`, `vale`, `remark-lint`, `write-good`
* MATLAB: `mlint`
* Nim: `nim check`!!
* nix: `nix-instantiate`
-* nroff: `proselint`
+* nroff: `proselint`, `write-good`
* Objective-C: `clang`
* Objective-C++: `clang`
* OCaml: `merlin` (see |ale-ocaml-merlin|)
* Perl: `perl -c`, `perl-critic`
-* PHP: `hack`, `langserver`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`
-* Pod: `proselint`
+* PHP: `hack`, `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`
+* Pod: `proselint`, `write-good`
* Pug: `pug-lint`
* Puppet: `puppet`, `puppet-lint`
* Python: `autopep8`, `flake8`, `isort`, `mypy`, `pycodestyle`, `pylint`!!, `yapf`
* R: `lintr`
* ReasonML: `merlin`
-* reStructuredText: `proselint`
+* reStructuredText: `proselint`, `write-good`
* RPM spec: `rpmlint`
* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`
-* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|)
+* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt`
* SASS: `sass-lint`, `stylelint`
* SCSS: `sass-lint`, `scss-lint`, `stylelint`, `prettier`
* Scala: `scalac`, `scalastyle`
@@ -289,14 +320,14 @@ Notes:
* SQL: `sqlint`
* Swift: `swiftlint`, `swiftformat`
* Tcl: `nagelfar`!!
-* Texinfo: `proselint`
-* Text^: `proselint`, `vale`
+* Texinfo: `proselint`, `write-good`
+* Text^: `proselint`, `vale`, `write-good`
* Thrift: `thrift`
* TypeScript: `eslint`, `tslint`, `tsserver`, `typecheck`, `prettier`
* Verilog: `iverilog`, `verilator`
* Vim: `vint`
-* Vim help^: `proselint`
-* XHTML: `proselint`
+* Vim help^: `proselint`, `write-good`
+* XHTML: `proselint`, `write-good`
* XML: `xmllint`
* YAML: `swaglint`, `yamllint`
@@ -593,6 +624,11 @@ g:ale_emit_conflict_warnings *g:ale_emit_conflict_warnings*
When set to `0`, ALE will not emit any warnings on startup about conflicting
plugins. ALE will probably not work if other linting plugins are installed.
+ When this option is set to `1`, ALE will add its `after` directory to
+ |runtimepath| automatically, so the checks can be applied. Setting this
+ option to `0` before ALE is loaded will prevent ALE from modifying
+ |runtimepath|.
+
g:ale_enabled *g:ale_enabled*
*b:ale_enabled*
@@ -1274,6 +1310,36 @@ ALEWarningSign *ALEWarningSign*
The highlight used for warning signs. See |g:ale_set_signs|.
+-------------------------------------------------------------------------------
+6.2. Options for write-good *ale-write-good-options*
+
+The options for the write-good linter are global because it does not make
+sense to have them specified on a per-language basis.
+
+g:ale_writegood_executable *g:ale_writegood_executable*
+ *b:ale_writegood_executable*
+ Type: |String|
+ Default: `'writegood'`
+
+ See |ale-integrations-local-executables|
+
+
+g:ale_writegood_options *g:ale_writegood_options*
+ *b:ale_writegood_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be set to pass additional options to writegood.
+
+
+g:ale_writegood_use_global *g:ale_writegood_use_global*
+ *b:ale_writegood_use_global*
+ Type: |Number|
+ Default: `0`
+
+ See |ale-integrations-local-executables|
+
+
===============================================================================
7. Integration Documentation *ale-integrations*
diff --git a/plugin/ale.vim b/plugin/ale.vim
index a0d9b271..52b3059b 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -32,8 +32,13 @@ if !s:has_features
finish
endif
-" Add the after directory to the runtimepath
-let &runtimepath .= ',' . expand('<sfile>:p:h:h') . '/after'
+" This flag can be set to 0 to disable emitting conflict warnings.
+let g:ale_emit_conflict_warnings = get(g:, 'ale_emit_conflict_warnings', 1)
+
+if g:ale_emit_conflict_warnings
+ " Add the after directory to the runtimepath
+ let &runtimepath .= ',' . expand('<sfile>:p:h:h') . '/after'
+endif
" Set this flag so that other plugins can use it, like airline.
let g:loaded_ale = 1
@@ -44,9 +49,6 @@ if has('unix') && empty($TMPDIR)
let $TMPDIR = '/tmp'
endif
-" This flag can be set to 0 to disable emitting conflict warnings.
-let g:ale_emit_conflict_warnings = get(g:, 'ale_emit_conflict_warnings', 1)
-
" This global variable is used internally by ALE for tracking information for
" each buffer which linters are being run against.
let g:ale_buffer_info = {}
diff --git a/test/command_callback/test_dartanalyzer_command_callback.vader b/test/command_callback/test_dartanalyzer_command_callback.vader
index c26028de..dbd8290c 100644
--- a/test/command_callback/test_dartanalyzer_command_callback.vader
+++ b/test/command_callback/test_dartanalyzer_command_callback.vader
@@ -35,6 +35,6 @@ Execute(The .packages file should be set if detected):
AssertEqual
\ ale#Escape('dartanalyzer')
- \ . ' --packages ' . ale#Escape(g:dir . '/dart_paths/.packages')
+ \ . ' --packages ' . ale#Escape(ale#path#Winify(g:dir . '/dart_paths/.packages'))
\ . ' %t',
\ ale_linters#dart#dartanalyzer#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_haml_hamllint_command_callback.vader b/test/command_callback/test_haml_hamllint_command_callback.vader
new file mode 100644
index 00000000..68aa1e62
--- /dev/null
+++ b/test/command_callback/test_haml_hamllint_command_callback.vader
@@ -0,0 +1,72 @@
+Before:
+ runtime ale_linters/haml/hamllint.vim
+
+ let g:default_command = 'haml-lint %t'
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+
+After:
+ Restore
+
+ unlet! g:default_command
+ unlet! b:conf
+
+ call ale#linter#Reset()
+ call ale#test#RestoreDirectory()
+
+Execute(The default command should be correct):
+ AssertEqual g:default_command, ale_linters#haml#hamllint#GetCommand(bufnr(''))
+
+Execute(The command should have the .rubocop.yml prepended as an env var if one exists):
+ call ale#test#SetFilename('../hamllint-test-files/rubocop-yml/subdir/file.haml')
+ let b:conf = ale#path#Winify(g:dir . '/../hamllint-test-files/rubocop-yml/.rubocop.yml')
+
+ if has('win32')
+ " Windows uses 'set var=... && command'
+ AssertEqual
+ \ 'set HAML_LINT_RUBOCOP_CONF='
+ \ . ale#Escape(b:conf)
+ \ . ' && ' . g:default_command,
+ \ ale_linters#haml#hamllint#GetCommand(bufnr(''))
+ else
+ " Unix uses 'var=... command'
+ AssertEqual
+ \ 'HAML_LINT_RUBOCOP_CONF='
+ \ . ale#Escape(b:conf)
+ \ . ' ' . g:default_command,
+ \ ale_linters#haml#hamllint#GetCommand(bufnr(''))
+ endif
+
+Execute(The command should have the nearest .haml-lint.yml set as --config if it exists):
+ call ale#test#SetFilename('../hamllint-test-files/haml-lint-yml/subdir/file.haml')
+ let b:conf = ale#path#Winify(g:dir . '/../hamllint-test-files/haml-lint-yml/.haml-lint.yml')
+
+ AssertEqual
+ \ 'haml-lint --config '
+ \ . ale#Escape(b:conf)
+ \ . ' %t',
+ \ ale_linters#haml#hamllint#GetCommand(bufnr(''))
+
+Execute(The command should include a .rubocop.yml and a .haml-lint if both are found):
+ call ale#test#SetFilename('../hamllint-test-files/haml-lint-and-rubocop/subdir/file.haml')
+ let b:conf_hamllint = ale#path#Winify(g:dir . '/../hamllint-test-files/haml-lint-and-rubocop/.haml-lint.yml')
+ let b:conf_rubocop = ale#path#Winify(g:dir . '/../hamllint-test-files/haml-lint-and-rubocop/.rubocop.yml')
+
+ if has('win32')
+ " Windows uses 'set var=... && command'
+ AssertEqual
+ \ 'set HAML_LINT_RUBOCOP_CONF='
+ \ . ale#Escape(b:conf_rubocop)
+ \ . ' && haml-lint --config '
+ \ . ale#Escape(b:conf_hamllint)
+ \ . ' %t',
+ \ ale_linters#haml#hamllint#GetCommand(bufnr(''))
+ else
+ " Unix uses 'var=... command'
+ AssertEqual
+ \ 'HAML_LINT_RUBOCOP_CONF='
+ \ . ale#Escape(b:conf_rubocop)
+ \ . ' haml-lint --config '
+ \ . ale#Escape(b:conf_hamllint)
+ \ . ' %t',
+ \ ale_linters#haml#hamllint#GetCommand(bufnr(''))
+ endif
diff --git a/test/command_callback/test_shellcheck_command_callback.vader b/test/command_callback/test_shellcheck_command_callback.vader
index 8e229056..13e9a2c1 100644
--- a/test/command_callback/test_shellcheck_command_callback.vader
+++ b/test/command_callback/test_shellcheck_command_callback.vader
@@ -9,6 +9,12 @@ Before:
runtime ale_linters/sh/shellcheck.vim
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('test.sh')
+
+ let b:prefix = 'cd ' . ale#Escape(ale#path#Winify(g:dir)) . ' && '
+ let b:suffix = ' -x -f gcc -'
+
After:
Restore
@@ -16,19 +22,22 @@ After:
unlet! b:ale_sh_shellcheck_executable
unlet! b:ale_sh_shellcheck_options
unlet! b:is_bash
+ unlet! b:prefix
+
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The default shellcheck command should be correct):
AssertEqual
- \ 'shellcheck -f gcc -',
+ \ b:prefix . ale#Escape('shellcheck') . b:suffix,
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
Execute(The shellcheck command should accept options):
let b:ale_sh_shellcheck_options = '--foobar'
AssertEqual
- \ 'shellcheck --foobar -f gcc -',
+ \ b:prefix . ale#Escape('shellcheck') . ' --foobar' . b:suffix,
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
Execute(The shellcheck command should accept options and exclusions):
@@ -36,14 +45,14 @@ Execute(The shellcheck command should accept options and exclusions):
let b:ale_sh_shellcheck_exclusions = 'foo,bar'
AssertEqual
- \ 'shellcheck --foobar -e foo,bar -f gcc -',
+ \ b:prefix . ale#Escape('shellcheck') . ' --foobar -e foo,bar' . b:suffix,
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
Execute(The shellcheck command should include the dialect):
let b:is_bash = 1
AssertEqual
- \ 'shellcheck -s bash -f gcc -',
+ \ b:prefix . ale#Escape('shellcheck') . ' -s bash' . b:suffix,
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
Execute(The shellcheck command should include the dialect before options and exclusions):
@@ -52,5 +61,8 @@ Execute(The shellcheck command should include the dialect before options and exc
let b:ale_sh_shellcheck_exclusions = 'foo,bar'
AssertEqual
- \ 'shellcheck -s bash --foobar -e foo,bar -f gcc -',
+ \ b:prefix
+ \ . ale#Escape('shellcheck')
+ \ . ' -s bash --foobar -e foo,bar'
+ \ . b:suffix,
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_write_good_command_callback.vader b/test/command_callback/test_write_good_command_callback.vader
new file mode 100644
index 00000000..d9f00495
--- /dev/null
+++ b/test/command_callback/test_write_good_command_callback.vader
@@ -0,0 +1,65 @@
+Before:
+ Save g:ale_writegood_options
+ Save g:ale_writegood_executable
+ Save g:ale_writegood_use_global
+
+ unlet! g:ale_writegood_options
+ unlet! g:ale_writegood_executable
+ unlet! g:ale_writegood_use_global
+
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('testfile.txt')
+
+ call ale#handlers#writegood#ResetOptions()
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The global executable should be used when the local one cannot be found):
+ AssertEqual 'write-good', ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('write-good') . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(The options should be used in the command):
+ let g:ale_writegood_options = '--foo --bar'
+
+ AssertEqual
+ \ ale#Escape('write-good') . ' --foo --bar %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(Should use the node_modules/.bin executable, if available):
+ call ale#test#SetFilename('write-good-node-modules/test.txt')
+
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'),
+ \ ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'))
+ \ . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(Should use the node_modules/write-good executable, if available):
+ call ale#test#SetFilename('write-good-node-modules-2/test.txt')
+
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'),
+ \ ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'))
+ \ . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(Should let users configure a global executable and override local paths):
+ call ale#test#SetFilename('write-good-node-modules-2/test.txt')
+
+ let g:ale_writegood_executable = 'foo-bar'
+ let g:ale_writegood_use_global = 1
+
+ AssertEqual 'foo-bar', ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('foo-bar') . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
diff --git a/test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js b/test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js
diff --git a/test/command_callback/write-good-node-modules/node_modules/.bin/write-good b/test/command_callback/write-good-node-modules/node_modules/.bin/write-good
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/write-good-node-modules/node_modules/.bin/write-good
diff --git a/test/elixir-test-files/testfile.ex b/test/elixir-test-files/testfile.ex
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/elixir-test-files/testfile.ex
diff --git a/test/fixers/test_hfmt_fixer_callback.vader b/test/fixers/test_hfmt_fixer_callback.vader
new file mode 100644
index 00000000..69cd03f8
--- /dev/null
+++ b/test/fixers/test_hfmt_fixer_callback.vader
@@ -0,0 +1,24 @@
+Before:
+ Save g:ale_haskell_hfmt_executable
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_haskell_hfmt_executable = 'xxxinvalid'
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The hfmt callback should return the correct default values):
+ call ale#test#SetFilename('../haskell_files/testfile.hs')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' -w'
+ \ . ' %t',
+ \ },
+ \ ale#fixers#hfmt#Fix(bufnr(''))
diff --git a/test/fixers/test_mix_format_fixer_callback.vader b/test/fixers/test_mix_format_fixer_callback.vader
new file mode 100644
index 00000000..c6c97c57
--- /dev/null
+++ b/test/fixers/test_mix_format_fixer_callback.vader
@@ -0,0 +1,20 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+ Save g:ale_elixir_mix_executable
+
+ let g:ale_elixir_mix_executable = 'xxxinvalid'
+
+After:
+ call ale#test#RestoreDirectory()
+
+Execute(The mix_format callback should return the correct default values):
+ call ale#test#SetFilename('../elixir-test-files/testfile.ex')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' format %t',
+ \ },
+ \ ale#fixers#mix_format#Fix(bufnr(''))
+
diff --git a/test/fixers/test_prettier_fixer_callback.vader b/test/fixers/test_prettier_fixer_callback.vader
index cc7d34d0..471a8632 100644
--- a/test/fixers/test_prettier_fixer_callback.vader
+++ b/test/fixers/test_prettier_fixer_callback.vader
@@ -114,3 +114,17 @@ Execute(Append '--parser postcss' for filetype=css):
\ . ' --write',
\ },
\ ale#fixers#prettier#Fix(bufnr(''))
+
+Execute(Append '--parser postcss' for filetype=less):
+ set filetype=less
+ call ale#test#SetFilename('../prettier-test-files/testfile.less')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
+ \ . ' %t'
+ \ . ' --parser postcss'
+ \ . ' --write',
+ \ },
+ \ ale#fixers#prettier#Fix(bufnr(''))
diff --git a/test/fixers/test_rustfmt_fixer_callback.vader b/test/fixers/test_rustfmt_fixer_callback.vader
new file mode 100644
index 00000000..36dd58a1
--- /dev/null
+++ b/test/fixers/test_rustfmt_fixer_callback.vader
@@ -0,0 +1,38 @@
+Before:
+ Save g:ale_rust_rustfmt_executable
+ Save g:ale_rust_rustfmt_options
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_rust_rustfmt_executable = 'xxxinvalid'
+ let g:ale_rust_rustfmt_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The rustfmt callback should return the correct default values):
+ call ale#test#SetFilename('../rust_files/testfile.rs')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' %t',
+ \ },
+ \ ale#fixers#rustfmt#Fix(bufnr(''))
+
+Execute(The rustfmt callback should include custom rustfmt options):
+ let g:ale_rust_rustfmt_options = "--skip-children"
+ call ale#test#SetFilename('../rust_files/testfile.rs')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' ' . g:ale_rust_rustfmt_options
+ \ . ' %t',
+ \ },
+ \ ale#fixers#rustfmt#Fix(bufnr(''))
diff --git a/test/hamllint-test-files/haml-lint-and-rubocop/.haml-lint.yml b/test/hamllint-test-files/haml-lint-and-rubocop/.haml-lint.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/hamllint-test-files/haml-lint-and-rubocop/.haml-lint.yml
diff --git a/test/hamllint-test-files/haml-lint-and-rubocop/.rubocop.yml b/test/hamllint-test-files/haml-lint-and-rubocop/.rubocop.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/hamllint-test-files/haml-lint-and-rubocop/.rubocop.yml
diff --git a/test/hamllint-test-files/haml-lint-and-rubocop/subdir/file.haml b/test/hamllint-test-files/haml-lint-and-rubocop/subdir/file.haml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/hamllint-test-files/haml-lint-and-rubocop/subdir/file.haml
diff --git a/test/hamllint-test-files/haml-lint-yml/.haml-lint.yml b/test/hamllint-test-files/haml-lint-yml/.haml-lint.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/hamllint-test-files/haml-lint-yml/.haml-lint.yml
diff --git a/test/hamllint-test-files/haml-lint-yml/subdir/file.haml b/test/hamllint-test-files/haml-lint-yml/subdir/file.haml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/hamllint-test-files/haml-lint-yml/subdir/file.haml
diff --git a/test/hamllint-test-files/rubocop-yml/.rubocop.yml b/test/hamllint-test-files/rubocop-yml/.rubocop.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/hamllint-test-files/rubocop-yml/.rubocop.yml
diff --git a/test/hamllint-test-files/rubocop-yml/subdir/file.haml b/test/hamllint-test-files/rubocop-yml/subdir/file.haml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/hamllint-test-files/rubocop-yml/subdir/file.haml
diff --git a/test/handler/test_checkmake_handler.vader b/test/handler/test_checkmake_handler.vader
new file mode 100644
index 00000000..61fe141a
--- /dev/null
+++ b/test/handler/test_checkmake_handler.vader
@@ -0,0 +1,19 @@
+Execute(Parsing checkmake errors should work):
+ runtime ale_linters/make/checkmake.vim
+ silent file Makefile
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'bufnr': 42,
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': 'woops: an error has occurred',
+ \ }
+ \ ],
+ \ ale_linters#make#checkmake#Handle(42, [
+ \ 'This shouldnt match',
+ \ '1:woops:an error has occurred',
+ \ ])
+After:
+ call ale#linter#Reset()
diff --git a/test/handler/test_clang_handler.vader b/test/handler/test_clang_handler.vader
index d28b9eb8..278737a8 100644
--- a/test/handler/test_clang_handler.vader
+++ b/test/handler/test_clang_handler.vader
@@ -2,15 +2,11 @@ Execute(clang errors from included files should be parsed correctly):
AssertEqual
\ [
\ {
- \ 'lnum': 3,
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'filename': './b.h',
\ 'type': 'E',
- \ 'text': 'Problems were found in the header (See :ALEDetail)',
- \ 'detail': join([
- \ './b.h:1:1: error: expected identifier or ''(''',
- \ '{{{',
- \ '^',
- \ '1 error generated.',
- \ ], "\n"),
+ \ 'text': 'expected identifier or ''(''',
\ },
\ ],
\ ale#handlers#gcc#HandleGCCFormat(347, [
diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader
index 2f60390c..9324273e 100644
--- a/test/handler/test_gcc_handler.vader
+++ b/test/handler/test_gcc_handler.vader
@@ -1,15 +1,21 @@
+Execute(The GCC handler should ignore other lines of output):
+ AssertEqual
+ \ [],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ 'foo',
+ \ 'bar',
+ \ 'baz',
+ \ ])
+
Execute(GCC errors from included files should be parsed correctly):
AssertEqual
\ [
\ {
- \ 'lnum': 3,
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'filename': 'broken.h',
\ 'type': 'E',
- \ 'text': 'Problems were found in the header (See :ALEDetail)',
- \ 'detail': join([
- \ 'broken.h:1:1: error: expected identifier or ''('' before ''{'' token',
- \ ' {{{',
- \ ' ^',
- \ ], "\n"),
+ \ 'text': 'expected identifier or ''('' before ''{'' token',
\ },
\ ],
\ ale#handlers#gcc#HandleGCCFormat(347, [
@@ -22,14 +28,11 @@ Execute(GCC errors from included files should be parsed correctly):
AssertEqual
\ [
\ {
- \ 'lnum': 3,
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'filename': 'b.h',
\ 'type': 'E',
- \ 'text': 'Problems were found in the header (See :ALEDetail)',
- \ 'detail': join([
- \ 'b.h:1:1: error: expected identifier or ''('' before ''{'' token',
- \ ' {{{',
- \ ' ^',
- \ ], "\n"),
+ \ 'text': 'expected identifier or ''('' before ''{'' token',
\ },
\ ],
\ ale#handlers#gcc#HandleGCCFormat(347, [
@@ -43,17 +46,18 @@ Execute(GCC errors from included files should be parsed correctly):
AssertEqual
\ [
\ {
- \ 'lnum': 3,
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'filename': 'b.h',
+ \ 'type': 'E',
+ \ 'text': 'unknown type name ''bad_type''',
+ \ },
+ \ {
+ \ 'lnum': 2,
+ \ 'col': 1,
+ \ 'filename': 'b.h',
\ 'type': 'E',
- \ 'text': 'Problems were found in the header (See :ALEDetail)',
- \ 'detail': join([
- \ 'b.h:1:1: error: unknown type name ‘bad_type’',
- \ ' bad_type x;',
- \ ' ^',
- \ 'b.h:2:1: error: unknown type name ‘other_bad_type’',
- \ ' other_bad_type y;',
- \ ' ^',
- \ ], "\n"),
+ \ 'text': 'unknown type name ''other_bad_type''',
\ },
\ ],
\ ale#handlers#gcc#HandleGCCFormat(347, [
@@ -133,3 +137,25 @@ Execute(The GCC handler should handle syntax errors):
\ '<stdin>:4: error: ''cat'' was not declared in this scope',
\ '<stdin>:12: error: expected `;'' before ''o''',
\ ])
+
+Execute(The GCC handler should handle notes with no previous message):
+ AssertEqual
+ \ [],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ '<stdin>:1:1: note: x',
+ \ '<stdin>:1:1: note: x',
+ \ ])
+
+Execute(The GCC handler should interpret - as being the current file):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 6,
+ \ 'col': 12,
+ \ 'type': 'E',
+ \ 'text': 'Some error',
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ '-:6:12: error: Some error',
+ \ ])
diff --git a/test/handler/test_php_phan_handler.vader b/test/handler/test_php_phan_handler.vader
new file mode 100644
index 00000000..68ed6d06
--- /dev/null
+++ b/test/handler/test_php_phan_handler.vader
@@ -0,0 +1,24 @@
+Before:
+ runtime ale_linters/php/phan.vim
+
+Execute(The php static analyzer handler should parse errors from phan):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 25,
+ \ 'type': 'W',
+ \ 'text': 'Return type of getValidator is undeclared type \Respect\Validation\Validator',
+ \ },
+ \ {
+ \ 'lnum': 66,
+ \ 'type': 'W',
+ \ 'text': 'Call to method string from undeclared class \Respect\Validation\Validator',
+ \ },
+ \ ],
+ \ ale_linters#php#phan#Handle(347, [
+ \ "example.php:25 PhanUndeclaredTypeReturnType Return type of getValidator is undeclared type \\Respect\\Validation\\Validator",
+ \ "example.php:66 PhanUndeclaredClassMethod Call to method string from undeclared class \\Respect\\Validation\\Validator",
+ \ ])
+
+After:
+ call ale#linter#Reset()
diff --git a/test/handler/test_php_phpmd_handler.vader b/test/handler/test_php_phpmd_handler.vader
new file mode 100644
index 00000000..be36f3db
--- /dev/null
+++ b/test/handler/test_php_phpmd_handler.vader
@@ -0,0 +1,24 @@
+Before:
+ runtime ale_linters/php/phpmd.vim
+
+Execute(The php static analyzer handler should parse errors from phpmd):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 22,
+ \ 'type': 'W',
+ \ 'text': "Avoid unused local variables such as '$response'.",
+ \ },
+ \ {
+ \ 'lnum': 14,
+ \ 'type': 'W',
+ \ 'text': "The method test uses an else expression. Else is never necessary and you can simplify the code to work without else.",
+ \ },
+ \ ],
+ \ ale_linters#php#phpmd#Handle(347, [
+ \ "example.php:22 Avoid unused local variables such as '$response'.",
+ \ "example.php:14 The method test uses an else expression. Else is never necessary and you can simplify the code to work without else.",
+ \ ])
+
+After:
+ call ale#linter#Reset()
diff --git a/test/handler/test_remark_lint_handler.vader b/test/handler/test_remark_lint_handler.vader
new file mode 100644
index 00000000..f63e0c5b
--- /dev/null
+++ b/test/handler/test_remark_lint_handler.vader
@@ -0,0 +1,27 @@
+Before:
+ runtime ale_linters/markdown/remark_lint.vim
+
+Execute(Warning and error messages should be handled correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 4,
+ \ 'type': 'W',
+ \ 'text': 'Incorrect list-item indent: add 1 space list-item-indent remark-lint',
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 5,
+ \ 'type': 'E',
+ \ 'text': 'Incorrect list-item indent: remove 1 space list-item-indent remark-lint',
+ \ },
+ \ ],
+ \ ale_linters#markdown#remark_lint#Handle(1, [
+ \ 'foo.md',
+ \ ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint',
+ \ ' 3:5 error Incorrect list-item indent: remove 1 space list-item-indent remark-lint',
+ \ '',
+ \ 'âš  1 warnings',
+ \ '✘ 1 errors',
+ \])
diff --git a/test/handler/test_vint_handler.vader b/test/handler/test_vint_handler.vader
index 8747979c..c542b4ea 100644
--- a/test/handler/test_vint_handler.vader
+++ b/test/handler/test_vint_handler.vader
@@ -10,12 +10,14 @@ Execute(The vint handler should parse error messages correctly):
\ {
\ 'lnum': 1,
\ 'col': 1,
+ \ 'filename': 'gcc.vim',
\ 'text': 'Use scriptencoding when multibyte char exists (see :help :script encoding)',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 3,
\ 'col': 17,
+ \ 'filename': 'gcc.vim',
\ 'end_col': 18,
\ 'text': 'Use robust operators ''==#'' or ''==?'' instead of ''=='' (see Google VimScript Style Guide (Matching))',
\ 'type': 'W',
@@ -23,6 +25,7 @@ Execute(The vint handler should parse error messages correctly):
\ {
\ 'lnum': 3,
\ 'col': 8,
+ \ 'filename': 'gcc.vim',
\ 'end_col': 15,
\ 'text': 'Make the scope explicit like ''l:filename'' (see Anti-pattern of vimrc (Scope of identifier))',
\ 'type': 'W',
@@ -30,6 +33,7 @@ Execute(The vint handler should parse error messages correctly):
\ {
\ 'lnum': 7,
\ 'col': 8,
+ \ 'filename': 'gcc.vim',
\ 'end_col': 15,
\ 'text': 'Undefined variable: filename (see :help E738)',
\ 'type': 'W',
@@ -37,6 +41,7 @@ Execute(The vint handler should parse error messages correctly):
\ {
\ 'lnum': 8,
\ 'col': 11,
+ \ 'filename': 'gcc.vim',
\ 'end_col': 16,
\ 'text': 'E128: Function name must start with a capital or contain a colon: foobar (see ynkdir/vim-vimlparser)',
\ 'type': 'E',
@@ -44,6 +49,7 @@ Execute(The vint handler should parse error messages correctly):
\ {
\ 'lnum': 9,
\ 'col': 12,
+ \ 'filename': 'gcc.vim',
\ 'end_col': 13,
\ 'text': 'Use robust operators ''=~#'' or ''=~?'' instead of ''=~'' (see Google VimScript Style Guide (Matching))',
\ 'type': 'W',
diff --git a/test/handler/test_write_good_handler.vader b/test/handler/test_write_good_handler.vader
new file mode 100644
index 00000000..8bf4b223
--- /dev/null
+++ b/test/handler/test_write_good_handler.vader
@@ -0,0 +1,37 @@
+Execute(The write-good handler should handle the example from the write-good README):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'end_col': 2,
+ \ 'type': 'W',
+ \ 'text': '"So" adds no meaning',
+ \ },
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 12,
+ \ 'end_col': 21,
+ \ 'type': 'W',
+ \ 'text': '"was stolen" may be passive voice',
+ \ },
+ \ {
+ \ 'lnum': 6,
+ \ 'col': 2,
+ \ 'end_col': 2,
+ \ 'type': 'W',
+ \ 'text': '"foo bar" bla',
+ \ },
+ \ ],
+ \ ale#handlers#writegood#Handle(bufnr(''), [
+ \ 'In /tmp/vBYivbZ/6/test.md',
+ \ '=============',
+ \ 'So the cat was stolen.',
+ \ '^^',
+ \ '"So" adds no meaning on line 1 at column 0',
+ \ '-------------',
+ \ 'So the cat was stolen.',
+ \ ' ^^^^^^^^^^',
+ \ '"was stolen" may be passive voice on line 1 at column 11',
+ \ '"foo bar" bla on line 6 at column 1',
+ \ ])
diff --git a/test/rust_files/testfile.rs b/test/rust_files/testfile.rs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/rust_files/testfile.rs
diff --git a/test/script/check-supported-tools-tables b/test/script/check-supported-tools-tables
index 1d0fec53..32cebb2d 100755
--- a/test/script/check-supported-tools-tables
+++ b/test/script/check-supported-tools-tables
@@ -30,30 +30,30 @@ readme_section_size="$( \
# shellcheck disable=SC2003
readme_end_line="$(expr "$readme_start_line" + "$readme_section_size")"
-doc_file="$(mktemp)"
-readme_file="$(mktemp)"
+doc_file="$(mktemp -t doc.XXXXXXXX)"
+readme_file="$(mktemp -t readme.XXXXXXXX)"
sed -n "$ale_help_start_line,$ale_help_end_line"p doc/ale.txt \
| grep '\* .*: ' \
| sed 's/^*//' \
- | sed 's/[`!^]\|([^)]*)//g' \
+ | sed 's/[`!^]//g;s/([^)]*)//g' \
| sed 's/ *\([,:]\)/\1/g' \
| sed 's/ */ /g' \
- | sed 's/^ *\| *$//g' \
+ | sed 's/^ *//;s/ *$//' \
| sed 's/^/ /' \
> "$doc_file"
sed -n "$readme_start_line,$readme_end_line"p README.md \
| grep '| .* |' \
- | sed '/^| Language\|^| ---/d' \
+ | sed '/^| Language/d;/^| ---/d' \
| sed 's/^|//' \
- | sed 's/ \?|/:/' \
- | sed 's/[`!^|]\|([^)]*)//g' \
- | sed 's/\[\|\]//g' \
- | sed 's/see[^,]*\(,\|$\)/\1/g' \
+ | sed 's/ \{0,1\}|/:/' \
+ | sed 's/[`!^|]//g;s/([^)]*)//g' \
+ | sed 's/\[//g;s/\]//g' \
+ | sed 's/see[^,]*//g' \
| sed 's/ *\([,:]\)/\1/g' \
| sed 's/ */ /g' \
- | sed 's/^ *\| *$//g' \
+ | sed 's/^ *//;s/ *$//' \
| sed 's/^/ /' \
| sed 's/ *-n flag//g' \
> "$readme_file"
diff --git a/test/script/check-toc b/test/script/check-toc
index c4512b08..cc2d2b9c 100755
--- a/test/script/check-toc
+++ b/test/script/check-toc
@@ -23,18 +23,19 @@ tagged_toc_file="$(mktemp -t ale.txt.XXXXXXXX)"
sorted_toc_file="$(mktemp -t sorted-ale.txt.XXXXXXXX)"
sed -n "$toc_start_line,$toc_end_line"p doc/ale.txt \
- | sed 's/^ \( *[^.]\+\)\.\+|\(.\+\)|/\1, \2/' \
+ | sed 's/^ \( *[^.][^.]*\)\.\.*|\(..*\)|/\1, \2/' \
> "$toc_file"
# Get all of the doc files in a natural sorted order.
-doc_files="$(/bin/ls -1v doc | grep ^ale- | sed 's/^/doc\//' | paste -sd ' ')"
+doc_files="$(/bin/ls -1v doc | grep ^ale- | sed 's/^/doc\//' | paste -sd ' ' -)"
# shellcheck disable=SC2086
-grep -h 'ale-.*-options\|^[a-z].*\*ale-.*\*$' $doc_files \
+grep -h '\*ale-.*-options\|^[a-z].*\*ale-.*\*$' $doc_files \
| sed 's/^/ /' \
| sed 's/ALE Shell Integration/ALE sh Integration/' \
- | sed 's/ ALE \(.*\) Integration/\L\1/' \
- | sed 's/ *\*\(.\+\)\*$/, \1/' \
+ | sed 's/ ALE \(.*\) Integration/\1/' \
+ | sed 's/ *\*\(..*\)\*$/, \1/' \
+ | tr '[:upper:]' '[:lower:]' \
| sed 's/objective-c/objc/' \
| sed 's/c++/cpp/' \
> "$heading_file"
@@ -62,7 +63,7 @@ while read -r; do
done < "$toc_file"
# Sort the sections and sub-sections and remove the tags.
-sort -h "$tagged_toc_file" | sed 's/[0-9]\+ //' > "$sorted_toc_file"
+sort -sn "$tagged_toc_file" | sed 's/[0-9][0-9]* //' > "$sorted_toc_file"
echo 'Check for bad ToC sorting:'
echo
diff --git a/test/sign/test_linting_sets_signs.vader b/test/sign/test_linting_sets_signs.vader
index c2cc0db9..c23b4002 100644
--- a/test/sign/test_linting_sets_signs.vader
+++ b/test/sign/test_linting_sets_signs.vader
@@ -20,7 +20,7 @@ Before:
let l:actual_sign_list = []
for l:line in split(l:output, "\n")
- let l:match = matchlist(l:line, 'line=\(\d\+\).*name=\(ALE[a-zA-Z]\+\)')
+ let l:match = matchlist(l:line, '\v^.*\=(\d+).*\=\d+.*\=(ALE[a-zA-Z]+Sign)')
if len(l:match) > 0
call add(l:actual_sign_list, [l:match[1], l:match[2]])
@@ -34,7 +34,7 @@ Before:
\ 'name': 'testlinter',
\ 'callback': 'TestCallback',
\ 'executable': has('win32') ? 'cmd' : 'echo',
- \ 'command': 'echo foo bar',
+ \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
\})
diff --git a/test/test_ale_fix.vader b/test/test_ale_fix.vader
index b5c16724..9968c4a5 100644
--- a/test/test_ale_fix.vader
+++ b/test/test_ale_fix.vader
@@ -11,11 +11,18 @@ Before:
let g:ale_enabled = 0
let g:ale_echo_cursor = 0
let g:ale_run_synchronously = 1
+ let g:ale_set_lists_synchronously = 1
let g:ale_fix_buffer_data = {}
let g:ale_fixers = {
\ 'testft': [],
\}
- let &shell = '/bin/bash'
+
+ if !has('win32')
+ let &shell = '/bin/bash'
+ endif
+
+ call ale#test#SetDirectory('/testplugin/test')
+ call ale#test#SetFilename('test.txt')
function AddCarets(buffer, lines) abort
" map() is applied to the original lines here.
@@ -67,6 +74,7 @@ Before:
After:
Restore
unlet! g:ale_run_synchronously
+ unlet! g:ale_set_lists_synchronously
unlet! g:ale_emulate_job_failure
unlet! b:ale_fixers
delfunction AddCarets
@@ -79,6 +87,9 @@ After:
delfunction RemoveLastLineOneArg
delfunction TestCallback
delfunction SetUpLinters
+
+ call ale#test#RestoreDirectory()
+
call ale#fix#registry#ResetToDefaults()
call ale#linter#Reset()
@@ -129,8 +140,13 @@ Expect(Only the second function should be applied):
$c
Execute(ALEFix should allow commands to be run):
- let g:ale_fixers.testft = ['CatLine']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['a', 'b', 'c', 'd'])
+ else
+ let g:ale_fixers.testft = ['CatLine']
+ ALEFix
+ endif
Expect(An extra line should be added):
a
@@ -139,22 +155,39 @@ Expect(An extra line should be added):
d
Execute(ALEFix should allow temporary files to be read):
- let g:ale_fixers.testft = ['ReplaceWithTempFile']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['x'])
+ 2,3d
+ else
+ let g:ale_fixers.testft = ['ReplaceWithTempFile']
+ ALEFix
+ endif
Expect(The line we wrote to the temporary file should be used here):
x
Execute(ALEFix should allow jobs and simple functions to be combined):
- let g:ale_fixers.testft = ['ReplaceWithTempFile', 'AddDollars']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['$x'])
+ 2,3d
+ else
+ let g:ale_fixers.testft = ['ReplaceWithTempFile', 'AddDollars']
+ ALEFix
+ endif
Expect(The lines from the temporary file should be modified):
$x
Execute(ALEFix should send lines modified by functions to jobs):
- let g:ale_fixers.testft = ['AddDollars', 'CatLine']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['$a', '$b', '$c', 'd'])
+ else
+ let g:ale_fixers.testft = ['AddDollars', 'CatLine']
+ ALEFix
+ endif
Expect(The lines should first be modified by the function, then the job):
$a
@@ -257,18 +290,20 @@ Execute(ALEFix should save files on the save event):
AssertEqual ['$a', '$b', '$c'], readfile('fix_test_file')
Assert !&modified, 'The was marked as ''modified'''
- " We have run the linter.
- AssertEqual [{
- \ 'bufnr': bufnr('%'),
- \ 'lnum': 1,
- \ 'vcol': 0,
- \ 'col': 1,
- \ 'text': 'xxx',
- \ 'type': 'E',
- \ 'nr': -1,
- \ 'pattern': '',
- \ 'valid': 1,
- \}], getloclist(0)
+ if !has('win32')
+ " We should have run the linter.
+ AssertEqual [{
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 1,
+ \ 'vcol': 0,
+ \ 'col': 1,
+ \ 'text': 'xxx',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \}], getloclist(0)
+ endif
Expect(The buffer should be modified):
$a
@@ -294,18 +329,20 @@ Execute(ALEFix should still lint with no linters to be applied):
Assert !filereadable('fix_test_file'), 'The file should not have been saved'
- " We have run the linter.
- AssertEqual [{
- \ 'bufnr': bufnr('%'),
- \ 'lnum': 1,
- \ 'vcol': 0,
- \ 'col': 1,
- \ 'text': 'xxx',
- \ 'type': 'E',
- \ 'nr': -1,
- \ 'pattern': '',
- \ 'valid': 1,
- \}], getloclist(0)
+ if !has('win32')
+ " We have run the linter.
+ AssertEqual [{
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 1,
+ \ 'vcol': 0,
+ \ 'col': 1,
+ \ 'text': 'xxx',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \}], getloclist(0)
+ endif
Expect(The buffer should be the same):
a
@@ -326,18 +363,20 @@ Execute(ALEFix should still lint when nothing was fixed on save):
Assert !filereadable('fix_test_file'), 'The file should not have been saved'
- " We have run the linter.
- AssertEqual [{
- \ 'bufnr': bufnr('%'),
- \ 'lnum': 1,
- \ 'vcol': 0,
- \ 'col': 1,
- \ 'text': 'xxx',
- \ 'type': 'E',
- \ 'nr': -1,
- \ 'pattern': '',
- \ 'valid': 1,
- \}], getloclist(0)
+ if !has('win32')
+ " We should have run the linter.
+ AssertEqual [{
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 1,
+ \ 'vcol': 0,
+ \ 'col': 1,
+ \ 'text': 'xxx',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \}], getloclist(0)
+ endif
Expect(The buffer should be the same):
a
@@ -358,7 +397,7 @@ Execute(ale#fix#InitBufferData() should set up the correct data):
\ bufnr(''): {
\ 'temporary_directory_list': [],
\ 'vars': b:,
- \ 'filename': simplify(getcwd() . '/fix_test_file'),
+ \ 'filename': ale#path#Winify(getcwd() . '/fix_test_file'),
\ 'done': 0,
\ 'lines_before': ['a', 'b', 'c'],
\ 'should_save': 1,
@@ -374,8 +413,13 @@ Expect(There should be only two lines):
b
Execute(ALEFix functions returning jobs should be able to accept one argument):
- let g:ale_fixers.testft = ['CatLine']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['a', 'b', 'c', 'd'])
+ else
+ let g:ale_fixers.testft = ['CatLine']
+ ALEFix
+ endif
Expect(An extra line should be added):
a
diff --git a/test/test_ale_info.vader b/test/test_ale_info.vader
index 8ab5ad54..ceb65af6 100644
--- a/test/test_ale_info.vader
+++ b/test/test_ale_info.vader
@@ -354,7 +354,7 @@ Execute (ALEInfo command history should print command output if logging is on):
Execute (ALEInfo should include executable checks in the history):
call ale#linter#Define('testft', g:testlinter1)
- call ale#engine#IsExecutable(bufnr(''), 'echo')
+ call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo')
call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable')
call CheckInfo([
@@ -365,6 +365,6 @@ Execute (ALEInfo should include executable checks in the history):
\ '',
\] + g:globals_lines + g:command_header + [
\ '',
- \ '(executable check - success) echo',
+ \ '(executable check - success) ' . (has('win32') ? 'cmd' : 'echo'),
\ '(executable check - failure) TheresNoWayThisIsExecutable',
\])
diff --git a/test/test_ale_lint_command.vader b/test/test_ale_lint_command.vader
index 42554ec1..d36b2177 100644
--- a/test/test_ale_lint_command.vader
+++ b/test/test_ale_lint_command.vader
@@ -28,7 +28,7 @@ Before:
\ 'lnum': 2,
\ 'vcol': 0,
\ 'col': 3,
- \ 'text': a:output[0],
+ \ 'text': join(split(a:output[0])),
\ 'type': 'E',
\ 'nr': -1,
\}]
@@ -37,7 +37,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'ToggleTestCallback',
- \ 'executable': 'echo',
+ \ 'executable': has('win32') ? 'cmd' : 'echo',
\ 'command': 'echo foo bar',
\})
@@ -63,5 +63,11 @@ Execute(ALELint should run the linters):
ALELint
call ale#engine#WaitForJobs(2000)
+ if !has('nvim')
+ " Sleep so the delayed list function can run.
+ " This breaks the tests in NeoVim for some reason.
+ sleep 1ms
+ endif
+
" Check the loclist
AssertEqual g:expected_loclist, getloclist(0)
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index f5d8599f..f3dbf102 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -67,7 +67,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'ToggleTestCallback',
- \ 'executable': 'echo',
+ \ 'executable': has('win32') ? 'cmd' : 'echo',
\ 'command': 'echo',
\ 'read_buffer': 0,
\})
diff --git a/test/test_c_import_paths.vader b/test/test_c_import_paths.vader
index dac73f08..af185eae 100644
--- a/test/test_c_import_paths.vader
+++ b/test/test_c_import_paths.vader
@@ -39,8 +39,8 @@ Execute(The C GCC handler should include 'include' directories for projects with
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -52,8 +52,8 @@ Execute(The C GCC handler should include 'include' directories for projects with
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -65,8 +65,8 @@ Execute(The C GCC handler should include root directories for projects with .h f
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -78,8 +78,8 @@ Execute(The C GCC handler should include root directories for projects with .hpp
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -91,8 +91,8 @@ Execute(The C Clang handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -104,8 +104,8 @@ Execute(The C Clang handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -117,8 +117,8 @@ Execute(The C Clang handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -130,8 +130,8 @@ Execute(The C Clang handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -143,8 +143,8 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -156,8 +156,8 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -169,8 +169,8 @@ Execute(The C++ GCC handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -182,8 +182,8 @@ Execute(The C++ GCC handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -195,8 +195,8 @@ Execute(The C++ Clang handler should include 'include' directories for projects
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -208,8 +208,8 @@ Execute(The C++ Clang handler should include 'include' directories for projects
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -221,8 +221,8 @@ Execute(The C++ Clang handler should include root directories for projects with
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -234,8 +234,8 @@ Execute(The C++ Clang handler should include root directories for projects with
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -255,8 +255,8 @@ Execute(The C++ Clang handler shoud use the include directory based on the .git
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/git_and_nested_makefiles/src') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/git_and_nested_makefiles/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/git_and_nested_makefiles/src')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/git_and_nested_makefiles') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -267,8 +267,8 @@ Execute(The C++ ClangTidy handler should include json folders for projects with
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s '
- \ . '-p ' . ale#Escape(g:dir . '/test_c_projects/json_project/build')
+ \ . ' -checks=' . ale#Escape('*') . ' %s '
+ \ . '-p ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/json_project') . '/build')
\ , ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
Execute(Move .git/HEAD back):
diff --git a/test/test_command_chain.vader b/test/test_command_chain.vader
index 16472041..9059d630 100644
--- a/test/test_command_chain.vader
+++ b/test/test_command_chain.vader
@@ -1,7 +1,11 @@
Before:
Save &shell, g:ale_run_synchronously
let g:ale_run_synchronously = 1
- set shell=/bin/sh
+
+ if !has('win32')
+ set shell=/bin/sh
+ endif
+
let g:linter_output = []
let g:first_echo_called = 0
let g:second_echo_called = 0
@@ -9,7 +13,7 @@ Before:
function! CollectResults(buffer, output)
let g:final_callback_called = 1
- let g:linter_output = a:output
+ let g:linter_output = map(copy(a:output), 'join(split(v:val))')
return []
endfunction
function! RunFirstEcho(buffer)
@@ -26,7 +30,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'CollectResults',
- \ 'executable': 'echo',
+ \ 'executable': has('win32') ? 'cmd' : 'echo',
\ 'command_chain': [
\ {
\ 'callback': 'RunFirstEcho',
diff --git a/test/test_csslint_config_detection.vader b/test/test_csslint_config_detection.vader
index b4707dc0..d84a00f9 100644
--- a/test/test_csslint_config_detection.vader
+++ b/test/test_csslint_config_detection.vader
@@ -13,7 +13,7 @@ Execute(--config should be set when the .csslintrc file is found):
AssertEqual
\ (
\ 'csslint --format=compact '
- \ . '--config=' . shellescape(g:dir . '/csslint-test-files/some-app/.csslintrc')
+ \ . '--config=' . ale#Escape(ale#path#Winify(g:dir . '/csslint-test-files/some-app/.csslintrc'))
\ . ' %t'
\ ),
\ ale_linters#css#csslint#GetCommand(bufnr(''))
diff --git a/test/test_elm_executable_detection.vader b/test/test_elm_executable_detection.vader
index 7b758fc2..cca8a6e4 100644
--- a/test/test_elm_executable_detection.vader
+++ b/test/test_elm_executable_detection.vader
@@ -12,7 +12,7 @@ Execute(should get valid executable with default params):
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
AssertEqual
- \ g:dir . '/elm-test-files/app/node_modules/.bin/elm-make',
+ \ ale#path#Winify(g:dir . '/elm-test-files/app/node_modules/.bin/elm-make'),
\ ale_linters#elm#make#GetExecutable(bufnr(''))
Execute(should get valid executable with 'use_global' params):
diff --git a/test/test_errors_removed_after_filetype_changed.vader b/test/test_errors_removed_after_filetype_changed.vader
index 0498a501..92d248d0 100644
--- a/test/test_errors_removed_after_filetype_changed.vader
+++ b/test/test_errors_removed_after_filetype_changed.vader
@@ -13,7 +13,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'buffer_linter',
\ 'callback': 'TestCallback',
- \ 'executable': 'true',
+ \ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': 'true',
\ 'read_buffer': 0,
\})
@@ -21,7 +21,7 @@ Before:
call ale#linter#Define('foobar2', {
\ 'name': 'buffer_linter',
\ 'callback': 'TestCallback',
- \ 'executable': 'true',
+ \ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': 'true',
\ 'read_buffer': 0,
\})
@@ -41,12 +41,14 @@ After:
Execute(Error should be removed when the filetype changes to something else we cannot check):
call ale#Queue(0)
+ sleep 1ms
AssertEqual 1, len(getloclist(0))
noautocmd let &filetype = 'foobar2'
call ale#Queue(0)
+ sleep 1ms
" We should get some items from the second filetype.
AssertEqual 1, len(getloclist(0))
@@ -54,5 +56,6 @@ Execute(Error should be removed when the filetype changes to something else we c
noautocmd let &filetype = 'xxx'
call ale#Queue(0)
+ sleep 1ms
AssertEqual 0, len(getloclist(0))
diff --git a/test/test_eslint_executable_detection.vader b/test/test_eslint_executable_detection.vader
index 411fa134..ee792421 100644
--- a/test/test_eslint_executable_detection.vader
+++ b/test/test_eslint_executable_detection.vader
@@ -17,7 +17,7 @@ Execute(create-react-app directories should be detected correctly):
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
AssertEqual
- \ g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js',
+ \ ale#path#Winify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'),
\ ale#handlers#eslint#GetExecutable(bufnr(''))
Execute(use-global should override create-react-app detection):
@@ -33,7 +33,7 @@ Execute(other app directories should be detected correctly):
call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js')
AssertEqual
- \ g:dir . '/eslint-test-files/node_modules/.bin/eslint',
+ \ ale#path#Winify(g:dir . '/eslint-test-files/node_modules/.bin/eslint'),
\ ale#handlers#eslint#GetExecutable(bufnr(''))
Execute(use-global should override other app directories):
@@ -49,7 +49,7 @@ Execute(eslint_d should be detected correctly):
call ale#test#SetFilename('eslint-test-files/app-with-eslint-d/testfile.js')
AssertEqual
- \ g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d',
+ \ ale#path#Winify(g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'),
\ ale#handlers#eslint#GetExecutable(bufnr(''))
Execute(eslint.js executables should be run with node on Windows):
@@ -59,6 +59,6 @@ Execute(eslint.js executables should be run with node on Windows):
" We have to execute the file with node.
AssertEqual
\ ale#Escape('node.exe') . ' '
- \ . ale#Escape(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' -f unix --stdin --stdin-filename %s',
\ ale#handlers#eslint#GetCommand(bufnr(''))
diff --git a/test/test_find_nearest_directory.vader b/test/test_find_nearest_directory.vader
index 03d38862..1442c8fc 100644
--- a/test/test_find_nearest_directory.vader
+++ b/test/test_find_nearest_directory.vader
@@ -8,7 +8,7 @@ Execute(We should be able to find a directory some directory down):
call ale#test#SetFilename('top/middle/bottom/dummy.txt')
AssertEqual
- \ expand('%:p:h:h:h:h') . '/top/ale-special-directory-name-dont-use-this-please/',
+ \ ale#path#Winify(expand('%:p:h:h:h:h') . '/top/ale-special-directory-name-dont-use-this-please/'),
\ ale#path#FindNearestDirectory(bufnr('%'), 'ale-special-directory-name-dont-use-this-please')
Execute(We shouldn't find anything for files which don't match):
diff --git a/test/test_flow_command.vader b/test/test_flow_command.vader
index d9842869..32ceb57c 100644
--- a/test/test_flow_command.vader
+++ b/test/test_flow_command.vader
@@ -9,13 +9,17 @@ After:
Execute(flow should return a command to run if a .flowconfig file exists):
call ale#test#SetFilename('flow/a/sub/dummy')
- AssertEqual '''flow'' check-contents --respect-pragma --json --from ale %s', ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
+ AssertEqual
+ \ ale#Escape('flow')
+ \ . ' check-contents --respect-pragma --json --from ale %s',
+ \ ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
Execute(flow should should not use --respect-pragma for old versions):
call ale#test#SetFilename('flow/a/sub/dummy')
AssertEqual
- \ '''flow'' check-contents --json --from ale %s',
+ \ ale#Escape('flow')
+ \ . ' check-contents --json --from ale %s',
\ ale_linters#javascript#flow#GetCommand(bufnr('%'), [
\ 'Warning: `flow --version` is deprecated in favor of `flow version`',
\ 'Flow, a static type checker for JavaScript, version 0.27.0',
diff --git a/test/test_format_command.vader b/test/test_format_command.vader
index 156ced9b..f6143a5a 100644
--- a/test/test_format_command.vader
+++ b/test/test_format_command.vader
@@ -2,10 +2,18 @@ Before:
silent! cd /testplugin/test
silent file top/middle/bottom/dummy.txt
+ function! CheckTempFile(filename) abort
+ " Check every part of the temporary filename, except the random part.
+ AssertEqual fnamemodify(tempname(), ':h'), fnamemodify(a:filename, ':h:h')
+ AssertEqual 'dummy.txt', fnamemodify(a:filename, ':t')
+ endfunction
+
After:
unlet! g:result
unlet! g:match
+ delfunction CheckTempFile
+
Execute(FormatCommand should do nothing to basic command strings):
AssertEqual ['', 'awesome-linter do something'], ale#command#FormatCommand(bufnr('%'), 'awesome-linter do something', 0)
@@ -13,40 +21,57 @@ Execute(FormatCommand should handle %%, and ignore other percents):
AssertEqual ['', '% %%d %%f %x %'], ale#command#FormatCommand(bufnr('%'), '%% %%%d %%%f %x %', 0)
Execute(FormatCommand should convert %s to the current filename):
- AssertEqual ['', 'foo ' . shellescape(expand('%:p')) . ' bar ' . shellescape(expand('%:p'))], ale#command#FormatCommand(bufnr('%'), 'foo %s bar %s', 0)
+ AssertEqual
+ \ [
+ \ '',
+ \ 'foo ' . ale#Escape(expand('%:p')) . ' bar ' . ale#Escape(expand('%:p'))
+ \ ],
+ \ ale#command#FormatCommand(bufnr('%'), 'foo %s bar %s', 0)
Execute(FormatCommand should convert %t to a new temporary filename):
let g:result = ale#command#FormatCommand(bufnr('%'), 'foo %t bar %t', 0)
- let g:match = matchlist(g:result[1], '\v^foo (''/tmp/[^'']*/dummy.txt'') bar (''/tmp/[^'']*/dummy.txt'')$')
+
+ call CheckTempFile(g:result[0])
+
+ let g:match = matchlist(g:result[1], '\v^foo (.*) bar (.*)$')
Assert !empty(g:match), 'No match found! Result was: ' . g:result[1]
" The first item of the result should be a temporary filename, and it should
" be the same as the escaped name in the command string.
- AssertEqual shellescape(g:result[0]), g:match[1]
+ AssertEqual ale#Escape(g:result[0]), g:match[1]
" The two temporary filenames formatted in should be the same.
AssertEqual g:match[1], g:match[2]
Execute(FormatCommand should let you combine %s and %t):
let g:result = ale#command#FormatCommand(bufnr('%'), 'foo %t bar %s', 0)
- let g:match = matchlist(g:result[1], '\v^foo (''/tmp/.*/dummy.txt'') bar (''.*/dummy.txt'')$')
+
+ call CheckTempFile(g:result[0])
+
+ let g:match = matchlist(g:result[1], '\v^foo (.*) bar (.*)$')
Assert !empty(g:match), 'No match found! Result was: ' . g:result[1]
" The first item of the result should be a temporary filename, and it should
" be the same as the escaped name in the command string.
- AssertEqual shellescape(g:result[0]), g:match[1]
+ AssertEqual ale#Escape(g:result[0]), g:match[1]
" The second item should be equal to the original filename.
- AssertEqual shellescape(expand('%:p')), g:match[2]
+ AssertEqual ale#Escape(expand('%:p')), g:match[2]
Execute(EscapeCommandPart should escape all percent signs):
AssertEqual '%%s %%t %%%% %%s %%t %%%%', ale#engine#EscapeCommandPart('%s %t %% %s %t %%')
Execute(EscapeCommandPart should pipe in temporary files appropriately):
let g:result = ale#command#FormatCommand(bufnr('%'), 'foo bar', 1)
- let g:match = matchlist(g:result[1], '\v^foo bar \< (''/tmp/[^'']*/dummy.txt'')$')
+
+ call CheckTempFile(g:result[0])
+
+ let g:match = matchlist(g:result[1], '\v^foo bar \< (.*)$')
Assert !empty(g:match), 'No match found! Result was: ' . g:result[1]
- AssertEqual shellescape(g:result[0]), g:match[1]
+ AssertEqual ale#Escape(g:result[0]), g:match[1]
let g:result = ale#command#FormatCommand(bufnr('%'), 'foo bar %t', 1)
- let g:match = matchlist(g:result[1], '\v^foo bar (''/tmp/[^'']*/dummy.txt'')$')
+
+ call CheckTempFile(g:result[0])
+
+ let g:match = matchlist(g:result[1], '\v^foo bar (.*)$')
Assert !empty(g:match), 'No match found! Result was: ' . g:result[1]
- AssertEqual shellescape(g:result[0]), g:match[1]
+ AssertEqual ale#Escape(g:result[0]), g:match[1]
diff --git a/test/test_format_temporary_file_creation.vader b/test/test_format_temporary_file_creation.vader
index 0639c593..1afaba30 100644
--- a/test/test_format_temporary_file_creation.vader
+++ b/test/test_format_temporary_file_creation.vader
@@ -10,8 +10,8 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'TestCallback',
- \ 'executable': 'cat',
- \ 'command': 'cat %t',
+ \ 'executable': has('win32') ? 'cmd' : 'cat',
+ \ 'command': has('win32') ? 'type %t' : 'cat %t',
\})
After:
diff --git a/test/test_get_abspath.vader b/test/test_get_abspath.vader
index 2def3773..5f813804 100644
--- a/test/test_get_abspath.vader
+++ b/test/test_get_abspath.vader
@@ -3,10 +3,10 @@ Execute(Relative paths should be resolved correctly):
\ '/foo/bar/baz/whatever.txt',
\ ale#path#GetAbsPath('/foo/bar/xyz', '../baz/whatever.txt')
AssertEqual
- \ '/foo/bar/xyz/whatever.txt',
+ \ has('win32') ? '/foo/bar/xyz\whatever.txt' : '/foo/bar/xyz/whatever.txt',
\ ale#path#GetAbsPath('/foo/bar/xyz', './whatever.txt')
AssertEqual
- \ '/foo/bar/xyz/whatever.txt',
+ \ has('win32') ? '/foo/bar/xyz\whatever.txt' : '/foo/bar/xyz/whatever.txt',
\ ale#path#GetAbsPath('/foo/bar/xyz', 'whatever.txt')
Execute(Absolute paths should be resolved correctly):
diff --git a/test/test_gradle_build_classpath_command.vader b/test/test_gradle_build_classpath_command.vader
index 84135268..c31dc698 100644
--- a/test/test_gradle_build_classpath_command.vader
+++ b/test/test_gradle_build_classpath_command.vader
@@ -1,37 +1,44 @@
Before:
+ Save $PATH
+ Save $PATHEXT
+
+ let $PATHEXT = '.'
+
call ale#test#SetDirectory('/testplugin/test')
runtime ale_linters/kotlin/kotlinc.vim
- let g:ale_gradle_path = $PATH
+
+ let g:command_tail = ' -I ' . ale#Escape(ale#gradle#GetInitPath())
+ \ . ' -q printClasspath'
+
+ let g:gradle_init_path = ale#path#Winify(g:dir . '../../autoload/ale/gradle/init.gradle')
After:
+ Restore
+
+ unlet! g:gradle_init_path
+ unlet! g:command_tail
+
call ale#test#RestoreDirectory()
call ale#linter#Reset()
- let $PATH = g:ale_gradle_path
Execute(Should return 'gradlew' command if project includes gradle wapper):
call ale#test#SetFilename('gradle-test-files/wrapped-project/src/main/kotlin/dummy.kt')
- let g:project_root = '/testplugin/test/gradle-test-files/wrapped-project'
- let g:gradle_executable = '/testplugin/test/gradle-test-files/wrapped-project/gradlew'
- let g:gradle_init_path = '/testplugin/autoload/ale/gradle/init.gradle'
- let g:gradle_options = '-I ' . g:gradle_init_path . ' -q printClasspath'
-
-
AssertEqual
- \ "cd '" . g:project_root . "' && " . g:gradle_executable . " " . g:gradle_options,
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/gradle-test-files/wrapped-project'))
+ \ . ' && ' . ale#Escape(ale#path#Winify(g:dir . '/gradle-test-files/wrapped-project/gradlew'))
+ \ . g:command_tail,
\ ale#gradle#BuildClasspathCommand(bufnr(''))
Execute(Should return 'gradle' command if project does not include gradle wapper):
call ale#test#SetFilename('gradle-test-files/unwrapped-project/src/main/kotlin/dummy.kt')
- let $PATH .= ':' . g:dir . '/gradle-test-files'
-
- let g:project_root = '/testplugin/test/gradle-test-files/unwrapped-project'
- let g:gradle_executable = 'gradle'
- let g:gradle_init_path = '/testplugin/autoload/ale/gradle/init.gradle'
- let g:gradle_options = '-I ' . g:gradle_init_path . ' -q printClasspath'
+ let $PATH .= (has('win32') ? ';' : ':')
+ \ . ale#path#Winify(g:dir . '/gradle-test-files')
AssertEqual
- \ "cd '" . g:project_root . "' && " . g:gradle_executable . " " . g:gradle_options,
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/gradle-test-files/unwrapped-project'))
+ \ . ' && ' . ale#Escape('gradle')
+ \ . g:command_tail,
\ ale#gradle#BuildClasspathCommand(bufnr(''))
Execute(Should return empty string if gradle cannot be executed):
diff --git a/test/test_gradle_find_executable.vader b/test/test_gradle_find_executable.vader
index 2ae2b464..054c21a8 100644
--- a/test/test_gradle_find_executable.vader
+++ b/test/test_gradle_find_executable.vader
@@ -1,31 +1,37 @@
Before:
+ Save $PATH
+ Save $PATHEXT
+
+ " Count the gradle executable without .exe as executable on Windows
+ let $PATHEXT = '.'
+
call ale#test#SetDirectory('/testplugin/test')
runtime ale_linters/kotlin/kotlinc.vim
- let g:ale_gradle_path = $PATH
After:
+ Restore
+
call ale#test#RestoreDirectory()
call ale#linter#Reset()
- let $PATH = g:ale_gradle_path
-
+
Execute(Should return 'gradlew' if found in parent directory):
call ale#test#SetFilename('gradle-test-files/wrapped-project/src/main/kotlin/dummy.kt')
AssertEqual
- \ g:dir . '/gradle-test-files/wrapped-project/gradlew',
+ \ ale#path#Winify(g:dir . '/gradle-test-files/wrapped-project/gradlew'),
\ ale#gradle#FindExecutable(bufnr(''))
Execute(Should return 'gradle' if 'gradlew' not found in parent directory):
call ale#test#SetFilename('gradle-test-files/unwrapped-project/src/main/kotlin/dummy.kt')
- let $PATH .= ':' . g:dir . '/gradle-test-files'
-
+ let $PATH .= (has('win32') ? ';': ':') . ale#path#Winify(g:dir . '/gradle-test-files')
+
AssertEqual
- \ 'gradle',
+ \ 'gradle',
\ ale#gradle#FindExecutable(bufnr(''))
Execute(Should return empty string if 'gradlew' not in parent directory and gradle not in path):
call ale#test#SetFilename('gradle-test-files/unwrapped-project/src/main/kotlin/dummy.kt')
-
+
AssertEqual
- \ '',
+ \ '',
\ ale#gradle#FindExecutable(bufnr(''))
diff --git a/test/test_gradle_find_project_root.vader b/test/test_gradle_find_project_root.vader
index bd1b8d7d..87af1109 100644
--- a/test/test_gradle_find_project_root.vader
+++ b/test/test_gradle_find_project_root.vader
@@ -10,21 +10,21 @@ Execute(Should return directory for 'gradlew' if found in parent directory):
call ale#test#SetFilename('gradle-test-files/wrapped-project/src/main/kotlin/dummy.kt')
AssertEqual
- \ g:dir . '/gradle-test-files/wrapped-project',
+ \ ale#path#Winify(g:dir . '/gradle-test-files/wrapped-project'),
\ ale#gradle#FindProjectRoot(bufnr(''))
Execute(Should return directory for 'settings.gradle' if found in parent directory):
call ale#test#SetFilename('gradle-test-files/settings-gradle-project/src/main/kotlin/dummy.kt')
AssertEqual
- \ g:dir . '/gradle-test-files/settings-gradle-project',
+ \ ale#path#Winify(g:dir . '/gradle-test-files/settings-gradle-project'),
\ ale#gradle#FindProjectRoot(bufnr(''))
Execute(Should return directory for 'build.gradle' if found in parent directory):
call ale#test#SetFilename('gradle-test-files/build-gradle-project/src/main/kotlin/dummy.kt')
AssertEqual
- \ g:dir . '/gradle-test-files/build-gradle-project',
+ \ ale#path#Winify(g:dir . '/gradle-test-files/build-gradle-project'),
\ ale#gradle#FindProjectRoot(bufnr(''))
Execute(Should return empty string if gradle files are not found in parent directory):
diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader
index c1909c4f..2d87b771 100644
--- a/test/test_highlight_placement.vader
+++ b/test/test_highlight_placement.vader
@@ -36,8 +36,8 @@ Before:
call ale#linter#Define('testft', {
\ 'name': 'x',
- \ 'executable': 'echo',
- \ 'command': 'echo',
+ \ 'executable': has('win32') ? 'cmd': 'echo',
+ \ 'command': has('win32') ? 'echo' : '/bin/sh -c ''echo''',
\ 'callback': 'GenerateResults',
\})
highlight link SomeOtherGroup SpellBad
diff --git a/test/test_history_saving.vader b/test/test_history_saving.vader
index dc7ce0d7..020ceb53 100644
--- a/test/test_history_saving.vader
+++ b/test/test_history_saving.vader
@@ -67,7 +67,10 @@ Execute(History should be set when commands are run):
call ale#Lint()
call ale#engine#WaitForJobs(2000)
- let g:history = ale#history#Get(bufnr(''))
+ let g:history = filter(
+ \ copy(ale#history#Get(bufnr(''))),
+ \ 'v:val.job_id isnot# ''executable''',
+ \)
AssertEqual 1, len(g:history)
AssertEqual sort(['status', 'exit_code', 'job_id', 'command']), sort(keys(g:history[0]))
diff --git a/test/test_lint_on_enter_when_file_changed.vader b/test/test_lint_on_enter_when_file_changed.vader
index 4d4f19cc..d2b38e04 100644
--- a/test/test_lint_on_enter_when_file_changed.vader
+++ b/test/test_lint_on_enter_when_file_changed.vader
@@ -2,9 +2,12 @@ Before:
Save &filetype
Save g:ale_buffer_info
Save g:ale_lint_on_enter
+ Save g:ale_set_lists_synchronously
+
let g:buf = bufnr('')
let g:ale_lint_on_enter = 1
let g:ale_run_synchronously = 1
+ let g:ale_set_lists_synchronously = 1
function! TestCallback(buffer, output)
return [{
@@ -17,8 +20,8 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'TestCallback',
- \ 'executable': 'true',
- \ 'command': 'true',
+ \ 'executable': has('win32') ? 'cmd' : 'true',
+ \ 'command': has('win32') ? 'echo' : 'true',
\})
After: