From 82f8a04e18000bc3311340f820edfc98005e99a9 Mon Sep 17 00:00:00 2001 From: Christian-Gibbons Date: Sun, 25 Feb 2018 09:11:04 -0500 Subject: New linter: Flawfinder (#1361) * Flawfinder support added for C and C++ A minor modification to gcc handler was made to support flawfinder's single-line output format that does not have a space following the colon denoting the warning level. gcc handler still passes its Vader tests after this modification. * Documentation fixes * Revert documentation regression * Added Flawfinder to table of contents * Removed trailing whitespace * Follow ALE conventions better Added additional documentation and Vader tests --- ale_linters/cpp/flawfinder.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 ale_linters/cpp/flawfinder.vim (limited to 'ale_linters/cpp') diff --git a/ale_linters/cpp/flawfinder.vim b/ale_linters/cpp/flawfinder.vim new file mode 100644 index 00000000..a19f5962 --- /dev/null +++ b/ale_linters/cpp/flawfinder.vim @@ -0,0 +1,30 @@ +" Author: Christian Gibbons +" Description: flawfinder linter for c++ files + +call ale#Set('cpp_flawfinder_executable', 'flawfinder') +call ale#Set('cpp_flawfinder_options', '') +call ale#Set('cpp_flawfinder_minlevel', 1) + +function! ale_linters#cpp#flawfinder#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_flawfinder_executable') +endfunction + +function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort + + " Set the minimum vulnerability level for flawfinder to bother with + let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel') + + return ale#Escape(ale_linters#cpp#flawfinder#GetExecutable(a:buffer)) + \ . ' -CDQS' + \ . ale#Var(a:buffer, 'cpp_flawfinder_options') + \ . l:minlevel + \ . ' %t' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'flawfinder', +\ 'output_stream': 'stdout', +\ 'executable_callback': 'ale_linters#cpp#flawfinder#GetExecutable', +\ 'command_callback': 'ale_linters#cpp#flawfinder#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) -- cgit v1.2.3