Stop oelint_adv functions possibly conflicting

This commit is contained in:
w0rp
2025-08-14 20:21:50 +01:00
parent ce1ee7c598
commit 11cbd96667
2 changed files with 17 additions and 15 deletions

View File

@@ -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',

View File

@@ -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',
\ 'example2_1.1.bb:17:error:oelint.var.mandatoryvar.DESCRIPTION:Variable ''DESCRIPTION'' should be set',
\ ])