summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Huang <yang.huang@ymail.com>2022-02-03 06:32:42 -0700
committerGitHub <noreply@github.com>2022-02-03 22:32:42 +0900
commitd1e2aaf85dc81bad223065eec474d9f090fec70e (patch)
tree4db1b7d454c0604b53fe0d73c1d1da5a55a5e65b
parenta81512cfd2d7eed294f4ddc9b525a015e5ec9285 (diff)
downloadale-d1e2aaf85dc81bad223065eec474d9f090fec70e.zip
enable using cpplint for c (#3008)
* enable using cpplint for c * fix tag alignment * fix tag alignment trial #2 Co-authored-by: Justin Huang <justin.huang@perceive.io>
-rw-r--r--ale_linters/c/cpplint.vim20
-rw-r--r--doc/ale-cpp.txt15
2 files changed, 35 insertions, 0 deletions
diff --git a/ale_linters/c/cpplint.vim b/ale_linters/c/cpplint.vim
new file mode 100644
index 00000000..4b997941
--- /dev/null
+++ b/ale_linters/c/cpplint.vim
@@ -0,0 +1,20 @@
+" Author: Justin Huang <justin.y.huang@live.com>
+" Description: cpplint for c files
+
+call ale#Set('c_cpplint_executable', 'cpplint')
+call ale#Set('c_cpplint_options', '')
+
+function! ale_linters#c#cpplint#GetCommand(buffer) abort
+ let l:options = ale#Var(a:buffer, 'c_cpplint_options')
+
+ return '%e' . ale#Pad(l:options) . ' %s'
+endfunction
+
+call ale#linter#Define('c', {
+\ 'name': 'cpplint',
+\ 'output_stream': 'stderr',
+\ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')},
+\ 'command': function('ale_linters#c#cpplint#GetCommand'),
+\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
+\ 'lint_file': 1,
+\})
diff --git a/doc/ale-cpp.txt b/doc/ale-cpp.txt
index d7a840dd..1f079205 100644
--- a/doc/ale-cpp.txt
+++ b/doc/ale-cpp.txt
@@ -287,6 +287,21 @@ g:ale_cpp_cpplint_options *g:ale_cpp_cpplint_options*
This variable can be changed to modify flags given to cpplint.
+g:ale_c_cpplint_executable *g:ale_c_cpplint_executable*
+ *b:ale_c_cpplint_executable*
+ Type: |String|
+ Default: `'cpplint'`
+
+ This variable can be changed to use a different executable for cpplint.
+
+
+g:ale_c_cpplint_options *g:ale_c_cpplint_options*
+ *b:ale_c_cpplint_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be changed to modify flags given to cpplint.
+
===============================================================================
cquery *ale-cpp-cquery*