summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorMarkus Doits <doits@users.noreply.github.com>2017-03-14 00:21:59 +0100
committerw0rp <w0rp@users.noreply.github.com>2017-03-13 23:21:59 +0000
commitfae26369d415a14ce10739513c7f78273993a827 (patch)
tree243a2c8f46a02365e7e1f1d1f36267e1e4144656 /ale_linters
parent3f3d8b001470979864af7317075f38779bc46518 (diff)
downloadale-fae26369d415a14ce10739513c7f78273993a827.zip
add slim-lint (#388)
* add slim-lint * add slim readme entry * add slim entry to doc * add slimlint vader test
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/slim/slimlint.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/ale_linters/slim/slimlint.vim b/ale_linters/slim/slimlint.vim
new file mode 100644
index 00000000..8613951b
--- /dev/null
+++ b/ale_linters/slim/slimlint.vim
@@ -0,0 +1,33 @@
+" Author: Markus Doits - https://github.com/doits
+" Description: slim-lint for Slim files, based on hamllint.vim
+
+function! ale_linters#slim#slimlint#Handle(buffer, lines) abort
+ " Matches patterns like the following:
+ " <path>:5 [W] LineLength: Line is too long. [150/120]
+ let l:pattern = '\v^.*:(\d+) \[([EW])\] (.+)$'
+ let l:output = []
+
+ for l:line in a:lines
+ let l:match = matchlist(l:line, l:pattern)
+
+ if len(l:match) == 0
+ continue
+ endif
+
+ call add(l:output, {
+ \ 'bufnr': a:buffer,
+ \ 'lnum': l:match[1] + 0,
+ \ 'type': l:match[2],
+ \ 'text': l:match[3]
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('slim', {
+\ 'name': 'slimlint',
+\ 'executable': 'slim-lint',
+\ 'command': 'slim-lint %t',
+\ 'callback': 'ale_linters#slim#slimlint#Handle'
+\})