summaryrefslogtreecommitdiff
path: root/ale_linters/c/cppcheck.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/c/cppcheck.vim')
-rw-r--r--ale_linters/c/cppcheck.vim22
1 files changed, 22 insertions, 0 deletions
diff --git a/ale_linters/c/cppcheck.vim b/ale_linters/c/cppcheck.vim
new file mode 100644
index 00000000..891b4ffb
--- /dev/null
+++ b/ale_linters/c/cppcheck.vim
@@ -0,0 +1,22 @@
+" Author: Bart Libert <bart.libert@gmail.com>
+" Description: cppcheck linter for c files
+
+if exists('g:loaded_ale_linters_c_cppcheck')
+ finish
+endif
+
+let g:loaded_ale_linters_c_cppcheck = 1
+
+" Set this option to change the cppcheck options
+if !exists('g:ale_c_cppcheck_options')
+ let g:ale_c_cppcheck_options = '--enable=style'
+endif
+
+call ale#linter#Define('c', {
+\ 'name': 'cppcheck',
+\ 'output_stream': 'both',
+\ 'executable': 'cppcheck',
+\ 'command': g:ale#util#stdin_wrapper . ' .c cppcheck -q --language=c '
+\ . g:ale_c_cppcheck_options,
+\ 'callback': 'ale#handlers#HandleCppCheckFormat',
+\})