mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +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_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
|
||||
let l:config_file = ale#path#FindNearestFile(a:buffer,
|
||||
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
|
||||
@@ -24,23 +32,18 @@ function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] is# 'error'
|
||||
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
||||
\ 'text': RemoveBranch(StripAnsiCodes(l:match[5])),
|
||||
\ 'code': l:match[4]
|
||||
\ ? 'E'
|
||||
\ : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
||||
\ 'text': ale_linters#bitbake#oelint_adv#RemoveBranch(
|
||||
\ ale_linters#bitbake#oelint_adv#StripAnsiCodes(l:match[5])
|
||||
\ ),
|
||||
\ 'code': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
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', {
|
||||
\ 'name': 'oelint_adv',
|
||||
\ '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',
|
||||
\ '[31mexample2_1.1.bb:17:error:oelint.var.mandatoryvar.DESCRIPTION:Variable ''DESCRIPTION'' should be set[0m',
|
||||
\ ])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user