working clang-tidy
clang-tidy is a static analysis tool: It analyzes C++ source code It finds bugs, bad practices, and design issues It uses the same compiler flags as your real build Examples of what it catches: Uninitialized variables Dangling references Inefficient copies Dangerous implicit conversions Missing explicit Poor modern C++ usage
This commit is contained in:
18
cplusplus/learning/.clang-tidy
Normal file
18
cplusplus/learning/.clang-tidy
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
Checks: >
|
||||||
|
bugprone-*,
|
||||||
|
performance-*,
|
||||||
|
readability-*,
|
||||||
|
modernize-*,
|
||||||
|
clang-analyzer-*,
|
||||||
|
-modernize-use-trailing-return-type,
|
||||||
|
-readability-magic-numbers
|
||||||
|
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
HeaderFilterRegex: '^/home/ys/family-repo/Code/cplusplus/learning/.*'
|
||||||
|
AnalyzeTemporaryDtors: false
|
||||||
|
FormatStyle: none
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
6
cplusplus/learning/.vscode/settings.json
vendored
6
cplusplus/learning/.vscode/settings.json
vendored
@@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"clangd.arguments": [
|
||||||
|
"--compile-commands-dir=build",
|
||||||
|
"--clang-tidy"
|
||||||
|
],
|
||||||
|
|
||||||
"[cpp]": {
|
"[cpp]": {
|
||||||
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd",
|
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout << "Hello from tut1\n";
|
int x;
|
||||||
|
std::cout << x;
|
||||||
fmt::print("Hello from {} using fmt {}\n", "tut1", FMT_VERSION);
|
fmt::print("Hello from {} using fmt {}\n", "tut1", FMT_VERSION);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user