diff options
author | Sumner Evans <sumner.evans98@gmail.com> | 2017-10-25 00:27:40 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-10-25 00:28:06 +0100 |
commit | 7ac07a30b8c54dd44da403830d4ed84992d18656 (patch) | |
tree | 4a69129eb8f72370cbb62cbce7b75648b3ecafad | |
parent | 1a5ef969a528c037b865828dedcd482a51d0e004 (diff) | |
download | ale-7ac07a30b8c54dd44da403830d4ed84992d18656.zip |
Fix #643 - Add support for write-good for many languages
30 files changed, 437 insertions, 24 deletions
@@ -71,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/) | @@ -100,34 +100,34 @@ formatting. | Haml | [haml-lint](https://github.com/brigade/haml-lint) | | Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) | | Haskell | [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) | -| 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/) | | 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) | | Mail | [proselint](http://proselint.com/) | | 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) | | 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), [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) | | 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/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) | @@ -141,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> 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/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/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/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/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/handlers/writegood.vim b/autoload/ale/handlers/writegood.vim new file mode 100644 index 00000000..c26eb207 --- /dev/null +++ b/autoload/ale/handlers/writegood.vim @@ -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 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-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-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-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-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-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 42f48b23..cac1397c 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| @@ -77,6 +80,7 @@ CONTENTS *ale-contents* 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| @@ -98,12 +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| @@ -121,6 +131,8 @@ CONTENTS *ale-contents* 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| @@ -137,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| @@ -170,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| @@ -182,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| @@ -228,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` @@ -257,34 +279,34 @@ Notes: * Haml: `haml-lint` * Handlebars: `ember-template-lint` * 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` * 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` * Mail: `proselint` * Make: `checkmake` -* Markdown: `mdl`, `proselint`, `vale`, `remark-lint` +* 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`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf` -* Pod: `proselint` +* 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|), `rustfmt` @@ -298,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` @@ -1283,6 +1305,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/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..86e6f507 --- /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' : '') + \ . 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/handler/test_write_good_handler.vader b/test/handler/test_write_good_handler.vader new file mode 100644 index 00000000..b3eeb1b7 --- /dev/null +++ b/test/handler/test_write_good_handler.vader @@ -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 ', + \ ]) diff --git a/test/script/check-toc b/test/script/check-toc index 426d5a1d..cc2d2b9c 100755 --- a/test/script/check-toc +++ b/test/script/check-toc @@ -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 ' ' -)" # 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/\1/' \ |