2018-03-10 10:44:55 +00:00
|
|
|
Before:
|
2023-09-16 21:22:01 +00:00
|
|
|
Save b:ale_c_flawfinder_error_severity
|
2018-03-10 10:44:55 +00:00
|
|
|
runtime ale_linters/c/flawfinder.vim
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
2023-09-16 21:22:01 +00:00
|
|
|
call ale#linter#Reset()
|
2018-03-10 10:44:55 +00:00
|
|
|
|
|
|
|
Execute(The Flawfinder handler should work):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 31,
|
|
|
|
\ 'col': 4,
|
|
|
|
\ 'type': 'W',
|
|
|
|
\ 'text': "(buffer) strncpy: Easily used incorrectly",
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [
|
2023-09-16 21:22:01 +00:00
|
|
|
\ '<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly',
|
|
|
|
\ 'foo',
|
|
|
|
\ 'bar',
|
|
|
|
\ 'baz',
|
2018-03-10 10:44:55 +00:00
|
|
|
\ ])
|
|
|
|
|
|
|
|
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(''), [
|
2023-09-16 21:22:01 +00:00
|
|
|
\ '<stdin>:12:4: [2] (buffer) char:Statically-sized arrays can be bad',
|
|
|
|
\ '<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly',
|
2018-03-10 10:44:55 +00:00
|
|
|
\ ])
|