]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/dart/dart_analyze.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / ale_linters / dart / dart_analyze.vim
1 " Author: ghsang <gwonhyuksang@gmail.com>
2 " Description: Check Dart files with dart analyze
3
4 call ale#Set('dart_analyze_executable', 'dart')
5
6 function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort
7     let l:pattern = '\v([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
8     let l:output = []
9
10     for l:match in ale#util#GetMatches(a:lines, l:pattern)
11         let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6]
12         call add(l:output, {
13         \   'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W',
14         \   'text': l:code . ': ' . l:message,
15         \   'lnum': str2nr(l:lnum),
16         \   'col': str2nr(l:col),
17         \})
18     endfor
19
20     return l:output
21 endfunction
22
23 call ale#linter#Define('dart', {
24 \   'name': 'dart_analyze',
25 \   'executable': {b -> ale#Var(b, 'dart_analyze_executable')},
26 \   'command': '%e analyze --fatal-infos %s',
27 \   'callback': 'ale_linters#dart#dart_analyze#Handle',
28 \   'lint_file': 1,
29 \})