summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy2
-rw-r--r--src/buildtool/build_engine/base_maps/json_file_map.hpp6
-rw-r--r--src/other_tools/utils/content.hpp4
-rw-r--r--src/utils/cpp/type_safe_arithmetic.hpp12
-rw-r--r--test/buildtool/crypto/hasher.test.cpp4
-rw-r--r--test/buildtool/storage/large_object_cas.test.cpp20
6 files changed, 25 insertions, 23 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 1ccb870b..cd267a61 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -62,3 +62,5 @@ CheckOptions:
- { key: readability-identifier-naming.MemberConstantPrefix, value: k }
- { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
- { key: readability-identifier-naming.StaticConstantPrefix, value: k }
+ - { key: readability-identifier-naming.ValueTemplateParameterCase, value: CamelCase }
+ - { key: readability-identifier-naming.ValueTemplateParameterPrefix, value: k }
diff --git a/src/buildtool/build_engine/base_maps/json_file_map.hpp b/src/buildtool/build_engine/base_maps/json_file_map.hpp
index 52ab89ab..61813c7b 100644
--- a/src/buildtool/build_engine/base_maps/json_file_map.hpp
+++ b/src/buildtool/build_engine/base_maps/json_file_map.hpp
@@ -40,7 +40,7 @@ using RootGetter = auto (RepositoryConfig::*)(std::string const&) const
using FileNameGetter = auto (RepositoryConfig::*)(std::string const&) const
-> std::string const*;
-template <RootGetter get_root, FileNameGetter get_name, bool kMandatory = true>
+template <RootGetter kGetRoot, FileNameGetter kGetName, bool kMandatory = true>
auto CreateJsonFileMap(
gsl::not_null<const RepositoryConfig*> const& repo_config,
std::size_t jobs) -> JsonFileMap {
@@ -49,9 +49,9 @@ auto CreateJsonFileMap(
auto logger,
auto /* unused */,
auto const& key) {
- auto const* root = ((*repo_config).*get_root)(key.repository);
+ auto const* root = ((*repo_config).*kGetRoot)(key.repository);
- auto const* json_file_name = ((*repo_config).*get_name)(key.repository);
+ auto const* json_file_name = ((*repo_config).*kGetName)(key.repository);
if (root == nullptr or json_file_name == nullptr) {
(*logger)(fmt::format("Cannot determine root or JSON file name for "
"repository {}.",
diff --git a/src/other_tools/utils/content.hpp b/src/other_tools/utils/content.hpp
index eb6aca76..15268daf 100644
--- a/src/other_tools/utils/content.hpp
+++ b/src/other_tools/utils/content.hpp
@@ -86,10 +86,10 @@
return *data;
}
-template <Hasher::HashType type>
+template <Hasher::HashType kType>
[[nodiscard]] static auto GetContentHash(std::string const& data) noexcept
-> std::string {
- auto hasher = Hasher::Create(type);
+ auto hasher = Hasher::Create(kType);
hasher->Update(data);
auto digest = std::move(*hasher).Finalize();
return digest.HexString();
diff --git a/src/utils/cpp/type_safe_arithmetic.hpp b/src/utils/cpp/type_safe_arithmetic.hpp
index c647996a..1ff53ce8 100644
--- a/src/utils/cpp/type_safe_arithmetic.hpp
+++ b/src/utils/cpp/type_safe_arithmetic.hpp
@@ -26,9 +26,9 @@
/// struct my_type_tag : TypeSafeArithmeticTag<int, -2, +3> {};
/// using my_type_t = TypeSafeArithmetic<my_type_tag>;
template <typename T,
- T MIN_VALUE = std::numeric_limits<T>::lowest(),
- T MAX_VALUE = std::numeric_limits<T>::max(),
- T SMALLEST_VALUE = std::numeric_limits<T>::min()>
+ T kMin = std::numeric_limits<T>::lowest(),
+ T kMax = std::numeric_limits<T>::max(),
+ T kSmallest = std::numeric_limits<T>::min()>
struct TypeSafeArithmeticTag {
static_assert(std::is_arithmetic_v<T>,
"T must be an arithmetic type (integer or floating-point)");
@@ -39,9 +39,9 @@ struct TypeSafeArithmeticTag {
using pointer_t = T*;
using const_pointer_t = T const*;
- static constexpr value_t kMaxValue = MAX_VALUE;
- static constexpr value_t kMinValue = MIN_VALUE;
- static constexpr value_t kSmallestValue = SMALLEST_VALUE;
+ static constexpr value_t kMaxValue = kMax;
+ static constexpr value_t kMinValue = kMin;
+ static constexpr value_t kSmallestValue = kSmallest;
};
/// \class TypeSafeArithmetic
diff --git a/test/buildtool/crypto/hasher.test.cpp b/test/buildtool/crypto/hasher.test.cpp
index 8414cc81..8ace48ce 100644
--- a/test/buildtool/crypto/hasher.test.cpp
+++ b/test/buildtool/crypto/hasher.test.cpp
@@ -19,9 +19,9 @@
#include "catch2/catch_test_macros.hpp"
-template <Hasher::HashType type>
+template <Hasher::HashType kType>
void test_increment_hash(std::string const& bytes, std::string const& result) {
- auto hasher = Hasher::Create(type);
+ auto hasher = Hasher::Create(kType);
REQUIRE(hasher.has_value());
hasher->Update(bytes.substr(0, bytes.size() / 2));
hasher->Update(bytes.substr(bytes.size() / 2));
diff --git a/test/buildtool/storage/large_object_cas.test.cpp b/test/buildtool/storage/large_object_cas.test.cpp
index b87c8db3..bd8fa98e 100644
--- a/test/buildtool/storage/large_object_cas.test.cpp
+++ b/test/buildtool/storage/large_object_cas.test.cpp
@@ -42,7 +42,7 @@
namespace {
namespace LargeTestUtils {
-template <bool IsExecutable>
+template <bool kIsExecutable>
class Blob final {
public:
static constexpr auto kLargeId = "bl_8Mb";
@@ -648,24 +648,24 @@ class TestFilesDirectory final {
};
namespace LargeTestUtils {
-template <bool IsExecutable>
-auto Blob<IsExecutable>::Create(LocalCAS<kDefaultDoGlobalUplink> const& cas,
- std::string const& id,
- std::uintmax_t size) noexcept
+template <bool kIsExecutable>
+auto Blob<kIsExecutable>::Create(LocalCAS<kDefaultDoGlobalUplink> const& cas,
+ std::string const& id,
+ std::uintmax_t size) noexcept
-> std::optional<std::pair<ArtifactDigest, std::filesystem::path>> {
auto path = Generate(id, size);
- auto digest = path ? cas.StoreBlob(*path, IsExecutable) : std::nullopt;
+ auto digest = path ? cas.StoreBlob(*path, kIsExecutable) : std::nullopt;
auto blob_path =
- digest ? cas.BlobPath(*digest, IsExecutable) : std::nullopt;
+ digest ? cas.BlobPath(*digest, kIsExecutable) : std::nullopt;
if (digest and blob_path) {
return std::make_pair(std::move(*digest), std::move(*blob_path));
}
return std::nullopt;
}
-template <bool IsExecutable>
-auto Blob<IsExecutable>::Generate(std::string const& id,
- std::uintmax_t size) noexcept
+template <bool kIsExecutable>
+auto Blob<kIsExecutable>::Generate(std::string const& id,
+ std::uintmax_t size) noexcept
-> std::optional<std::filesystem::path> {
std::string const path_id = "blob" + id;
auto path = TestFilesDirectory::Instance().GetPath() / path_id;