summaryrefslogtreecommitdiff
path: root/ale_linters/cpp
diff options
context:
space:
mode:
authorChristian-Gibbons <cgibbons@gmu.edu>2018-02-25 09:11:04 -0500
committerw0rp <w0rp@users.noreply.github.com>2018-02-25 14:11:04 +0000
commit82f8a04e18000bc3311340f820edfc98005e99a9 (patch)
tree07a3c9fd28f1e9dd3b4d6a4b8ed66dec33f366b6 /ale_linters/cpp
parent478a2883a6c75e888bce2b0e7c800d5d8990f29e (diff)
downloadale-82f8a04e18000bc3311340f820edfc98005e99a9.zip
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
Diffstat (limited to 'ale_linters/cpp')
-rw-r--r--ale_linters/cpp/flawfinder.vim30
1 files changed, 30 insertions, 0 deletions
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 <cgibbons@gmu.edu>
+" 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',
+\})