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