Update oelint pattern (#5016)

* Update oelint pattern
* Handle optional branch output
This commit is contained in:
offa
2025-08-14 19:18:00 +00:00
committed by GitHub
parent a083d58c7f
commit ce1ee7c598
2 changed files with 28 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
endfunction
function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$'
let l:pattern = '\v^(.{-}):(.{-}):(.{-}):(.{-}):(.{-})$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
@@ -25,7 +25,7 @@ function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
\ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[3] is# 'error'
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
\ 'text': StripAnsiCodes(l:match[5]),
\ 'text': RemoveBranch(StripAnsiCodes(l:match[5])),
\ 'code': l:match[4]
\ })
endfor
@@ -37,6 +37,10 @@ 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',