Having trouble defining custom linter #4378
-
Hello, I know that the linter itself is running a) because the output show up in This is my linter: function! ale_linters#vhdl#vsg_ale#GetCommand(buffer)
return "vsg --config ./vsg_config.yaml -of syntastic -f " . expand('%p')
endfunction
function! ale_linters#vhdl#vsg_ale#Handle(buffer, lines)
let l:pattern = '^(\w*):\s+(.+)\((\d+)\)(.+)\s+--\s+(.+)$'
" let l:pattern = '^\(\w*\):\s+\(.+\)(\(\d+\))\(.+\)\s+--\s+\(.+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[2] - 1,
\ 'col': 0,
\ 'text': l:match[1] + ": " + l:match[3] + " - Solution: " + l:match[4],
\})
endfor
return l:output
endfunction
call ale#linter#Define('vhdl', {
\ 'name': 'vsg_ale',
\ 'executable': 'vsg',
\ 'output_stream': 'stdout',
\ 'lint_file': 0,
\ 'command': function('ale_linters#vhdl#vsg_ale#GetCommand'),
\ 'callback': 'ale_linters#vhdl#vsg_ale#Handle',
\}) Does anyone see an issue with my regex that I am missing? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
Difficult to help without actual output of the linter. Please provide some common samples of the output. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I didn't include the actual samples in the issue. But they're on the
regex website and on the VSG syntastic page I linked. They're the same
sample.
…On Fri, Dec 2, 2022, 19:51 Horacio Sanson ***@***.***> wrote:
Difficult to help without actual output of the linter. Please provide some
common samples of the output.
—
Reply to this email directly, view it on GitHub
<#4378 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AESVUANSPE7ZE3C6R6B73GLWLKKRRANCNFSM6AAAAAASSJERDQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Here's a snippet of the output, where each line is a new report
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the help @hsanson that did it! For anyone else that finds this, here's the linter I used function! ale_linters#vhdl#vsg_ale#GetCommand(buffer)
return "vsg --config ./vsg_config.yaml -of syntastic -f " . expand('%p')
endfunction
function! ale_linters#vhdl#vsg_ale#Handle(buffer, lines)
let l:pattern = '^\(\w\{-}\):\s\+\(.*\)(\(\d\+\))\(\w\+\)\s\+--\s\+\(.*\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[3],
\ 'col': 0,
\ 'text': l:match[2] . ": " . l:match[4] . " - Solution: " . l:match[5],
\})
endfor
return l:output
endfunction
call ale#linter#Define('vhdl', {
\ 'name': 'vsg_ale',
\ 'executable': 'vsg',
\ 'output_stream': 'stdout',
\ 'lint_file': 0,
\ 'command': function('ale_linters#vhdl#vsg_ale#GetCommand'),
\ 'callback': 'ale_linters#vhdl#vsg_ale#Handle',
\}) |
Beta Was this translation helpful? Give feedback.
-
That's a good idea. Thanks for the tip!
…On Fri, Dec 9, 2022, 07:24 cassepipe ***@***.***> wrote:
Another tip to check you vim regex is to set incsearch in Vim. This way
you can put your linter output to a file and now when searching with /,
cursor you will be moved to first line you match.
More on vim regexes : https://www.vimregex.com/
—
Reply to this email directly, view it on GitHub
<#4378 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AESVUAMCQWMGWFBPKLPA74LWMMQJJANCNFSM6AAAAAASSJERDQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Thanks for the help @hsanson that did it! For anyone else that finds this, here's the linter I used