summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-10-08 15:34:56 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-10-08 15:41:50 +0200
commitc9325cea0aa43f328644157dee4eafe3d7b45e6f (patch)
tree7c688b9cfd8acf45771193f41d69639f9a47dfab
parent0e024eb055e6e8272f419e898ae9eefd0085c34f (diff)
downloadjustbuild-c9325cea0aa43f328644157dee4eafe3d7b45e6f.tar.gz
Name local variables using lower_case
...and private members using lower_case_
-rw-r--r--.clang-tidy4
-rw-r--r--src/buildtool/build_engine/base_maps/expression_map.cpp6
-rw-r--r--src/buildtool/build_engine/base_maps/rule_map.cpp13
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.cpp17
-rw-r--r--src/buildtool/build_engine/target_map/target_map.cpp5
-rw-r--r--src/buildtool/common/git_hashes_converter.hpp6
-rw-r--r--src/buildtool/execution_api/local/local_action.cpp8
-rw-r--r--src/buildtool/file_system/file_root.hpp8
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp10
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp6
-rw-r--r--src/buildtool/multithreading/async_map_consumer.hpp6
-rw-r--r--src/buildtool/storage/compactifier.cpp14
-rw-r--r--src/buildtool/storage/garbage_collector.cpp6
-rw-r--r--src/buildtool/storage/repository_garbage_collector.cpp5
-rw-r--r--src/utils/cpp/hex_string.hpp2
-rw-r--r--src/utils/cpp/type_safe_arithmetic.hpp10
-rw-r--r--test/buildtool/file_system/git_repo.test.cpp10
-rw-r--r--test/buildtool/multithreading/async_map_consumer.test.cpp2
-rw-r--r--test/other_tools/git_operations/git_repo_remote.test.cpp26
-rw-r--r--test/other_tools/utils/curl_usage.test.cpp14
-rw-r--r--test/utils/logging/log_config.hpp4
21 files changed, 93 insertions, 89 deletions
diff --git a/.clang-tidy b/.clang-tidy
index cd267a61..4c945a05 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -64,3 +64,7 @@ CheckOptions:
- { key: readability-identifier-naming.StaticConstantPrefix, value: k }
- { key: readability-identifier-naming.ValueTemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.ValueTemplateParameterPrefix, value: k }
+ - { key: readability-identifier-naming.VariableCase, value: lower_case }
+ - { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
+ - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
+ - { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
diff --git a/src/buildtool/build_engine/base_maps/expression_map.cpp b/src/buildtool/build_engine/base_maps/expression_map.cpp
index 02a875cc..30722bf3 100644
--- a/src/buildtool/build_engine/base_maps/expression_map.cpp
+++ b/src/buildtool/build_engine/base_maps/expression_map.cpp
@@ -46,11 +46,11 @@ auto CreateExpressionMap(
logger,
subcaller = std::move(subcaller),
id](auto json_values) {
- auto const& target_ = id.GetNamedTarget();
- auto func_it = json_values[0]->find(target_.name);
+ auto const& target = id.GetNamedTarget();
+ auto func_it = json_values[0]->find(target.name);
if (func_it == json_values[0]->end()) {
(*logger)(fmt::format("Cannot find expression {}",
- EntityName(target_).ToString()),
+ EntityName(target).ToString()),
true);
return;
}
diff --git a/src/buildtool/build_engine/base_maps/rule_map.cpp b/src/buildtool/build_engine/base_maps/rule_map.cpp
index d3766eda..3e90749e 100644
--- a/src/buildtool/build_engine/base_maps/rule_map.cpp
+++ b/src/buildtool/build_engine/base_maps/rule_map.cpp
@@ -260,14 +260,13 @@ auto CreateRuleMap(gsl::not_null<RuleFileMap*> const& rule_file_map,
{id.ToModule()},
[ts, expr_map, repo_config, setter = std::move(setter), logger, id](
auto json_values) {
- const auto& target_ = id.GetNamedTarget();
- auto rule_it = json_values[0]->find(target_.name);
+ const auto& target = id.GetNamedTarget();
+ auto rule_it = json_values[0]->find(target.name);
if (rule_it == json_values[0]->end()) {
- (*logger)(
- fmt::format("Cannot find rule {} in {}",
- nlohmann::json(target_.name).dump(),
- nlohmann::json(target_.module).dump()),
- true);
+ (*logger)(fmt::format("Cannot find rule {} in {}",
+ nlohmann::json(target.name).dump(),
+ nlohmann::json(target.module).dump()),
+ true);
return;
}
diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp
index 572c9abb..b4d3a7cd 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.cpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp
@@ -108,18 +108,18 @@ void ReportArtifactWithDependencyOrigin(
void ReportStagingConflict(
const std::string& location,
- const ExpressionPtr& stage_A,
- const ExpressionPtr& stage_B,
+ const ExpressionPtr& stage_a,
+ const ExpressionPtr& stage_b,
const std::unordered_map<BuildMaps::Base::EntityName, AnalysedTargetPtr>&
deps_by_target,
const BuildMaps::Target::TargetMap::LoggerPtr& logger) {
std::stringstream msg{};
- auto artifact_A = stage_A->Get(location, Expression::kNone);
- auto artifact_B = stage_B->Get(location, Expression::kNone);
+ auto artifact_a = stage_a->Get(location, Expression::kNone);
+ auto artifact_b = stage_b->Get(location, Expression::kNone);
msg << "Staging conflict on path " << nlohmann::json(location).dump()
<< " between\n";
- ReportArtifactWithDependencyOrigin(artifact_A, deps_by_target, &msg);
- ReportArtifactWithDependencyOrigin(artifact_B, deps_by_target, &msg);
+ ReportArtifactWithDependencyOrigin(artifact_a, deps_by_target, &msg);
+ ReportArtifactWithDependencyOrigin(artifact_b, deps_by_target, &msg);
(*logger)(msg.str(), true);
}
@@ -868,12 +868,11 @@ void InstallRule(
auto files = std::unordered_map<std::string, BuildMaps::Base::EntityName>{};
files.reserve(files_exp->Map().size());
for (auto const& [path, dep_exp] : files_exp->Map()) {
- std::string path_ = path; // Have a variable to capture
auto dep_name = dep_exp.Evaluate(
- param_config, {}, [&logger, &path_](auto const& msg) {
+ param_config, {}, [&logger, &path = path](auto const& msg) {
(*logger)(
fmt::format(
- "While evaluating files entry for {}:\n{}", path_, msg),
+ "While evaluating files entry for {}:\n{}", path, msg),
true);
});
if (not dep_name) {
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp
index 5dd9b7cf..02aae13b 100644
--- a/src/buildtool/build_engine/target_map/target_map.cpp
+++ b/src/buildtool/build_engine/target_map/target_map.cpp
@@ -1632,11 +1632,12 @@ void TreeTarget(
directory_entries) {
const auto& target = key.target.GetNamedTarget();
const auto dir_name = std::filesystem::path{target.module} / target.name;
- auto module_ = BuildMaps::Base::ModuleName{target.repository, dir_name};
+ auto target_module =
+ BuildMaps::Base::ModuleName{target.repository, dir_name};
directory_entries->ConsumeAfterKeysReady(
ts,
- {module_},
+ {target_module},
[context, setter, subcaller, target, key, result_map, logger, dir_name](
auto values) {
// expected values.size() == 1
diff --git a/src/buildtool/common/git_hashes_converter.hpp b/src/buildtool/common/git_hashes_converter.hpp
index d1180244..52fd1283 100644
--- a/src/buildtool/common/git_hashes_converter.hpp
+++ b/src/buildtool/common/git_hashes_converter.hpp
@@ -45,7 +45,7 @@ class GitHashesConverter final {
std::string const& repo)
-> compat_hash {
{
- std::shared_lock lock_{mutex_};
+ std::shared_lock lock{mutex_};
auto it = git_to_compatible_.find(git_hash);
if (it != git_to_compatible_.end()) {
return it->second;
@@ -54,7 +54,7 @@ class GitHashesConverter final {
// This is only used in compatible mode.
HashFunction const hash_function{HashFunction::Type::PlainSHA256};
auto compatible_hash = hash_function.PlainHashData(data).HexString();
- std::unique_lock lock_{mutex_};
+ std::unique_lock lock{mutex_};
git_to_compatible_[git_hash] = compatible_hash;
compatible_to_git_[compatible_hash] = {git_hash, repo};
return compatible_hash;
@@ -62,7 +62,7 @@ class GitHashesConverter final {
[[nodiscard]] auto GetGitEntry(std::string const& compatible_hash)
-> std::optional<std::pair<git_hash const&, git_repo const&>> {
- std::shared_lock lock_{mutex_};
+ std::shared_lock lock{mutex_};
auto it = compatible_to_git_.find(compatible_hash);
if (it != compatible_to_git_.end()) {
return it->second;
diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp
index 85c0254b..c500afba 100644
--- a/src/buildtool/execution_api/local/local_action.cpp
+++ b/src/buildtool/execution_api/local/local_action.cpp
@@ -39,21 +39,21 @@ namespace {
class BuildCleanupAnchor {
public:
explicit BuildCleanupAnchor(std::filesystem::path build_path) noexcept
- : build_path{std::move(build_path)} {}
+ : build_path_{std::move(build_path)} {}
BuildCleanupAnchor(BuildCleanupAnchor const&) = delete;
BuildCleanupAnchor(BuildCleanupAnchor&&) = delete;
auto operator=(BuildCleanupAnchor const&) -> BuildCleanupAnchor& = delete;
auto operator=(BuildCleanupAnchor&&) -> BuildCleanupAnchor& = delete;
~BuildCleanupAnchor() {
- if (not FileSystemManager::RemoveDirectory(build_path, true)) {
+ if (not FileSystemManager::RemoveDirectory(build_path_, true)) {
Logger::Log(LogLevel::Error,
"Could not cleanup build directory {}",
- build_path.string());
+ build_path_.string());
}
}
private:
- std::filesystem::path const build_path;
+ std::filesystem::path const build_path_;
};
[[nodiscard]] auto CreateDigestFromLocalOwnedTree(
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp
index 6b1454ad..f9085f52 100644
--- a/src/buildtool/file_system/file_root.hpp
+++ b/src/buildtool/file_system/file_root.hpp
@@ -61,19 +61,19 @@ class FilteredIterator {
FilteredIterator(I first, I last, predicate_t p) noexcept
: iterator_{std::find_if(first, last, p)},
end_{std::move(last)},
- p{std::move(p)} {}
+ p_{std::move(p)} {}
auto operator*() const noexcept -> reference { return iterator_->first; }
auto operator++() noexcept -> FilteredIterator& {
++iterator_;
- iterator_ = std::find_if(iterator_, end_, p);
+ iterator_ = std::find_if(iterator_, end_, p_);
return *this;
}
[[nodiscard]] auto begin() noexcept -> FilteredIterator& { return *this; }
[[nodiscard]] auto end() const noexcept -> FilteredIterator {
- return FilteredIterator{end_, end_, p};
+ return FilteredIterator{end_, end_, p_};
}
[[nodiscard]] friend auto operator==(FilteredIterator const& x,
@@ -91,7 +91,7 @@ class FilteredIterator {
private:
I iterator_{};
const I end_{};
- predicate_t p{};
+ predicate_t p_{};
};
class FileRoot {
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index 529c4064..f7bcaee0 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -79,9 +79,9 @@ class FileSystemManager {
auto operator=(DirectoryAnchor const&) -> DirectoryAnchor& = delete;
auto operator=(DirectoryAnchor&&) -> DirectoryAnchor& = delete;
~DirectoryAnchor() noexcept {
- if (not kRestorePath.empty()) {
+ if (not restore_path_.empty()) {
try {
- std::filesystem::current_path(kRestorePath);
+ std::filesystem::current_path(restore_path_);
} catch (std::exception const& e) {
Logger::Log(LogLevel::Error, e.what());
}
@@ -89,14 +89,14 @@ class FileSystemManager {
}
[[nodiscard]] auto GetRestorePath() const noexcept
-> std::filesystem::path const& {
- return kRestorePath;
+ return restore_path_;
}
private:
- std::filesystem::path const kRestorePath;
+ std::filesystem::path const restore_path_;
DirectoryAnchor()
- : kRestorePath{FileSystemManager::GetCurrentDirectory()} {}
+ : restore_path_{FileSystemManager::GetCurrentDirectory()} {}
DirectoryAnchor(DirectoryAnchor&&) = default;
};
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index 2cc47911..17ec1b7a 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -507,13 +507,13 @@ class GraphTraverser {
}
// split extra artifacts' nodes from artifact nodes
- auto const itExtra =
+ auto const it_extra =
std::next(artifact_nodes->begin(),
static_cast<std::int64_t>(output_paths.size()));
auto extra_nodes = std::vector<DependencyGraph::ArtifactNode const*>{
- std::make_move_iterator(itExtra),
+ std::make_move_iterator(it_extra),
std::make_move_iterator(artifact_nodes->end())};
- artifact_nodes->erase(itExtra, artifact_nodes->end());
+ artifact_nodes->erase(it_extra, artifact_nodes->end());
return std::make_tuple(std::move(output_paths),
std::move(*artifact_nodes),
diff --git a/src/buildtool/multithreading/async_map_consumer.hpp b/src/buildtool/multithreading/async_map_consumer.hpp
index 1f06b52f..a523214e 100644
--- a/src/buildtool/multithreading/async_map_consumer.hpp
+++ b/src/buildtool/multithreading/async_map_consumer.hpp
@@ -223,7 +223,7 @@ class AsyncMapConsumer {
std::move(logger),
FailureFunctionPtr{failptr});
});
- auto wrappedLogger =
+ auto wrapped_logger =
std::make_shared<Logger>([logger, node, ts](auto msg, auto fatal) {
if (fatal) {
node->Fail(ts);
@@ -236,9 +236,9 @@ class AsyncMapConsumer {
ts,
key,
setterptr = std::move(setterptr),
- wrappedLogger = std::move(wrappedLogger),
+ wrapped_logger = std::move(wrapped_logger),
subcallerptr = std::move(subcallerptr)]() {
- (*vc)(ts, setterptr, wrappedLogger, subcallerptr, key);
+ (*vc)(ts, setterptr, wrapped_logger, subcallerptr, key);
});
return node;
}
diff --git a/src/buildtool/storage/compactifier.cpp b/src/buildtool/storage/compactifier.cpp
index 2a6368ca..3bd39324 100644
--- a/src/buildtool/storage/compactifier.cpp
+++ b/src/buildtool/storage/compactifier.cpp
@@ -157,10 +157,10 @@ template <ObjectType kType>
}
// Calculate reference hash size:
- auto const kHashSize =
+ auto const hash_size =
task.cas.GetHashFunction().MakeHasher().GetHashLength();
- auto const kFileNameSize =
- kHashSize - FileStorageData::kDirectoryNameLength;
+ auto const file_name_size =
+ hash_size - FileStorageData::kDirectoryNameLength;
// Check the directory itself is valid:
std::string const d_name = directory.filename();
@@ -178,8 +178,8 @@ template <ObjectType kType>
}
FileSystemManager::ReadDirEntryFunc callback =
- [&task, &directory, kFileNameSize](std::filesystem::path const& file,
- ObjectType type) -> bool {
+ [&task, &directory, file_name_size](std::filesystem::path const& file,
+ ObjectType type) -> bool {
// Directories are unexpected in storage subdirectories
if (IsTreeObject(type)) {
task.Log(LogLevel::Error,
@@ -188,9 +188,9 @@ template <ObjectType kType>
return false;
}
- // Check file has a hexadecimal name of length kFileNameSize:
+ // Check file has a hexadecimal name of length file_name_size:
std::string const f_name = file.filename();
- if (f_name.size() == kFileNameSize and FromHexString(f_name)) {
+ if (f_name.size() == file_name_size and FromHexString(f_name)) {
return true;
}
auto const path = directory / file;
diff --git a/src/buildtool/storage/garbage_collector.cpp b/src/buildtool/storage/garbage_collector.cpp
index 6f41dcd8..c2d9ecd0 100644
--- a/src/buildtool/storage/garbage_collector.cpp
+++ b/src/buildtool/storage/garbage_collector.cpp
@@ -68,13 +68,13 @@ auto GarbageCollector::LockFilePath(
auto GarbageCollector::TriggerGarbageCollection(
StorageConfig const& storage_config,
bool no_rotation) noexcept -> bool {
- auto const kRemoveMe = std::string{"remove-me"};
+ std::string const remove_me = "remove-me";
auto pid = CreateProcessUniqueId();
if (not pid) {
return false;
}
- auto remove_me_prefix = kRemoveMe + *pid + std::string{"-"};
+ auto remove_me_prefix = remove_me + *pid + std::string{"-"};
std::vector<std::filesystem::path> to_remove{};
// With a shared lock, we can remove all directories with the given prefix,
@@ -121,7 +121,7 @@ auto GarbageCollector::TriggerGarbageCollection(
std::vector<std::filesystem::path> left_over{};
for (auto const& entry :
std::filesystem::directory_iterator(storage_config.CacheRoot())) {
- if (entry.path().filename().string().starts_with(kRemoveMe)) {
+ if (entry.path().filename().string().starts_with(remove_me)) {
left_over.emplace_back(entry.path());
}
}
diff --git a/src/buildtool/storage/repository_garbage_collector.cpp b/src/buildtool/storage/repository_garbage_collector.cpp
index f1025795..67a08f9f 100644
--- a/src/buildtool/storage/repository_garbage_collector.cpp
+++ b/src/buildtool/storage/repository_garbage_collector.cpp
@@ -36,13 +36,14 @@ auto RepositoryGarbageCollector::LockFilePath(
auto RepositoryGarbageCollector::TriggerGarbageCollection(
StorageConfig const& storage_config) noexcept -> bool {
- auto const kRemoveMe = std::string{"remove-me"};
+ auto const remove_me_prefix = std::string{"remove-me"};
auto pid = CreateProcessUniqueId();
if (not pid) {
return false;
}
- auto remove_me = storage_config.RepositoryRoot() / (kRemoveMe + *pid);
+ auto remove_me =
+ storage_config.RepositoryRoot() / (remove_me_prefix + *pid);
// With a shared lock, we can remove that directory, if it exists,
// as we own the process id.
diff --git a/src/utils/cpp/hex_string.hpp b/src/utils/cpp/hex_string.hpp
index 4b0124c4..5cca094a 100644
--- a/src/utils/cpp/hex_string.hpp
+++ b/src/utils/cpp/hex_string.hpp
@@ -44,7 +44,7 @@
[[nodiscard]] static inline auto FromHexString(std::string const& hexstring)
-> std::optional<std::string> {
try {
- const std::size_t kHexBase = 16;
+ static constexpr std::size_t kHexBase = 16;
std::stringstream ss{};
for (std::size_t i = 0; i < hexstring.length(); i += 2) {
unsigned char c =
diff --git a/src/utils/cpp/type_safe_arithmetic.hpp b/src/utils/cpp/type_safe_arithmetic.hpp
index 1ff53ce8..2076a5bf 100644
--- a/src/utils/cpp/type_safe_arithmetic.hpp
+++ b/src/utils/cpp/type_safe_arithmetic.hpp
@@ -49,7 +49,7 @@ struct TypeSafeArithmeticTag {
/// \tparam TAG The actual \ref TypeSafeArithmeticTag
template <typename TAG>
class TypeSafeArithmetic {
- typename TAG::value_t m_value{};
+ typename TAG::value_t value_{};
public:
using tag_t = TAG;
@@ -81,17 +81,17 @@ class TypeSafeArithmetic {
}
// NOLINTNEXTLINE
- constexpr /*explicit*/ operator value_t() const { return m_value; }
+ constexpr /*explicit*/ operator value_t() const { return value_; }
- constexpr auto get() const -> value_t { return m_value; }
+ constexpr auto get() const -> value_t { return value_; }
constexpr void set(value_t value) {
Expects(value >= kMinValue and value <= kMaxValue and
"value output of range");
- m_value = value;
+ value_ = value;
}
- auto pointer() const -> const_pointer_t { return &m_value; }
+ auto pointer() const -> const_pointer_t { return &value_; }
};
// template <typename TAG>
diff --git a/test/buildtool/file_system/git_repo.test.cpp b/test/buildtool/file_system/git_repo.test.cpp
index ae3ded41..4fb5c0cb 100644
--- a/test/buildtool/file_system/git_repo.test.cpp
+++ b/test/buildtool/file_system/git_repo.test.cpp
@@ -214,12 +214,12 @@ TEST_CASE("Single-threaded real repository local operations", "[git_repo]") {
}
SECTION("Get head commit") {
- auto repo_wHead_path = TestUtils::CreateTestRepoWithCheckout();
- REQUIRE(repo_wHead_path);
- auto repo_wHead = GitRepo::Open(*repo_wHead_path);
- REQUIRE(repo_wHead);
+ auto repo_head_path = TestUtils::CreateTestRepoWithCheckout();
+ REQUIRE(repo_head_path);
+ auto repo_head = GitRepo::Open(*repo_head_path);
+ REQUIRE(repo_head);
- auto head_commit = repo_wHead->GetHeadCommit(logger);
+ auto head_commit = repo_head->GetHeadCommit(logger);
REQUIRE(head_commit);
CHECK(*head_commit == kRootCommit);
}
diff --git a/test/buildtool/multithreading/async_map_consumer.test.cpp b/test/buildtool/multithreading/async_map_consumer.test.cpp
index 3ba3eebf..4f7d54d8 100644
--- a/test/buildtool/multithreading/async_map_consumer.test.cpp
+++ b/test/buildtool/multithreading/async_map_consumer.test.cpp
@@ -248,7 +248,7 @@ TEST_CASE("Failure detection", "[async_map_consumer]") {
bool failed{};
SECTION("Unfinished pending keys") {
- int const kStep{3};
+ static constexpr int kStep = 3;
REQUIRE(std::lcm(kMaxVal, kStep) > kMaxVal);
auto map = CountToMaxConsumer(kMaxVal, kStep);
{
diff --git a/test/other_tools/git_operations/git_repo_remote.test.cpp b/test/other_tools/git_operations/git_repo_remote.test.cpp
index d1efe97c..39f0bd8a 100644
--- a/test/other_tools/git_operations/git_repo_remote.test.cpp
+++ b/test/other_tools/git_operations/git_repo_remote.test.cpp
@@ -269,26 +269,26 @@ TEST_CASE("Single-threaded fake repository operations", "[git_repo_remote]") {
SECTION("Fetch with refspec into repository") {
// set repo to fetch into
- auto path_fetch_wRefspec = TestUtils::GetRepoPath();
- auto repo_fetch_wRefspec = GitRepoRemote::InitAndOpen(
- path_fetch_wRefspec, /*is_bare=*/true);
- REQUIRE(repo_fetch_wRefspec);
+ auto path_fetch_refspec = TestUtils::GetRepoPath();
+ auto repo_fetch_refspec = GitRepoRemote::InitAndOpen(
+ path_fetch_refspec, /*is_bare=*/true);
+ REQUIRE(repo_fetch_refspec);
// check commit is not there before fetch
CHECK_FALSE(
- *repo_fetch_wRefspec->CheckCommitExists(kRootCommit, logger));
+ *repo_fetch_refspec->CheckCommitExists(kRootCommit, logger));
// fetch all
- REQUIRE(repo_fetch_wRefspec->FetchViaTmpRepo(storage_config.Get(),
- *repo_path,
- "master",
- {},
- "git",
- {},
- logger));
+ REQUIRE(repo_fetch_refspec->FetchViaTmpRepo(storage_config.Get(),
+ *repo_path,
+ "master",
+ {},
+ "git",
+ {},
+ logger));
// check commit is there after fetch
- CHECK(*repo_fetch_wRefspec->CheckCommitExists(kRootCommit, logger));
+ CHECK(*repo_fetch_refspec->CheckCommitExists(kRootCommit, logger));
}
}
diff --git a/test/other_tools/utils/curl_usage.test.cpp b/test/other_tools/utils/curl_usage.test.cpp
index d3b3fd49..980793bf 100644
--- a/test/other_tools/utils/curl_usage.test.cpp
+++ b/test/other_tools/utils/curl_usage.test.cpp
@@ -38,27 +38,27 @@ TEST_CASE("Curl context", "[curl_context]") {
}
TEST_CASE("Curl easy handle", "[curl_easy_handle]") {
- auto kServerUrl = std::string("http://127.0.0.1:") + getPort() +
- std::string("/test_file.txt");
- auto kTargetDir =
+ auto const serve_url = std::string("http://127.0.0.1:") + getPort() +
+ std::string("/test_file.txt");
+ auto const target_dir =
std::filesystem::path(std::getenv("TEST_TMPDIR")) / "target_dir";
// make target dir
- CHECK(FileSystemManager::CreateDirectory(kTargetDir));
+ CHECK(FileSystemManager::CreateDirectory(target_dir));
// create handle
auto curl_handle = CurlEasyHandle::Create();
REQUIRE(curl_handle);
SECTION("Curl download to file") {
// download test file from local HTTP server into new location
- auto file_path = kTargetDir / "test_file.txt";
- REQUIRE(curl_handle->DownloadToFile(kServerUrl, file_path) == 0);
+ auto file_path = target_dir / "test_file.txt";
+ REQUIRE(curl_handle->DownloadToFile(serve_url, file_path) == 0);
REQUIRE(FileSystemManager::IsFile(file_path));
}
SECTION("Curl download to string") {
// download test file from local HTTP server into string
- auto content = curl_handle->DownloadToString(kServerUrl);
+ auto content = curl_handle->DownloadToString(serve_url);
REQUIRE(content);
REQUIRE(*content == "test\n");
}
diff --git a/test/utils/logging/log_config.hpp b/test/utils/logging/log_config.hpp
index 816e73b9..3b920917 100644
--- a/test/utils/logging/log_config.hpp
+++ b/test/utils/logging/log_config.hpp
@@ -24,8 +24,8 @@
#include "src/buildtool/logging/log_sink_cmdline.hpp"
static auto ReadLogLevelFromEnv() -> LogLevel {
- LogLevel const kDefaultTestLogLevel{LogLevel::Error};
- LogLevel const kMaximumTestLogLevel{LogLevel::Trace};
+ static constexpr LogLevel kDefaultTestLogLevel = LogLevel::Error;
+ static constexpr LogLevel kMaximumTestLogLevel = LogLevel::Trace;
auto log_level{kDefaultTestLogLevel};