From 107516c757df82d2ee84426de9b35fd52e953c5c Mon Sep 17 00:00:00 2001 From: P M <10617122+pylipp@users.noreply.github.com> Date: Sun, 25 Mar 2018 12:55:59 +0200 Subject: 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 --- ale_linters/qml/qmllint.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ale_linters/qml/qmllint.vim (limited to 'ale_linters/qml/qmllint.vim') 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', +\}) -- cgit v1.2.3