Fix #643 - Add support for write-good for many languages

This commit is contained in:
Sumner Evans 2017-10-25 00:27:40 +01:00 committed by w0rp
parent 1a5ef969a5
commit 7ac07a30b8
30 changed files with 437 additions and 24 deletions

View file

@ -71,7 +71,7 @@ formatting.
| -------- | ----- | | -------- | ----- |
| ASM | [gcc](https://gcc.gnu.org) | | ASM | [gcc](https://gcc.gnu.org) |
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) | | 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/)| | 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/) | | 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/) | | Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
@ -100,34 +100,34 @@ formatting.
| Haml | [haml-lint](https://github.com/brigade/haml-lint) | | Haml | [haml-lint](https://github.com/brigade/haml-lint) |
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) | | Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
| Haskell | [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) | | Haskell | [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/) | | 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/) | | Idris | [idris](http://www.idris-lang.org/) |
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | | Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
| 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) | 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) | | 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 | | 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) | | LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
| Lua | [luacheck](https://github.com/mpeterv/luacheck) | | Lua | [luacheck](https://github.com/mpeterv/luacheck) |
| Mail | [proselint](http://proselint.com/) | | Mail | [proselint](http://proselint.com/) |
| Make | [checkmake](https://github.com/mrtazz/checkmake) | | 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) !! | | 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) | | MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! | | Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) | | 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/) |
| 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 | | 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) | | 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), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) | | PHP | [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/)| | Pod | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) | | Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) | | Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
| Python | [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) | | 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) | | 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 | | 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`) | | 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) | | 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/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) | | 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) |
@ -141,15 +141,15 @@ formatting.
| SQL | [sqlint](https://github.com/purcell/sqlint) | | SQL | [sqlint](https://github.com/purcell/sqlint) |
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) | | Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! | | Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
| Texinfo | [proselint](http://proselint.com/)| | Texinfo | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) | | 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/) | | 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) | | 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) | | Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
| Vim | [vint](https://github.com/Kuniwak/vint) | | Vim | [vint](https://github.com/Kuniwak/vint) |
| Vim help^ | [proselint](http://proselint.com/)| | Vim help^ | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| XHTML | [proselint](http://proselint.com/)| | XHTML | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| XML | [xmllint](http://xmlsoft.org/xmllint.html)| | XML | [xmllint](http://xmlsoft.org/xmllint.html) |
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) | | YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
<a name="usage"></a> <a name="usage"></a>

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -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',
\})

View file

@ -0,0 +1,50 @@
" 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:pattern = '\v^(".*"\s.*)\son\sline\s(\d+)\sat\scolumn\s(\d+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
" 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:match[3] + 1,
\ 'type': 'W',
\})
endfor
return l:output
endfunction

12
doc/ale-asciidoc.txt Normal file
View file

@ -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:

View file

@ -56,5 +56,11 @@ g:ale_html_tidy_options *g:ale_html_tidy_options*
(mac), sjis (shiftjis), utf-16le, utf-16, utf-8 (mac), sjis (shiftjis), utf-16le, utf-16, utf-8
===============================================================================
write-good *ale-html-write-good*
See |ale-write-good-options|
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

12
doc/ale-latex.txt Normal file
View file

@ -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:

12
doc/ale-markdown.txt Normal file
View file

@ -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:

12
doc/ale-nroff.txt Normal file
View file

@ -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:

12
doc/ale-pod.txt Normal file
View file

@ -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:

View file

@ -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:

12
doc/ale-texinfo.txt Normal file
View file

@ -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:

12
doc/ale-text.txt Normal file
View file

@ -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:

12
doc/ale-vim-help.txt Normal file
View file

@ -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:

12
doc/ale-xhtml.txt Normal file
View file

@ -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:

View file

@ -13,7 +13,10 @@ CONTENTS *ale-contents*
5. Completion...........................|ale-completion| 5. Completion...........................|ale-completion|
6. Global Options.......................|ale-options| 6. Global Options.......................|ale-options|
6.1 Highlights........................|ale-highlights| 6.1 Highlights........................|ale-highlights|
6.2 Options for write-good Linter.....|ale-write-good-options|
7. Integration Documentation............|ale-integrations| 7. Integration Documentation............|ale-integrations|
asciidoc..............................|ale-asciidoc-options|
write-good..........................|ale-asciidoc-write-good|
asm...................................|ale-asm-options| asm...................................|ale-asm-options|
gcc.................................|ale-asm-gcc| gcc.................................|ale-asm-gcc|
awk...................................|ale-awk-options| awk...................................|ale-awk-options|
@ -77,6 +80,7 @@ CONTENTS *ale-contents*
html..................................|ale-html-options| html..................................|ale-html-options|
htmlhint............................|ale-html-htmlhint| htmlhint............................|ale-html-htmlhint|
tidy................................|ale-html-tidy| tidy................................|ale-html-tidy|
write-good..........................|ale-html-write-good|
idris.................................|ale-idris-options| idris.................................|ale-idris-options|
idris...............................|ale-idris-idris| idris...............................|ale-idris-idris|
java..................................|ale-java-options| java..................................|ale-java-options|
@ -98,12 +102,18 @@ CONTENTS *ale-contents*
kotlin................................|ale-kotlin-options| kotlin................................|ale-kotlin-options|
kotlinc.............................|ale-kotlin-kotlinc| kotlinc.............................|ale-kotlin-kotlinc|
ktlint..............................|ale-kotlin-ktlint| ktlint..............................|ale-kotlin-ktlint|
latex.................................|ale-latex-options|
write-good..........................|ale-latex-write-good|
less..................................|ale-less-options| less..................................|ale-less-options|
prettier............................|ale-less-prettier| prettier............................|ale-less-prettier|
llvm..................................|ale-llvm-options| llvm..................................|ale-llvm-options|
llc.................................|ale-llvm-llc| llc.................................|ale-llvm-llc|
lua...................................|ale-lua-options| lua...................................|ale-lua-options|
luacheck............................|ale-lua-luacheck| 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| objc..................................|ale-objc-options|
clang...............................|ale-objc-clang| clang...............................|ale-objc-clang|
objcpp................................|ale-objcpp-options| objcpp................................|ale-objcpp-options|
@ -121,6 +131,8 @@ CONTENTS *ale-contents*
phpcs...............................|ale-php-phpcs| phpcs...............................|ale-php-phpcs|
phpmd...............................|ale-php-phpmd| phpmd...............................|ale-php-phpmd|
phpstan.............................|ale-php-phpstan| phpstan.............................|ale-php-phpstan|
pod...................................|ale-pod-options|
write-good..........................|ale-pod-write-good|
pug...................................|ale-pug-options| pug...................................|ale-pug-options|
puglint.............................|ale-pug-puglint| puglint.............................|ale-pug-puglint|
puppet................................|ale-puppet-options| puppet................................|ale-puppet-options|
@ -137,6 +149,8 @@ CONTENTS *ale-contents*
lintr...............................|ale-r-lintr| lintr...............................|ale-r-lintr|
reasonml..............................|ale-reasonml-options| reasonml..............................|ale-reasonml-options|
merlin..............................|ale-reasonml-merlin| merlin..............................|ale-reasonml-merlin|
restructuredtext......................|ale-restructuredtext-options|
write-good..........................|ale-restructuredtext-write-good|
ruby..................................|ale-ruby-options| ruby..................................|ale-ruby-options|
brakeman............................|ale-ruby-brakeman| brakeman............................|ale-ruby-brakeman|
rails_best_practices................|ale-ruby-rails_best_practices| rails_best_practices................|ale-ruby-rails_best_practices|
@ -170,6 +184,10 @@ CONTENTS *ale-contents*
tex...................................|ale-tex-options| tex...................................|ale-tex-options|
chktex..............................|ale-tex-chktex| chktex..............................|ale-tex-chktex|
lacheck.............................|ale-tex-lacheck| 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-options|
thrift..............................|ale-thrift-thrift| thrift..............................|ale-thrift-thrift|
typescript............................|ale-typescript-options| typescript............................|ale-typescript-options|
@ -182,6 +200,10 @@ CONTENTS *ale-contents*
verilator...........................|ale-verilog-verilator| verilator...........................|ale-verilog-verilator|
vim...................................|ale-vim-options| vim...................................|ale-vim-options|
vint................................|ale-vim-vint| 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| xml...................................|ale-xml-options|
xmllint.............................|ale-xml-xmllint| xmllint.............................|ale-xml-xmllint|
yaml..................................|ale-yaml-options| yaml..................................|ale-yaml-options|
@ -228,7 +250,7 @@ Notes:
* ASM: `gcc` * ASM: `gcc`
* Ansible: `ansible-lint` * Ansible: `ansible-lint`
* AsciiDoc: `proselint` * AsciiDoc: `proselint`, `write-good`
* Awk: `gawk` * Awk: `gawk`
* Bash: `shell` (-n flag), `shellcheck` * Bash: `shell` (-n flag), `shellcheck`
* Bourne Shell: `shell` (-n flag), `shellcheck` * Bourne Shell: `shell` (-n flag), `shellcheck`
@ -257,34 +279,34 @@ Notes:
* Haml: `haml-lint` * Haml: `haml-lint`
* Handlebars: `ember-template-lint` * Handlebars: `ember-template-lint`
* Haskell: `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt` * Haskell: `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`
* HTML: `HTMLHint`, `proselint`, `tidy` * HTML: `HTMLHint`, `proselint`, `tidy`, `write-good`
* Idris: `idris` * Idris: `idris`
* Java: `checkstyle`, `javac` * Java: `checkstyle`, `javac`
* JavaScript: `eslint`, `jscs`, `jshint`, `flow`, `prettier`, `prettier-eslint` >= 4.2.0, `prettier-standard`, `standard`, `xo` * JavaScript: `eslint`, `jscs`, `jshint`, `flow`, `prettier`, `prettier-eslint` >= 4.2.0, `prettier-standard`, `standard`, `xo`
* JSON: `jsonlint`, `prettier` * JSON: `jsonlint`, `prettier`
* Kotlin: `kotlinc`, `ktlint` * Kotlin: `kotlinc`, `ktlint`
* LaTeX (tex): `chktex`, `lacheck`, `proselint` * LaTeX (tex): `chktex`, `lacheck`, `proselint`, `write-good`
* LLVM: `llc` * LLVM: `llc`
* Lua: `luacheck` * Lua: `luacheck`
* Mail: `proselint` * Mail: `proselint`
* Make: `checkmake` * Make: `checkmake`
* Markdown: `mdl`, `proselint`, `vale`, `remark-lint` * Markdown: `mdl`, `proselint`, `vale`, `remark-lint`, `write-good`
* MATLAB: `mlint` * MATLAB: `mlint`
* Nim: `nim check`!! * Nim: `nim check`!!
* nix: `nix-instantiate` * nix: `nix-instantiate`
* nroff: `proselint` * nroff: `proselint`, `write-good`
* Objective-C: `clang` * Objective-C: `clang`
* Objective-C++: `clang` * Objective-C++: `clang`
* OCaml: `merlin` (see |ale-ocaml-merlin|) * OCaml: `merlin` (see |ale-ocaml-merlin|)
* Perl: `perl -c`, `perl-critic` * Perl: `perl -c`, `perl-critic`
* PHP: `hack`, `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf` * PHP: `hack`, `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`
* Pod: `proselint` * Pod: `proselint`, `write-good`
* Pug: `pug-lint` * Pug: `pug-lint`
* Puppet: `puppet`, `puppet-lint` * Puppet: `puppet`, `puppet-lint`
* Python: `autopep8`, `flake8`, `isort`, `mypy`, `pycodestyle`, `pylint`!!, `yapf` * Python: `autopep8`, `flake8`, `isort`, `mypy`, `pycodestyle`, `pylint`!!, `yapf`
* R: `lintr` * R: `lintr`
* ReasonML: `merlin` * ReasonML: `merlin`
* reStructuredText: `proselint` * reStructuredText: `proselint`, `write-good`
* RPM spec: `rpmlint` * RPM spec: `rpmlint`
* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby` * Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`
* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt` * Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt`
@ -298,14 +320,14 @@ Notes:
* SQL: `sqlint` * SQL: `sqlint`
* Swift: `swiftlint`, `swiftformat` * Swift: `swiftlint`, `swiftformat`
* Tcl: `nagelfar`!! * Tcl: `nagelfar`!!
* Texinfo: `proselint` * Texinfo: `proselint`, `write-good`
* Text^: `proselint`, `vale` * Text^: `proselint`, `vale`, `write-good`
* Thrift: `thrift` * Thrift: `thrift`
* TypeScript: `eslint`, `tslint`, `tsserver`, `typecheck`, `prettier` * TypeScript: `eslint`, `tslint`, `tsserver`, `typecheck`, `prettier`
* Verilog: `iverilog`, `verilator` * Verilog: `iverilog`, `verilator`
* Vim: `vint` * Vim: `vint`
* Vim help^: `proselint` * Vim help^: `proselint`, `write-good`
* XHTML: `proselint` * XHTML: `proselint`, `write-good`
* XML: `xmllint` * XML: `xmllint`
* YAML: `swaglint`, `yamllint` * YAML: `swaglint`, `yamllint`
@ -1283,6 +1305,36 @@ ALEWarningSign *ALEWarningSign*
The highlight used for warning signs. See |g:ale_set_signs|. 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* 7. Integration Documentation *ale-integrations*

View file

@ -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' : '')
\ . 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(''))

View file

@ -0,0 +1,21 @@
Execute(The write-good handler should handle the example from the write-good README):
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'col': 1,
\ 'type': 'W',
\ 'text': '"So" adds no meaning',
\ }
\ ],
\ 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 ',
\ ])

View file

@ -30,7 +30,7 @@ sed -n "$toc_start_line,$toc_end_line"p doc/ale.txt \
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 # 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/^/ /' \
| sed 's/ALE Shell Integration/ALE sh Integration/' \ | sed 's/ALE Shell Integration/ALE sh Integration/' \
| sed 's/ ALE \(.*\) Integration/\1/' \ | sed 's/ ALE \(.*\) Integration/\1/' \