From 48bfa02e1dbe0a481b184e2fe10165e25ac5961f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana?= Date: Thu, 20 Jul 2023 23:55:01 +0200 Subject: [PATCH] Add clang-tidy conf --- .clang-tidy | 17 +++++++++++++++++ .vscode/settings.json | 3 ++- CMakeLists.txt | 4 ++-- src/BayesNet/Node.cc | 1 - 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..15de509 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,17 @@ +--- +Checks: '-*, + clang-*, + bugprone-*, + cppcoreguidelines-*, + modernize-*, + performance-*, + -cppcoreguidelines-pro-type-vararg, + -modernize-use-trailing-return-type, + -bugprone-exception-escape' + +HeaderFilterRegex: 'src/*' +AnalyzeTemporaryDtors: false +WarningsAsErrors: '' +FormatStyle: file +FormatStyleOptions: '' +... diff --git a/.vscode/settings.json b/.vscode/settings.json index fa8e905..6ca95f6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -97,7 +97,8 @@ "future": "cpp", "queue": "cpp", "typeindex": "cpp", - "shared_mutex": "cpp" + "shared_mutex": "cpp", + "*.ipp": "cpp" }, "cmake.configureOnOpen": false, "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" diff --git a/CMakeLists.txt b/CMakeLists.txt index 4042293..d236e8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}") # Options # ------- -option(ENABLE_CLANG_TIDY "Enable to add clang tidy." OFF) +option(ENABLE_CLANG_TIDY "Enable to add clang tidy." ON) option(ENABLE_TESTING "Unit testing build" ON) option(CODE_COVERAGE "Collect coverage from test library" ON) @@ -71,4 +71,4 @@ if (ENABLE_TESTING) include(CTest) #include(Catch) add_subdirectory(tests) -endif (ENABLE_TESTING) \ No newline at end of file +endif (ENABLE_TESTING) diff --git a/src/BayesNet/Node.cc b/src/BayesNet/Node.cc index 6f1ba75..0a5a580 100644 --- a/src/BayesNet/Node.cc +++ b/src/BayesNet/Node.cc @@ -83,7 +83,6 @@ namespace bayesnet { for (auto father : getParents()) { dimensions.push_back(father->getNumStates()); } - auto length = dimensions.size(); // Create a tensor of zeros with the dimensions of the CPT cpTable = torch::zeros(dimensions, torch::kFloat) + laplaceSmoothing; // Fill table with counts