summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--ale_linters/rst/textlint.vim9
-rw-r--r--doc/ale-restructuredtext.txt14
-rw-r--r--doc/ale.txt3
-rw-r--r--test/command_callback/test_rst_textlint_command_callbacks.vader65
5 files changed, 91 insertions, 2 deletions
diff --git a/README.md b/README.md
index cb7f643d..be0790e1 100644
--- a/README.md
+++ b/README.md
@@ -179,7 +179,7 @@ formatting.
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
| R | [lintr](https://github.com/jimhester/lintr) |
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
-| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
+| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| Re:VIEW | [redpen](http://redpen.cc/) |
| 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), [rufo](https://github.com/ruby-formatter/rufo), [solargraph](https://solargraph.org), [standardrb](https://github.com/testdouble/standard) |
diff --git a/ale_linters/rst/textlint.vim b/ale_linters/rst/textlint.vim
new file mode 100644
index 00000000..a14411cf
--- /dev/null
+++ b/ale_linters/rst/textlint.vim
@@ -0,0 +1,9 @@
+" Author: hokorobi <hokorobi.hokorobi@gmail.com>
+" Description: textlint, a proofreading tool (https://textlint.github.io/)
+
+call ale#linter#Define('rst', {
+\ 'name': 'textlint',
+\ 'executable_callback': 'ale#handlers#textlint#GetExecutable',
+\ 'command_callback': 'ale#handlers#textlint#GetCommand',
+\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
+\})
diff --git a/doc/ale-restructuredtext.txt b/doc/ale-restructuredtext.txt
index 02fbc4ad..e308b072 100644
--- a/doc/ale-restructuredtext.txt
+++ b/doc/ale-restructuredtext.txt
@@ -3,6 +3,20 @@ ALE reStructuredText Integration *ale-restructuredtext-options*
===============================================================================
+textlint *ale-restructuredtext-textlint*
+
+To use textlint at reStructuredText, please install `textlint-plugin-rst`.
+https://github.com/jimo1001/textlint-plugin-rst
+>
+ $ npm install textlint-plugin-rst
+
+To install `textlint-plugin-rst`, `docutils-ast-writer` python package
+must be installed.
+See: https://github.com/jimo1001/docutils-ast-writer
+
+See |ale-text-textlint|
+
+===============================================================================
write-good *ale-restructuredtext-write-good*
See |ale-write-good-options|
diff --git a/doc/ale.txt b/doc/ale.txt
index 27d91605..6088b94b 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -278,6 +278,7 @@ CONTENTS *ale-contents*
ols.................................|ale-reasonml-ols|
refmt...............................|ale-reasonml-refmt|
restructuredtext......................|ale-restructuredtext-options|
+ textlint............................|ale-restructuredtext-textlint|
write-good..........................|ale-restructuredtext-write-good|
ruby..................................|ale-ruby-options|
brakeman............................|ale-ruby-brakeman|
@@ -486,7 +487,7 @@ Notes:
* QML: `qmlfmt`, `qmllint`
* R: `lintr`
* ReasonML: `merlin`, `ols`, `refmt`
-* reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `vale`, `write-good`
+* reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `textlint`, `vale`, `write-good`
* Re:VIEW: `redpen`
* RPM spec: `rpmlint`
* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph`, `standardrb`
diff --git a/test/command_callback/test_rst_textlint_command_callbacks.vader b/test/command_callback/test_rst_textlint_command_callbacks.vader
new file mode 100644
index 00000000..9bc4c5c2
--- /dev/null
+++ b/test/command_callback/test_rst_textlint_command_callbacks.vader
@@ -0,0 +1,65 @@
+" Author: januswel, w0rp
+
+Before:
+ " This is just one language for the linter.
+ call ale#assert#SetUpLinterTest('rst', 'textlint')
+
+ " The configuration is shared between many languages.
+ Save g:ale_textlint_executable
+ Save g:ale_textlint_use_global
+ Save g:ale_textlint_options
+
+ let g:ale_textlint_executable = 'textlint'
+ let g:ale_textlint_use_global = 0
+ let g:ale_textlint_options = ''
+
+ unlet! b:ale_textlint_executable
+ unlet! b:ale_textlint_use_global
+ unlet! b:ale_textlint_options
+
+After:
+ unlet! b:command_tail
+ unlet! b:ale_textlint_executable
+ unlet! b:ale_textlint_use_global
+ unlet! b:ale_textlint_options
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'textlint',
+ \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
+
+Execute(The executable should be configurable):
+ let b:ale_textlint_executable = 'foobar'
+
+ AssertLinter 'foobar',
+ \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
+
+Execute(The options should be configurable):
+ let b:ale_textlint_options = '--something'
+
+ AssertLinter 'textlint',
+ \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s'
+
+Execute(The local executable from .bin should be used if available):
+ call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt')
+
+ AssertLinter
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'),
+ \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'))
+ \ . ' -f json --stdin --stdin-filename %s'
+
+Execute(The local executable from textlint/bin should be used if available):
+ call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt')
+
+ if has('win32')
+ AssertLinter
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
+ \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
+ \ . ' -f json --stdin --stdin-filename %s'
+ else
+ AssertLinter
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
+ \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
+ \ . ' -f json --stdin --stdin-filename %s'
+ endif