vscode-clang-tidy icon indicating copy to clipboard operation
vscode-clang-tidy copied to clipboard

clang-tidy.checks example

Open chetrf opened this issue 4 years ago • 3 comments

Could you give an example of how to add or suppress clang-tidy checks in settings.json? The specific check I would like to add is implicit-function-declaration and I would like to suppress errors with not finding headers. I am already using cpptools. Thanks.

chetrf avatar Jun 13 '20 21:06 chetrf

Example of my configuration: "clang-tidy.checks": [ "bugprone-", "cert-", "clang-analyzer-", "cppcoreguidelines-", "-cppcoreguidelines-pro-type-vararg", <== when you see a - sign at the first character it means, don't use this flag "-cppcoreguidelines-pro-bounds-array-to-pointer-decay", "llvm-", "-llvm-include-order", "misc-", "modernize-", "-modernize-use-trailing-return-type", "-modernize-concat-nested-namespaces", "performance-", "readability-*" ],

Regarding the error 'not finding headers', try to use a file compile_commands.json in the buildPath variable. The file compile_commands.json is created by cmake using the option -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

"clang-tidy.buildPath": "/path/to /the/file_compile_commands.json" (note: the path to the folder containing the file, not the path including the file ;) )

jfrascon avatar Jul 14 '20 10:07 jfrascon

@chetrf Has your question been answered? Is it safe to close this issue now?

notskm avatar Jan 06 '21 05:01 notskm

@notskm It did to me, Could you guys put it on the documentation, this will be great to know.

PacoUK avatar Sep 30 '21 07:09 PacoUK