Slang linter for Verilog. (#4713)

This commit is contained in:
AlvinRolling
2024-02-22 10:18:04 +08:00
committed by GitHub
parent 1c5b84f375
commit 52c6146751
8 changed files with 112 additions and 4 deletions

View File

@@ -0,0 +1,26 @@
Before:
runtime ale_linters/verilog/slang.vim
After:
call ale#linter#Reset()
Execute(The slang handler should parse lines correctly):
AssertEqual
\ [
\ {
\ 'lnum': 11,
\ 'col': 1,
\ 'type': 'W',
\ 'text': 'extra '';'' has no effect [-Wempty-member]',
\ },
\ {
\ 'lnum': 24,
\ 'col': 12,
\ 'type': 'E',
\ 'text': 'cannot mix continuous and procedural assignments to variable ''data_o''',
\ },
\ ],
\ ale_linters#verilog#slang#Handle(bufnr(''), [
\ 'foo.sv:11:1: warning: extra '';'' has no effect [-Wempty-member]',
\ 'foo.sv:24:12: error: cannot mix continuous and procedural assignments to variable ''data_o''',
\ ])

View File

@@ -0,0 +1,14 @@
Before:
call ale#assert#SetUpLinterTest('verilog', 'slang')
After:
call ale#assert#TearDownLinterTest()
Execute(The default slang command should be correct):
AssertLinter 'slang', 'slang -Weverything -I%s:h %t'
Execute(slang options should be configurable):
" Additional args for the linter
let g:ale_verilog_slang_options = '--define-macro DWIDTH=12'
AssertLinter 'slang', 'slang -Weverything -I%s:h --define-macro DWIDTH=12 %t'

View File

@@ -119,7 +119,7 @@ Execute(The defaults for the zsh filetype should be correct):
Execute(The defaults for the verilog filetype should be correct):
" This filetype isn't configured with default, so we can test loading all
" available linters with this.
AssertEqual ['hdl_checker', 'iverilog', 'verilator', 'vlog', 'xvlog', 'yosys'], GetLinterNames('verilog')
AssertEqual ['hdl_checker', 'iverilog', 'slang', 'verilator', 'vlog', 'xvlog', 'yosys'], GetLinterNames('verilog')
let g:ale_linters_explicit = 1