summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/asciidoc/redpen.vim9
-rw-r--r--ale_linters/markdown/redpen.vim30
-rw-r--r--ale_linters/review/redpen.vim9
-rw-r--r--ale_linters/rst/redpen.vim9
-rw-r--r--ale_linters/tex/redpen.vim9
5 files changed, 38 insertions, 28 deletions
diff --git a/ale_linters/asciidoc/redpen.vim b/ale_linters/asciidoc/redpen.vim
new file mode 100644
index 00000000..819e385f
--- /dev/null
+++ b/ale_linters/asciidoc/redpen.vim
@@ -0,0 +1,9 @@
+" Author: rhysd https://rhysd.github.io
+" Description: Redpen, a proofreading tool (http://redpen.cc)
+
+call ale#linter#Define('asciidoc', {
+\ 'name': 'redpen',
+\ 'executable': 'redpen',
+\ 'command': 'redpen -f asciidoc -r json %t',
+\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
+\})
diff --git a/ale_linters/markdown/redpen.vim b/ale_linters/markdown/redpen.vim
index 38fe2308..ff2cbaf8 100644
--- a/ale_linters/markdown/redpen.vim
+++ b/ale_linters/markdown/redpen.vim
@@ -1,35 +1,9 @@
" Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc)
-function! ale_linters#markdown#redpen#HandleErrors(buffer, lines) abort
- " Only one file was passed to redpen. So response array has only one
- " element.
- let l:res = json_decode(join(a:lines))[0]
- let l:output = []
- for l:err in l:res.errors
- let l:item = {
- \ 'text': l:err.message . ' (' . l:err.validator . ')',
- \ 'type': 'W',
- \}
- if has_key(l:err, 'startPosition')
- let l:item.lnum = l:err.startPosition.lineNum
- let l:item.col = l:err.startPosition.offset
- if has_key(l:err, 'endPosition')
- let l:item.end_lnum = l:err.endPosition.lineNum
- let l:item.end_col = l:err.endPosition.offset
- endif
- else
- let l:item.lnum = l:err.lineNum
- let l:item.col = l:err.sentenceStartColumnNum + 1
- endif
- call add(l:output, l:item)
- endfor
- return l:output
-endfunction
-
call ale#linter#Define('markdown', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
-\ 'command': 'redpen -r json %t',
-\ 'callback': 'ale_linters#markdown#redpen#HandleErrors',
+\ 'command': 'redpen -f markdown -r json %t',
+\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
diff --git a/ale_linters/review/redpen.vim b/ale_linters/review/redpen.vim
new file mode 100644
index 00000000..0006cab9
--- /dev/null
+++ b/ale_linters/review/redpen.vim
@@ -0,0 +1,9 @@
+" Author: rhysd https://rhysd.github.io
+" Description: Redpen, a proofreading tool (http://redpen.cc)
+
+call ale#linter#Define('review', {
+\ 'name': 'redpen',
+\ 'executable': 'redpen',
+\ 'command': 'redpen -f review -r json %t',
+\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
+\})
diff --git a/ale_linters/rst/redpen.vim b/ale_linters/rst/redpen.vim
new file mode 100644
index 00000000..ac966c56
--- /dev/null
+++ b/ale_linters/rst/redpen.vim
@@ -0,0 +1,9 @@
+" Author: rhysd https://rhysd.github.io
+" Description: Redpen, a proofreading tool (http://redpen.cc)
+
+call ale#linter#Define('rst', {
+\ 'name': 'redpen',
+\ 'executable': 'redpen',
+\ 'command': 'redpen -f rest -r json %t',
+\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
+\})
diff --git a/ale_linters/tex/redpen.vim b/ale_linters/tex/redpen.vim
new file mode 100644
index 00000000..952a6004
--- /dev/null
+++ b/ale_linters/tex/redpen.vim
@@ -0,0 +1,9 @@
+" Author: rhysd https://rhysd.github.io
+" Description: Redpen, a proofreading tool (http://redpen.cc)
+
+call ale#linter#Define('tex', {
+\ 'name': 'redpen',
+\ 'executable': 'redpen',
+\ 'command': 'redpen -f latex -r json %t',
+\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
+\})