summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrej Radovic <r.andrej@gmail.com>2017-08-05 15:21:02 +0200
committerAndrej Radovic <r.andrej@gmail.com>2017-08-05 16:42:28 +0200
commita767578d44dd96bfcb395a8cc605b1905f5393dd (patch)
tree23977f426ecf495e81c9709f220c39887e2c3182 /doc
parent666cfc6ee29d2bcd36a45f4ca7aa77899b2904d4 (diff)
downloadale-a767578d44dd96bfcb395a8cc605b1905f5393dd.zip
Added clang-tidy for C, too.
A limited number of clang-tidy checks can be used with C, too. I pretty much copied and refactored the C++ clang-tidy linter, and added some documentation about C-compatible checks.
Diffstat (limited to 'doc')
-rw-r--r--doc/ale-c.txt129
-rw-r--r--doc/ale.txt1
2 files changed, 130 insertions, 0 deletions
diff --git a/doc/ale-c.txt b/doc/ale-c.txt
index 2572d885..eb52bc19 100644
--- a/doc/ale-c.txt
+++ b/doc/ale-c.txt
@@ -3,6 +3,37 @@ ALE C Integration *ale-c-options*
===============================================================================
+Global Options
+
+g:ale_c_build_dir_names *g:ale_c_build_dir_names*
+ *b:ale_c_build_dir_names*
+
+ Type: |List|
+ Default: `['build', 'bin']`
+
+ A list of directory names to be used when searching upwards from cpp
+ files to discover compilation databases with. For directory named `'foo'`,
+ ALE will search for `'foo/compile_commands.json'` in all directories on and above
+ the directory containing the cpp file to find path to compilation database.
+ This feature is useful for the clang tools wrapped around LibTooling (namely
+ here, clang-tidy)
+
+
+g:ale_c_build_dir *g:ale_c_build_dir*
+ *b:ale_c_build_dir*
+
+ Type: |String|
+ Default: `''`
+
+ A path to the directory containing the `compile_commands.json` file to use
+ with c-family linters. Usually setting this option to a non-empty string
+ will override the |g:ale_c_build_dir_names| option to impose a compilation
+ database (it can be useful if multiple builds are in multiple build
+ subdirectories in the project tree).
+ This feature is also most useful for the clang tools linters, wrapped
+ aroung LibTooling (namely clang-tidy here)
+
+===============================================================================
clang *ale-c-clang*
g:ale_c_clang_executable *g:ale_c_clang_executable*
@@ -22,6 +53,104 @@ g:ale_c_clang_options *g:ale_c_clang_options*
===============================================================================
+clangtidy *ale-c-clangtidy*
+
+`clang-tidy` will be run only when files are saved to disk, so that
+`compile_commands.json` files can be used. It is recommended to use this
+linter in combination with `compile_commands.json` files.
+Therefore, `clang-tidy` linter reads the options |g:ale_c_build_dir| and
+|g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually
+overrides |g:ale_c_build_dir_names|.
+
+
+g:ale_c_clangtidy_checks *g:ale_c_clangtidy_checks*
+ *b:ale_c_clangtidy_checks*
+ Type: |List|
+ Default: `['*']`
+
+ The checks to enable for clang-tidy with the `-checks` argument.
+
+ All options will be joined with commas, and escaped appropriately for
+ the shell. The `-checks` flag can be removed entirely by setting this
+ option to an empty List.
+
+ Not all of clangtidy checks are applicable for C. You should consult the
+ clang documentation for an up-to-date list of compatible checks.
+
+ Here's an (incomplete) list of C-compatible checks, for clang-tidy version 6:
+ bugprone-suspicious-memset-usage
+ cert-env33-c
+ cert-err34-c
+ cert-flp30-c
+ google-runtime-int
+ llvm-header-guard
+ llvm-include-order
+ misc-argument-comment
+ misc-assert-side-effect
+ misc-bool-pointer-implicit-conversion
+ misc-definitions-in-headers
+ misc-incorrect-roundings
+ misc-macro-parentheses
+ misc-macro-repeated-side-effects
+ misc-misplaced-const
+ misc-misplaced-widening-cast
+ misc-multiple-statement-macro
+ misc-non-copyable-objects
+ misc-redundant-expression
+ misc-sizeof-expression
+ misc-static-assert
+ misc-string-literal-with-embedded-nul
+ misc-suspicious-enum-usage
+ misc-suspicious-missing-comma
+ misc-suspicious-semicolon
+ misc-suspicious-string-compare
+ misc-swapped-arguments
+ modernize-redundant-void-arg
+ modernize-use-bool-literals
+ performance-type-promotion-in-math-fn
+ readability-braces-around-statements
+ readability-else-after-return
+ readability-function-size
+ readability-identifier-naming
+ readability-implicit-bool-cast
+ readability-inconsistent-declaration-parameter-name
+ readability-misleading-indentation
+ readability-misplaced-array-index
+ readability-named-parameter
+ readability-non-const-parameter
+ readability-redundant-control-flow
+ readability-redundant-declaration
+ readability-redundant-function-ptr-dereference
+ readability-simplify-boolean-expr
+
+
+g:ale_c_clangtidy_executable *g:ale_c_clangtidy_executable*
+ *b:ale_c_clangtidy_executable*
+ Type: |String|
+ Default: `'clang-tidy'`
+
+ This variable can be changed to use a different executable for clangtidy.
+
+
+g:ale_c_clangtidy_options *g:ale_c_clangtidy_options*
+ *b:ale_c_clangtidy_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be changed to modify flags given to clang-tidy.
+
+ - Setting this variable to a non-empty string,
+ - and working in a buffer where no compilation database is found using
+ |g:ale_c_build_dir_names| or |g:ale_c_build_dir|,
+ will cause the `--` argument to be passed to `clang-tidy`, which will mean
+ that detection of `compile_commands.json` files for compile command
+ databases will be disabled.
+ Only set this option if you want to control compiler flags
+ entirely manually, and no `compile_commands.json` file is in one
+ of the |g:ale_c_build_dir_names| directories of the project tree.
+
+
+===============================================================================
cppcheck *ale-c-cppcheck*
g:ale_c_cppcheck_executable *g:ale_c_cppcheck_executable*
diff --git a/doc/ale.txt b/doc/ale.txt
index 86476374..944431df 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -16,6 +16,7 @@ CONTENTS *ale-contents*
gcc.................................|ale-asm-gcc|
c.....................................|ale-c-options|
clang...............................|ale-c-clang|
+ clangtidy...........................|ale-c-clangtidy|
cppcheck............................|ale-c-cppcheck|
gcc.................................|ale-c-gcc|
chef..................................|ale-chef-options|