install.fairie/dotfiles/.vim/plugged/ale/test/handler/test_flawfinder_handler.vader
Git E2E Dev Test Username e149692cc9 git subrepo clone https://github.com/dense-analysis/ale.git ./dotfiles/.vim/plugged/ale
subrepo:
  subdir:   "dotfiles/.vim/plugged/ale"
  merged:   "e4b205440"
upstream:
  origin:   "https://github.com/dense-analysis/ale.git"
  branch:   "master"
  commit:   "e4b205440"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:09 -04:00

57 lines
1.4 KiB
Text

Before:
Save g:ale_c_flawfinder_error_severity
unlet! g:ale_c_flawfinder_error_severity
unlet! b:ale_c_flawfinder_error_severity
runtime ale_linters/c/flawfinder.vim
After:
unlet! g:ale_c_flawfinder_error_severity
Restore
Execute(The Flawfinder handler should ignore other lines of output):
AssertEqual
\ [],
\ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [
\ 'foo',
\ 'bar',
\ 'baz',
\ ])
Execute(The Flawfinder handler should work):
AssertEqual
\ [
\ {
\ 'lnum': 31,
\ 'col': 4,
\ 'type': 'W',
\ 'text': "(buffer) strncpy: Easily used incorrectly",
\ },
\ ],
\ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [
\ "<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly",
\ ])
Execute(The Flawfinder error severity level should be configurable):
let b:ale_c_flawfinder_error_severity = 2
AssertEqual
\ [
\ {
\ 'lnum': 12,
\ 'col': 4,
\ 'type': 'E',
\ 'text': "(buffer) char: Statically-sized arrays can be bad",
\ },
\ {
\ 'lnum': 31,
\ 'col': 4,
\ 'type': 'W',
\ 'text': "(buffer) strncpy: Easily used incorrectly",
\ },
\ ],
\ ale#handlers#flawfinder#HandleFlawfinderFormat(bufnr(''), [
\ "<stdin>:12:4: [2] (buffer) char:Statically-sized arrays can be bad",
\ "<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly",
\ ])