mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
Stop oelint_adv functions possibly conflicting
This commit is contained in:
@@ -5,6 +5,14 @@ call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv')
|
|||||||
call ale#Set('bitbake_oelint_adv_options', '')
|
call ale#Set('bitbake_oelint_adv_options', '')
|
||||||
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
|
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
|
||||||
|
|
||||||
|
function! ale_linters#bitbake#oelint_adv#StripAnsiCodes(line) abort
|
||||||
|
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#bitbake#oelint_adv#RemoveBranch(line) abort
|
||||||
|
return substitute(a:line, ' \[branch:.*', '', 'g')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
|
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
|
||||||
let l:config_file = ale#path#FindNearestFile(a:buffer,
|
let l:config_file = ale#path#FindNearestFile(a:buffer,
|
||||||
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
|
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
|
||||||
@@ -22,25 +30,20 @@ function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': str2nr(l:match[2]),
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
\ 'type': l:match[3] is# 'error'
|
\ 'type': l:match[3] is# 'error'
|
||||||
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
\ ? 'E'
|
||||||
\ 'text': RemoveBranch(StripAnsiCodes(l:match[5])),
|
\ : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
||||||
\ 'code': l:match[4]
|
\ 'text': ale_linters#bitbake#oelint_adv#RemoveBranch(
|
||||||
\ })
|
\ ale_linters#bitbake#oelint_adv#StripAnsiCodes(l:match[5])
|
||||||
|
\ ),
|
||||||
|
\ 'code': l:match[4],
|
||||||
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! StripAnsiCodes(line) abort
|
|
||||||
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! RemoveBranch(line) abort
|
|
||||||
return substitute(a:line, ' \[branch:.*', '', 'g')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('bitbake', {
|
call ale#linter#Define('bitbake', {
|
||||||
\ 'name': 'oelint_adv',
|
\ 'name': 'oelint_adv',
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
|
|||||||
@@ -47,4 +47,3 @@ Execute(The oelint_adv handler should handle warnings without branch message):
|
|||||||
\ '/meta-x/recipes-y/example/example_1.0.bb:1234:info:oelint.var.suggestedvar.BUGTRACKER:Variable ''BUGTRACKER'' should be set',
|
\ '/meta-x/recipes-y/example/example_1.0.bb:1234:info:oelint.var.suggestedvar.BUGTRACKER:Variable ''BUGTRACKER'' should be set',
|
||||||
\ '[31mexample2_1.1.bb:17:error:oelint.var.mandatoryvar.DESCRIPTION:Variable ''DESCRIPTION'' should be set[0m',
|
\ '[31mexample2_1.1.bb:17:error:oelint.var.mandatoryvar.DESCRIPTION:Variable ''DESCRIPTION'' should be set[0m',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user