Skip to content

Enable cppcoreguidelines #1896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions cmake/common/clang-tidy.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
{
"Checks": "-*, bugprone-*, -bugprone-easily-swappable-parameters,-bugprone-unchecked-optional-access, concurrency-*,cppcoreguidelines-missing-std-forward,
cppcoreguidelines-avoid-const-or-ref-data-members, modernize-*, performance-*, portability-*",
"Checks": "-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-unchecked-optional-access,
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-avoid-goto,
modernize-*,
performance-*,
portability-*",
"WarningsAsErrors": "*",
"FormatStyle": "none",
"UseColor": true
Expand Down
8 changes: 4 additions & 4 deletions src/core/gzip/gzip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ auto gzip(std::istream &input, std::ostream &output) -> void {
throw GZIPError{"Could not compress input"};
}

std::array<char, ZLIB_BUFFER_SIZE> buffer_input;
std::array<char, ZLIB_BUFFER_SIZE> buffer_output;
std::array<char, ZLIB_BUFFER_SIZE> buffer_input{};
std::array<char, ZLIB_BUFFER_SIZE> buffer_output{};
bool reached_end_of_input{false};
auto code{Z_OK};

Expand Down Expand Up @@ -68,8 +68,8 @@ auto gunzip(std::istream &input, std::ostream &output) -> void {
throw GZIPError("Could not decompress input");
}

std::array<char, ZLIB_BUFFER_SIZE> buffer_input;
std::array<char, ZLIB_BUFFER_SIZE> buffer_output;
std::array<char, ZLIB_BUFFER_SIZE> buffer_input{};
std::array<char, ZLIB_BUFFER_SIZE> buffer_output{};

auto code{Z_OK};
while (code != Z_STREAM_END) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/md5/md5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned char, br_md5_SIZE> hash;
std::array<unsigned char, br_md5_SIZE> hash{};
br_md5_out(&context, hash.data());
std::string_view buffer{reinterpret_cast<const char *>(hash.data()),
br_md5_SIZE};
Expand Down
2 changes: 1 addition & 1 deletion src/core/time/gmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading