summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorBart Libert <lapino@gmail.com>2016-10-20 13:30:45 +0200
committerw0rp <w0rp@users.noreply.github.com>2016-10-20 12:30:45 +0100
commita34fb0a6a7f920cd4d9a3e50facf51f8d5defea2 (patch)
tree74b97ad98e528be7df75259275ada10451769b12 /ale_linters
parentacb209aa11960211718b7cb9b55688e5be1adc63 (diff)
downloadale-a34fb0a6a7f920cd4d9a3e50facf51f8d5defea2.zip
Add support for cppcheck (#126)
* Add support for cppcheck * Fix vint error in cppcheck handler * Add vader test for CppCheck format handler
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',
+\})