add tests and doc for redpen support

This commit is contained in:
rhysd 2017-11-16 18:36:53 +09:00
parent 981cb95d80
commit c9c52ef370
3 changed files with 67 additions and 2 deletions

View File

@ -114,7 +114,7 @@ formatting.
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
| 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) |
| 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), [redpen](http://redpen.cc/) |
| 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) |

View File

@ -304,7 +304,7 @@ Notes:
* Lua: `luacheck`
* Mail: `proselint`, `vale`
* Make: `checkmake`
* Markdown: `mdl`, `proselint`, `vale`, `remark-lint`, `write-good`
* Markdown: `mdl`, `proselint`, `vale`, `remark-lint`, `write-good`, `redpen`
* MATLAB: `mlint`
* Nim: `nim check`!!
* nix: `nix-instantiate`

View File

@ -0,0 +1,65 @@
Before:
runtime! ale_linters/markdown/redpen.vim
After:
call ale#linter#Reset()
Execute(redpen handler should handle errors output):
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'col': 9,
\ 'text': 'Found possibly misspelled word "plugin". (Spelling)',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 1,
\ 'col': 1,
\ 'text': 'Found possibly misspelled word "NeoVim". (Spelling)',
\ 'type': 'W',
\ },
\ ],
\ ale_linters#markdown#redpen#HandleErrors(bufnr(''), [
\ '[',
\ ' {',
\ ' "document": "test.md",',
\ ' "errors": [',
\ ' {',
\ ' "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",',
\ ' "endPosition": {',
\ ' "offset": 15,',
\ ' "lineNum": 1',
\ ' },',
\ ' "validator": "Spelling",',
\ ' "lineNum": 1,',
\ ' "sentenceStartColumnNum": 0,',
\ ' "message": "Found possibly misspelled word \"plugin\".",',
\ ' "startPosition": {',
\ ' "offset": 9,',
\ ' "lineNum": 1',
\ ' }',
\ ' },',
\ ' {',
\ ' "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",',
\ ' "validator": "Spelling",',
\ ' "lineNum": 1,',
\ ' "sentenceStartColumnNum": 0,',
\ ' "message": "Found possibly misspelled word \"NeoVim\".",',
\ ' }',
\ ' ]',
\ ' }',
\ ']',
\ ])
Execute(redpen handler should no error output):
AssertEqual
\ [],
\ ale_linters#markdown#redpen#HandleErrors(bufnr(''), [
\ '[',
\ ' {',
\ ' "document": "test.md",',
\ ' "errors": []',
\ ' }',
\ ']',
\ ])