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.
1 " Author: Atsuya Takagi <asoftonight@gmail.com>
2 " Description: A linter for Vala using Vala-Lint.
4 call ale#Set('vala_vala_lint_config_filename', 'vala-lint.conf')
5 call ale#Set('vala_vala_lint_executable', 'io.elementary.vala-lint')
7 function! ale_linters#vala#vala_lint#GetExecutable(buffer) abort
8 return ale#Var(a:buffer, 'vala_vala_lint_executable')
11 function! ale_linters#vala#vala_lint#GetCommand(buffer) abort
12 let l:command = ale_linters#vala#vala_lint#GetExecutable(a:buffer)
14 let l:config_filename = ale#Var(a:buffer, 'vala_vala_lint_config_filename')
15 let l:config_path = ale#path#FindNearestFile(a:buffer, l:config_filename)
17 if !empty(l:config_path)
18 let l:command .= ' -c ' . l:config_path
21 return l:command . ' %s'
24 function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort
25 let l:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(error\|warn\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)'
29 " remove color escape sequences since vala-lint doesn't support
30 " output without colors
31 let l:cleaned_line = substitute(l:line, '\e\[[0-9;]\+[mK]', '', 'g')
32 let l:match = matchlist(l:cleaned_line, l:pattern)
38 let l:refined_type = l:match[3] is# 'warn' ? 'W' : 'E'
39 let l:cleaned_text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '')
41 let l:lnum = l:match[1] + 0
42 let l:column = l:match[2] + 0
43 let l:type = l:refined_type
44 let l:text = l:cleaned_text
45 let l:code = l:match[5]
59 call ale#linter#Define('vala', {
60 \ 'name': 'vala_lint',
61 \ 'output_stream': 'stdout',
62 \ 'executable': function('ale_linters#vala#vala_lint#GetExecutable'),
63 \ 'command': function('ale_linters#vala#vala_lint#GetCommand'),
64 \ 'callback': 'ale_linters#vala#vala_lint#Handle',