From 3802f3105d6117b3e328076c8837469c65c4b267 Mon Sep 17 00:00:00 2001 From: Balakrishna Avulapati Date: Sun, 27 Jul 2025 21:11:30 +0530 Subject: [PATCH 1/2] Enable cppcoreguidelines Signed-off-by: Balakrishna Avulapati --- cmake/common/clang-tidy.json | 20 +++++++++++++++++++- src/core/gzip/gzip.cc | 8 ++++---- src/core/md5/md5.cc | 2 +- src/core/time/gmt.cc | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/cmake/common/clang-tidy.json b/cmake/common/clang-tidy.json index 49abc79ba..299695941 100644 --- a/cmake/common/clang-tidy.json +++ b/cmake/common/clang-tidy.json @@ -1,5 +1,23 @@ { - "Checks": "-*, bugprone-*, -bugprone-easily-swappable-parameters,-bugprone-unchecked-optional-access, concurrency-*, modernize-*, performance-*, portability-*", + "Checks": "-*, + bugprone-*, + -bugprone-easily-swappable-parameters, + concurrency-*, + cppcoreguidelines-*, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-special-member-functions, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-rvalue-reference-param-not-moved, + -cppcoreguidelines-pro-type-union-access, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-pro-type-member-init, + -cppcoreguidelines-missing-std-forward, + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-const-or-ref-data-members, + modernize-*, + performance-*, + portability-*", "WarningsAsErrors": "*", "FormatStyle": "none", "UseColor": true diff --git a/src/core/gzip/gzip.cc b/src/core/gzip/gzip.cc index 267757f42..77e702480 100644 --- a/src/core/gzip/gzip.cc +++ b/src/core/gzip/gzip.cc @@ -19,8 +19,8 @@ auto gzip(std::istream &input, std::ostream &output) -> void { throw GZIPError{"Could not compress input"}; } - std::array buffer_input; - std::array buffer_output; + std::array buffer_input{}; + std::array buffer_output{}; bool reached_end_of_input{false}; auto code{Z_OK}; @@ -68,8 +68,8 @@ auto gunzip(std::istream &input, std::ostream &output) -> void { throw GZIPError("Could not decompress input"); } - std::array buffer_input; - std::array buffer_output; + std::array buffer_input{}; + std::array buffer_output{}; auto code{Z_OK}; while (code != Z_STREAM_END) { diff --git a/src/core/md5/md5.cc b/src/core/md5/md5.cc index 3178fe28d..ec6f9ea91 100644 --- a/src/core/md5/md5.cc +++ b/src/core/md5/md5.cc @@ -30,7 +30,7 @@ auto md5(std::string_view input, std::ostream &output) -> void { br_md5_context context; br_md5_init(&context); br_md5_update(&context, input.data(), input.size()); - std::array hash; + std::array hash{}; br_md5_out(&context, hash.data()); std::string_view buffer{reinterpret_cast(hash.data()), br_md5_SIZE}; diff --git a/src/core/time/gmt.cc b/src/core/time/gmt.cc index dd50e2f58..b64ecaf5d 100644 --- a/src/core/time/gmt.cc +++ b/src/core/time/gmt.cc @@ -18,7 +18,7 @@ namespace sourcemeta::core { auto to_gmt(const std::chrono::system_clock::time_point time) -> std::string { const std::time_t ctime = std::chrono::system_clock::to_time_t(time); - std::tm buffer; + std::tm buffer{}; #if defined(_MSC_VER) if (gmtime_s(&buffer, &ctime) != 0) { throw std::runtime_error("Could not convert time point to GMT"); From 62b87d30915db43ad7deda6c74370308f9e734e4 Mon Sep 17 00:00:00 2001 From: Balakrishna Avulapati Date: Sun, 27 Jul 2025 21:16:44 +0530 Subject: [PATCH 2/2] disable uncommitted check Signed-off-by: Balakrishna Avulapati --- cmake/common/clang-tidy.json | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/common/clang-tidy.json b/cmake/common/clang-tidy.json index 299695941..8a03d7e95 100644 --- a/cmake/common/clang-tidy.json +++ b/cmake/common/clang-tidy.json @@ -2,6 +2,7 @@ "Checks": "-*, bugprone-*, -bugprone-easily-swappable-parameters, + -bugprone-unchecked-optional-access, concurrency-*, cppcoreguidelines-*, -cppcoreguidelines-avoid-magic-numbers,