summaryrefslogtreecommitdiff
path: root/ale_linters/qml/qmllint.vim
diff options
context:
space:
mode:
authorP M <10617122+pylipp@users.noreply.github.com>2018-03-25 12:55:59 +0200
committerw0rp <w0rp@users.noreply.github.com>2018-03-25 11:55:59 +0100
commit107516c757df82d2ee84426de9b35fd52e953c5c (patch)
treee1286692393802e69f8f2620b9e4d14341ba7b94 /ale_linters/qml/qmllint.vim
parentd14558da32dd3d776c298fea6456c92870b46d5d (diff)
downloadale-107516c757df82d2ee84426de9b35fd52e953c5c.zip
Add basic qmllint support (#1419)
* Add basic qmllint support * Use temp file, remove superfluous error code key, adjust author info * Add qmllint handler parse test
Diffstat (limited to 'ale_linters/qml/qmllint.vim')
-rw-r--r--ale_linters/qml/qmllint.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/ale_linters/qml/qmllint.vim b/ale_linters/qml/qmllint.vim
new file mode 100644
index 00000000..c2258a14
--- /dev/null
+++ b/ale_linters/qml/qmllint.vim
@@ -0,0 +1,29 @@
+" Author: pylipp (www.github.com/pylipp)
+" Description: qmllint for QML files
+
+" Find lines like
+" /home/foo_user42/code-base/qml/Screen.qml:11 : Expected token `}'
+function! ale_linters#qml#qmllint#Handle(buffer, lines) abort
+ let l:pattern = '\v^[/_-a-zA-z0-9\. ]+:(\d+) : (.*)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ let l:item = {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': 0,
+ \ 'text': l:match[2],
+ \ 'type': 'E',
+ \}
+ call add(l:output, l:item)
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('qml', {
+\ 'name': 'qmllint',
+\ 'output_stream': 'stderr',
+\ 'executable': 'qmllint',
+\ 'command': 'qmllint %t',
+\ 'callback': 'ale_linters#qml#qmllint#Handle',
+\})