summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-08-05 12:40:04 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-08-07 14:43:19 +0200
commited6f31f4c9939d6cc8d4d317d561a94545750b0b (patch)
tree122e2a01c4a56b0fc25d94236d459101ffb80f65
parent4989605b096701fee6f1049bdad0827f81d9fb00 (diff)
downloadjustbuild-ed6f31f4c9939d6cc8d4d317d561a94545750b0b.tar.gz
Replace classic C boolean operators with keywords
! => not; && => and, || => or
-rw-r--r--src/buildtool/build_engine/base_maps/entity_name_data.hpp6
-rw-r--r--src/buildtool/build_engine/base_maps/json_file_map.hpp2
-rw-r--r--src/buildtool/build_engine/base_maps/module_name.hpp2
-rw-r--r--src/buildtool/build_engine/expression/evaluator.cpp9
-rw-r--r--src/buildtool/build_engine/expression/expression.hpp2
-rw-r--r--src/buildtool/build_engine/target_map/absent_target_map.cpp6
-rw-r--r--src/buildtool/build_engine/target_map/absent_target_map.hpp4
-rw-r--r--src/buildtool/build_engine/target_map/configured_target.hpp2
-rw-r--r--src/buildtool/build_engine/target_map/result_map.hpp4
-rw-r--r--src/buildtool/build_engine/target_map/target_map.cpp2
-rw-r--r--src/buildtool/build_engine/target_map/utils.cpp2
-rw-r--r--src/buildtool/common/cli.hpp2
-rw-r--r--src/buildtool/execution_api/execution_service/ac_server.cpp4
-rw-r--r--src/buildtool/execution_api/execution_service/bytestream_server.cpp16
-rw-r--r--src/buildtool/execution_api/execution_service/capabilities_server.cpp2
-rw-r--r--src/buildtool/execution_api/execution_service/cas_server.cpp18
-rw-r--r--src/buildtool/execution_api/execution_service/execution_server.cpp30
-rw-r--r--src/buildtool/execution_api/execution_service/operations_server.cpp2
-rw-r--r--src/buildtool/execution_api/execution_service/server_implementation.cpp12
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp4
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp4
-rw-r--r--src/buildtool/execution_engine/dag/dag.cpp12
-rw-r--r--src/buildtool/execution_engine/dag/dag.hpp2
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp6
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp18
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp2
-rw-r--r--src/buildtool/main/build_utils.cpp2
-rw-r--r--src/buildtool/main/describe.cpp6
-rw-r--r--src/buildtool/main/main.cpp4
-rw-r--r--src/buildtool/main/serve.cpp8
-rw-r--r--src/buildtool/multithreading/notification_queue.hpp6
-rw-r--r--src/buildtool/progress_reporting/exports_progress_reporter.cpp2
-rw-r--r--src/buildtool/progress_reporting/progress_reporter.cpp4
-rw-r--r--src/buildtool/serve_api/remote/configuration_client.cpp2
-rw-r--r--src/buildtool/serve_api/remote/target_client.cpp12
-rw-r--r--src/buildtool/serve_api/serve_service/serve_server_implementation.cpp12
-rw-r--r--src/buildtool/serve_api/serve_service/source_tree.cpp24
-rw-r--r--src/buildtool/serve_api/serve_service/target.cpp20
-rw-r--r--src/buildtool/storage/file_chunker.cpp2
-rw-r--r--src/other_tools/git_operations/git_ops_types.hpp4
-rw-r--r--src/other_tools/git_operations/git_repo_remote.cpp4
-rw-r--r--src/other_tools/just_mr/progress_reporting/progress_reporter.cpp2
-rw-r--r--src/other_tools/ops_maps/git_tree_fetch_map.cpp2
-rw-r--r--src/other_tools/repo_map/repos_to_setup_map.cpp2
-rw-r--r--src/utils/cpp/type_safe_arithmetic.hpp2
-rw-r--r--src/utils/cpp/verify_hash.hpp2
-rw-r--r--test/buildtool/build_engine/base_maps/directory_map.test.cpp2
-rw-r--r--test/buildtool/build_engine/base_maps/json_file_map.test.cpp2
-rw-r--r--test/buildtool/build_engine/target_map/target_map.test.cpp26
-rw-r--r--test/buildtool/build_engine/target_map/target_map_internals.test.cpp4
-rw-r--r--test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp2
-rw-r--r--test/buildtool/execution_engine/traverser/traverser.test.cpp4
-rw-r--r--test/buildtool/logging/log_sink_file.test.cpp2
-rw-r--r--test/buildtool/multithreading/async_map_consumer.test.cpp2
-rw-r--r--test/buildtool/multithreading/task.test.cpp12
-rw-r--r--test/utils/large_objects/large_object_utils.cpp2
56 files changed, 178 insertions, 177 deletions
diff --git a/src/buildtool/build_engine/base_maps/entity_name_data.hpp b/src/buildtool/build_engine/base_maps/entity_name_data.hpp
index d6228f64..ba227bc4 100644
--- a/src/buildtool/build_engine/base_maps/entity_name_data.hpp
+++ b/src/buildtool/build_engine/base_maps/entity_name_data.hpp
@@ -35,7 +35,7 @@ struct AnonymousTarget {
[[nodiscard]] auto operator==(AnonymousTarget const& other) const noexcept
-> bool {
- return rule_map == other.rule_map && target_node == other.target_node;
+ return rule_map == other.rule_map and target_node == other.target_node;
}
};
@@ -72,8 +72,8 @@ struct NamedTarget {
[[nodiscard]] auto ToString() const -> std::string;
[[nodiscard]] friend auto operator==(NamedTarget const& x,
NamedTarget const& y) -> bool {
- return x.repository == y.repository && x.module == y.module &&
- x.name == y.name && x.reference_t == y.reference_t;
+ return x.repository == y.repository and x.module == y.module and
+ x.name == y.name and x.reference_t == y.reference_t;
}
[[nodiscard]] friend auto operator!=(NamedTarget const& x,
NamedTarget const& y) -> bool {
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 ad697ac9..c18a713e 100644
--- a/src/buildtool/build_engine/base_maps/json_file_map.hpp
+++ b/src/buildtool/build_engine/base_maps/json_file_map.hpp
@@ -113,7 +113,7 @@ auto CreateJsonFileMap(
true);
return;
}
- if (!json.is_object()) {
+ if (not json.is_object()) {
(*logger)(fmt::format("JSON in {} is not an object.",
json_file_path.string()),
true);
diff --git a/src/buildtool/build_engine/base_maps/module_name.hpp b/src/buildtool/build_engine/base_maps/module_name.hpp
index 84f5e837..8ff582c5 100644
--- a/src/buildtool/build_engine/base_maps/module_name.hpp
+++ b/src/buildtool/build_engine/base_maps/module_name.hpp
@@ -32,7 +32,7 @@ struct ModuleName {
[[nodiscard]] auto operator==(ModuleName const& other) const noexcept
-> bool {
- return module == other.module && repository == other.repository;
+ return module == other.module and repository == other.repository;
}
};
} // namespace BuildMaps::Base
diff --git a/src/buildtool/build_engine/expression/evaluator.cpp b/src/buildtool/build_engine/expression/evaluator.cpp
index 852d8c37..e2b3819d 100644
--- a/src/buildtool/build_engine/expression/evaluator.cpp
+++ b/src/buildtool/build_engine/expression/evaluator.cpp
@@ -862,8 +862,9 @@ auto ToSubdirExpr(SubExprEvaluator&& eval,
for (auto const& el : d->Map()) {
std::filesystem::path k{el.first};
auto new_key = ToNormalPath(subdir / k.filename()).string();
- if (result.contains(new_key) &&
- !((result[new_key] == el.second) && el.second->IsCacheable())) {
+ if (result.contains(new_key) and
+ not((result[new_key] == el.second) and
+ el.second->IsCacheable())) {
// Check if the user specifed an error message for that case,
// otherwise just generate a generic error message.
auto msg_expr = expr->Map().Find("msg");
@@ -895,8 +896,8 @@ auto ToSubdirExpr(SubExprEvaluator&& eval,
for (auto const& el : d->Map()) {
auto new_key = ToNormalPath(subdir / el.first).string();
if (auto it = result.find(new_key);
- it != result.end() &&
- (!((it->second == el.second) && el.second->IsCacheable()))) {
+ it != result.end() and
+ (not((it->second == el.second) and el.second->IsCacheable()))) {
auto msg_expr = expr->Map().Find("msg");
if (not msg_expr) {
throw Evaluator::EvaluationError{fmt::format(
diff --git a/src/buildtool/build_engine/expression/expression.hpp b/src/buildtool/build_engine/expression/expression.hpp
index 219a5927..89f5c5ea 100644
--- a/src/buildtool/build_engine/expression/expression.hpp
+++ b/src/buildtool/build_engine/expression/expression.hpp
@@ -210,7 +210,7 @@ class Expression {
template <class T>
[[nodiscard]] auto operator!=(T const& other) const noexcept -> bool {
- return !(*this == other);
+ return not(*this == other);
}
[[nodiscard]] auto operator[](
std::string const& key) const& -> ExpressionPtr const&;
diff --git a/src/buildtool/build_engine/target_map/absent_target_map.cpp b/src/buildtool/build_engine/target_map/absent_target_map.cpp
index 3c886586..bdf66019 100644
--- a/src/buildtool/build_engine/target_map/absent_target_map.cpp
+++ b/src/buildtool/build_engine/target_map/absent_target_map.cpp
@@ -60,7 +60,7 @@ void WithFlexibleVariables(
auto target_name = key.target.GetNamedTarget();
auto repo_key = context->repo_config->RepositoryKey(*context->storage,
target_name.repository);
- if (!repo_key) {
+ if (not repo_key) {
(*logger)(fmt::format("Failed to obtain repository key for repo \"{}\"",
target_name.repository),
/*fatal=*/true);
@@ -134,7 +134,7 @@ void WithFlexibleVariables(
}
}
- if (!target_cache_value) {
+ if (not target_cache_value) {
(*logger)(fmt::format("Could not get target cache value for key {}",
target_cache_key->Id().ToString()),
/*fatal=*/true);
@@ -240,7 +240,7 @@ auto BuildMaps::Target::CreateAbsentTargetMap(
auto const& repo_name = key.target.ToModule().repository;
auto target_root_id =
context->repo_config->TargetRoot(repo_name)->GetAbsentTreeId();
- if (!target_root_id) {
+ if (not target_root_id) {
(*logger)(fmt::format("Failed to get the target root id for "
"repository \"{}\"",
repo_name),
diff --git a/src/buildtool/build_engine/target_map/absent_target_map.hpp b/src/buildtool/build_engine/target_map/absent_target_map.hpp
index 7d04f5f4..6dc36a7d 100644
--- a/src/buildtool/build_engine/target_map/absent_target_map.hpp
+++ b/src/buildtool/build_engine/target_map/absent_target_map.hpp
@@ -37,8 +37,8 @@ struct AbsentTargetDescription {
[[nodiscard]] auto operator==(
AbsentTargetDescription const& other) const noexcept -> bool {
- return target_root_id == other.target_root_id &&
- target_file == other.target_file && target == other.target;
+ return target_root_id == other.target_root_id and
+ target_file == other.target_file and target == other.target;
}
};
diff --git a/src/buildtool/build_engine/target_map/configured_target.hpp b/src/buildtool/build_engine/target_map/configured_target.hpp
index 962508ec..9a374b5a 100644
--- a/src/buildtool/build_engine/target_map/configured_target.hpp
+++ b/src/buildtool/build_engine/target_map/configured_target.hpp
@@ -35,7 +35,7 @@ struct ConfiguredTarget {
[[nodiscard]] auto operator==(
BuildMaps::Target::ConfiguredTarget const& other) const noexcept
-> bool {
- return target == other.target && config == other.config;
+ return target == other.target and config == other.config;
}
[[nodiscard]] auto ToString() const noexcept -> std::string {
diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp
index ed6511fa..9d7787bc 100644
--- a/src/buildtool/build_engine/target_map/result_map.hpp
+++ b/src/buildtool/build_engine/target_map/result_map.hpp
@@ -224,8 +224,8 @@ class ResultTargetMap {
[](auto const& left, auto const& right) {
auto left_target = left.first.ToString();
auto right_target = right.first.ToString();
- return (left_target < right_target) ||
- (left_target == right_target &&
+ return (left_target < right_target) or
+ (left_target == right_target and
left.second < right.second);
});
}
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp
index c7002270..ab6461e3 100644
--- a/src/buildtool/build_engine/target_map/target_map.cpp
+++ b/src/buildtool/build_engine/target_map/target_map.cpp
@@ -973,7 +973,7 @@ void withDependencies(
}
auto occurrences =
ListDependencies(object, deps_by_transition, effective_conf);
- if (!occurrences.empty()) {
+ if (not occurrences.empty()) {
return fmt::format(
"\nArtifact {} occurs in direct dependencies{}",
object->ToString(),
diff --git a/src/buildtool/build_engine/target_map/utils.cpp b/src/buildtool/build_engine/target_map/utils.cpp
index c4f19248..8a8af17c 100644
--- a/src/buildtool/build_engine/target_map/utils.cpp
+++ b/src/buildtool/build_engine/target_map/utils.cpp
@@ -103,7 +103,7 @@ auto BuildMaps::Target::Utils::artifacts_tree(const ExpressionPtr& map)
for (auto const& [key, artifact] : map->Map()) {
auto location = ToNormalPath(std::filesystem::path{key}).string();
if (auto it = result.find(location);
- it != result.end() && !(it->second == artifact)) {
+ it != result.end() and not(it->second == artifact)) {
return location;
}
result.emplace(std::move(location), artifact);
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index de33b038..79beaadb 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -414,7 +414,7 @@ static inline auto SetupCacheArguments(
"--local-build-root",
[clargs](auto const& build_root_raw) {
std::filesystem::path root = ToNormalPath(build_root_raw);
- if (!root.is_absolute()) {
+ if (not root.is_absolute()) {
try {
root = std::filesystem::absolute(root);
} catch (std::exception const& e) {
diff --git a/src/buildtool/execution_api/execution_service/ac_server.cpp b/src/buildtool/execution_api/execution_service/ac_server.cpp
index 83b95c7f..0d85596e 100644
--- a/src/buildtool/execution_api/execution_service/ac_server.cpp
+++ b/src/buildtool/execution_api/execution_service/ac_server.cpp
@@ -31,13 +31,13 @@ auto ActionCacheServiceImpl::GetActionResult(
"GetActionResult: {}",
request->action_digest().hash());
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
auto str = fmt::format("Could not acquire SharedLock");
logger_.Emit(LogLevel::Error, str);
return grpc::Status{grpc::StatusCode::INTERNAL, str};
}
auto x = storage_.ActionCache().CachedResult(request->action_digest());
- if (!x) {
+ if (not x) {
return grpc::Status{
grpc::StatusCode::NOT_FOUND,
fmt::format("{} missing from AC", request->action_digest().hash())};
diff --git a/src/buildtool/execution_api/execution_service/bytestream_server.cpp b/src/buildtool/execution_api/execution_service/bytestream_server.cpp
index cc49591b..fd169fd8 100644
--- a/src/buildtool/execution_api/execution_service/bytestream_server.cpp
+++ b/src/buildtool/execution_api/execution_service/bytestream_server.cpp
@@ -50,7 +50,7 @@ auto BytestreamServiceImpl::Read(
// remote-execution/blobs/62f408d64bca5de775c4b1dbc3288fc03afd6b19eb/0
std::istringstream iss{request->resource_name()};
auto hash = ParseResourceName(request->resource_name());
- if (!hash) {
+ if (not hash) {
auto str = fmt::format("could not parse {}", request->resource_name());
logger_.Emit(LogLevel::Error, "{}", str);
return ::grpc::Status{::grpc::StatusCode::INVALID_ARGUMENT, str};
@@ -62,7 +62,7 @@ auto BytestreamServiceImpl::Read(
}
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
auto str = fmt::format("Could not acquire SharedLock");
logger_.Emit(LogLevel::Error, str);
return grpc::Status{grpc::StatusCode::INTERNAL, str};
@@ -79,7 +79,7 @@ auto BytestreamServiceImpl::Read(
path =
storage_.CAS().BlobPath(static_cast<bazel_re::Digest>(dgst), false);
}
- if (!path) {
+ if (not path) {
auto str = fmt::format("could not find {}", *hash);
logger_.Emit(LogLevel::Error, "{}", str);
return ::grpc::Status{::grpc::StatusCode::NOT_FOUND, str};
@@ -90,7 +90,7 @@ auto BytestreamServiceImpl::Read(
std::string buffer(kChunkSize, '\0');
bool done = false;
blob.seekg(request->read_offset());
- while (!done) {
+ while (not done) {
blob.read(buffer.data(), kChunkSize);
if (blob.eof()) {
// do not send random bytes
@@ -111,7 +111,7 @@ auto BytestreamServiceImpl::Write(
reader->Read(&request);
logger_.Emit(LogLevel::Debug, "write {}", request.resource_name());
auto hash = ParseResourceName(request.resource_name());
- if (!hash) {
+ if (not hash) {
auto str = fmt::format("could not parse {}", request.resource_name());
logger_.Emit(LogLevel::Error, "{}", str);
return ::grpc::Status{::grpc::StatusCode::INVALID_ARGUMENT, str};
@@ -126,13 +126,13 @@ auto BytestreamServiceImpl::Write(
request.write_offset(),
request.finish_write());
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
auto str = fmt::format("Could not acquire SharedLock");
logger_.Emit(LogLevel::Error, str);
return grpc::Status{grpc::StatusCode::INTERNAL, str};
}
auto tmp_dir = storage_config_.CreateTypedTmpDir("execution-service");
- if (!tmp_dir) {
+ if (not tmp_dir) {
return ::grpc::Status{::grpc::StatusCode::INTERNAL,
"could not create TmpDir"};
}
@@ -142,7 +142,7 @@ auto BytestreamServiceImpl::Write(
of.write(request.data().data(),
static_cast<std::streamsize>(request.data().size()));
}
- while (!request.finish_write() && reader->Read(&request)) {
+ while (not request.finish_write() and reader->Read(&request)) {
std::ofstream of{tmp, std::ios::binary | std::ios::app};
of.write(request.data().data(),
static_cast<std::streamsize>(request.data().size()));
diff --git a/src/buildtool/execution_api/execution_service/capabilities_server.cpp b/src/buildtool/execution_api/execution_service/capabilities_server.cpp
index 71a1361f..d8ba4279 100644
--- a/src/buildtool/execution_api/execution_service/capabilities_server.cpp
+++ b/src/buildtool/execution_api/execution_service/capabilities_server.cpp
@@ -25,7 +25,7 @@ auto CapabilitiesServiceImpl::GetCapabilities(
const ::bazel_re::GetCapabilitiesRequest*
/*request*/,
::bazel_re::ServerCapabilities* response) -> ::grpc::Status {
- if (!Compatibility::IsCompatible()) {
+ if (not Compatibility::IsCompatible()) {
auto const* str = "GetCapabilities not implemented";
Logger::Log(LogLevel::Error, str);
return ::grpc::Status{grpc::StatusCode::UNIMPLEMENTED, str};
diff --git a/src/buildtool/execution_api/execution_service/cas_server.cpp b/src/buildtool/execution_api/execution_service/cas_server.cpp
index 67437be6..3ab31fc8 100644
--- a/src/buildtool/execution_api/execution_service/cas_server.cpp
+++ b/src/buildtool/execution_api/execution_service/cas_server.cpp
@@ -36,7 +36,7 @@ static constexpr std::size_t kSHA256Length = 64;
static auto IsValidHash(std::string const& x) -> bool {
auto error_msg = IsAHash(x);
auto const& length = x.size();
- return !error_msg and
+ return not error_msg and
((Compatibility::IsCompatible() and length == kSHA256Length) or
length == kGitSHA1Length);
}
@@ -63,7 +63,7 @@ auto CASServiceImpl::FindMissingBlobs(
const ::bazel_re::FindMissingBlobsRequest* request,
::bazel_re::FindMissingBlobsResponse* response) -> ::grpc::Status {
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
auto str =
fmt::format("FindMissingBlobs: could not acquire SharedLock");
logger_.Emit(LogLevel::Error, str);
@@ -72,7 +72,7 @@ auto CASServiceImpl::FindMissingBlobs(
for (auto const& x : request->blob_digests()) {
auto const& hash = x.hash();
- if (!IsValidHash(hash)) {
+ if (not IsValidHash(hash)) {
logger_.Emit(LogLevel::Error,
"FindMissingBlobs: unsupported digest {}",
hash);
@@ -120,7 +120,7 @@ auto CASServiceImpl::BatchUpdateBlobs(
const ::bazel_re::BatchUpdateBlobsRequest* request,
::bazel_re::BatchUpdateBlobsResponse* response) -> ::grpc::Status {
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
auto str =
fmt::format("BatchUpdateBlobs: could not acquire SharedLock");
logger_.Emit(LogLevel::Error, str);
@@ -129,7 +129,7 @@ auto CASServiceImpl::BatchUpdateBlobs(
for (auto const& x : request->requests()) {
auto const& hash = x.digest().hash();
logger_.Emit(LogLevel::Trace, "BatchUpdateBlobs: {}", hash);
- if (!IsValidHash(hash)) {
+ if (not IsValidHash(hash)) {
auto const& str =
fmt::format("BatchUpdateBlobs: unsupported digest {}", hash);
logger_.Emit(LogLevel::Error, "{}", str);
@@ -149,7 +149,7 @@ auto CASServiceImpl::BatchUpdateBlobs(
str};
}
auto const& dgst = storage_.CAS().StoreTree(x.data());
- if (!dgst) {
+ if (not dgst) {
auto const& str = fmt::format(
"BatchUpdateBlobs: could not upload tree {}", hash);
logger_.Emit(LogLevel::Error, "{}", str);
@@ -163,7 +163,7 @@ auto CASServiceImpl::BatchUpdateBlobs(
}
else {
auto const& dgst = storage_.CAS().StoreBlob(x.data(), false);
- if (!dgst) {
+ if (not dgst) {
auto const& str = fmt::format(
"BatchUpdateBlobs: could not upload blob {}", hash);
logger_.Emit(LogLevel::Error, "{}", str);
@@ -184,7 +184,7 @@ auto CASServiceImpl::BatchReadBlobs(
const ::bazel_re::BatchReadBlobsRequest* request,
::bazel_re::BatchReadBlobsResponse* response) -> ::grpc::Status {
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
auto str = fmt::format("BatchReadBlobs: Could not acquire SharedLock");
logger_.Emit(LogLevel::Error, "{}", str);
return grpc::Status{grpc::StatusCode::INTERNAL, str};
@@ -199,7 +199,7 @@ auto CASServiceImpl::BatchReadBlobs(
else {
path = storage_.CAS().BlobPath(digest, false);
}
- if (!path) {
+ if (not path) {
google::rpc::Status status;
status.set_code(grpc::StatusCode::NOT_FOUND);
r->mutable_status()->CopyFrom(status);
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp
index 2e56bd04..132a812f 100644
--- a/src/buildtool/execution_api/execution_service/execution_server.cpp
+++ b/src/buildtool/execution_api/execution_service/execution_server.cpp
@@ -46,7 +46,7 @@ auto ExecutionServiceImpl::GetAction(::bazel_re::ExecuteRequest const* request)
return {std::nullopt, *error_msg};
}
auto path = storage_.CAS().BlobPath(request->action_digest(), false);
- if (!path) {
+ if (not path) {
auto str = fmt::format("could not retrieve blob {} from cas",
request->action_digest().hash());
logger_.Emit(LogLevel::Error, "{}", str);
@@ -55,7 +55,7 @@ auto ExecutionServiceImpl::GetAction(::bazel_re::ExecuteRequest const* request)
::bazel_re::Action action{};
{
std::ifstream f(*path);
- if (!action.ParseFromIstream(&f)) {
+ if (not action.ParseFromIstream(&f)) {
auto str = fmt::format("failed to parse action from blob {}",
request->action_digest().hash());
logger_.Emit(LogLevel::Error, "{}", str);
@@ -71,7 +71,7 @@ auto ExecutionServiceImpl::GetAction(::bazel_re::ExecuteRequest const* request)
? storage_.CAS().BlobPath(action.input_root_digest(), false)
: storage_.CAS().TreePath(action.input_root_digest());
- if (!path) {
+ if (not path) {
auto str = fmt::format("could not retrieve input root {} from cas",
action.input_root_digest().hash());
logger_.Emit(LogLevel::Error, "{}", str);
@@ -88,7 +88,7 @@ auto ExecutionServiceImpl::GetCommand(::bazel_re::Action const& action)
return {std::nullopt, *error_msg};
}
auto path = storage_.CAS().BlobPath(action.command_digest(), false);
- if (!path) {
+ if (not path) {
auto str = fmt::format("could not retrieve blob {} from cas",
action.command_digest().hash());
logger_.Emit(LogLevel::Error, "{}", str);
@@ -98,7 +98,7 @@ auto ExecutionServiceImpl::GetCommand(::bazel_re::Action const& action)
::bazel_re::Command c{};
{
std::ifstream f(*path);
- if (!c.ParseFromIstream(&f)) {
+ if (not c.ParseFromIstream(&f)) {
auto str = fmt::format("failed to parse command from blob {}",
action.command_digest().hash());
logger_.Emit(LogLevel::Error, "{}", str);
@@ -127,7 +127,7 @@ auto ExecutionServiceImpl::GetIExecutionAction(
std::optional<std::string>> {
auto [c, msg_c] = GetCommand(action);
- if (!c) {
+ if (not c) {
return {std::nullopt, *msg_c};
}
@@ -141,7 +141,7 @@ auto ExecutionServiceImpl::GetIExecutionAction(
{c->output_directories().begin(), c->output_directories().end()},
env_vars,
{});
- if (!i_execution_action) {
+ if (not i_execution_action) {
auto str = fmt::format("could not create action from {}",
request->action_digest().hash());
logger_.Emit(LogLevel::Error, "{}", str);
@@ -366,7 +366,7 @@ auto ExecutionServiceImpl::AddResult(
if (i_execution_response->HasStdErr()) {
auto dgst = storage_.CAS().StoreBlob(i_execution_response->StdErr(),
/*is_executable=*/false);
- if (!dgst) {
+ if (not dgst) {
auto str =
fmt::format("Could not store stderr of action {}", action_hash);
logger_.Emit(LogLevel::Error, "{}", str);
@@ -377,7 +377,7 @@ auto ExecutionServiceImpl::AddResult(
if (i_execution_response->HasStdOut()) {
auto dgst = storage_.CAS().StoreBlob(i_execution_response->StdOut(),
/*is_executable=*/false);
- if (!dgst) {
+ if (not dgst) {
auto str =
fmt::format("Could not store stdout of action {}", action_hash);
logger_.Emit(LogLevel::Error, "{}", str);
@@ -448,18 +448,18 @@ auto ExecutionServiceImpl::Execute(
::grpc::ServerWriter<::google::longrunning::Operation>* writer)
-> ::grpc::Status {
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
auto str = fmt::format("Could not acquire SharedLock");
logger_.Emit(LogLevel::Error, str);
return grpc::Status{grpc::StatusCode::INTERNAL, str};
}
auto [action, msg_a] = GetAction(request);
- if (!action) {
+ if (not action) {
return ::grpc::Status{grpc::StatusCode::INTERNAL, *msg_a};
}
auto [i_execution_action, msg] = GetIExecutionAction(request, *action);
- if (!i_execution_action) {
+ if (not i_execution_action) {
return ::grpc::Status{grpc::StatusCode::INTERNAL, *msg};
}
@@ -482,7 +482,7 @@ auto ExecutionServiceImpl::Execute(
std::chrono::duration_cast<std::chrono::seconds>(t1 - t0).count());
auto [execute_response, msg_r] = GetResponse(request, i_execution_response);
- if (!execute_response) {
+ if (not execute_response) {
return ::grpc::Status{grpc::StatusCode::INTERNAL, *msg_r};
}
@@ -509,14 +509,14 @@ auto ExecutionServiceImpl::WaitExecution(
std::optional<::google::longrunning::Operation> op;
do {
op = op_cache_.Query(hash);
- if (!op) {
+ if (not op) {
auto const& str = fmt::format(
"Executing action {} not found in internal cache.", hash);
logger_.Emit(LogLevel::Error, "{}", str);
return ::grpc::Status{grpc::StatusCode::INTERNAL, str};
}
std::this_thread::sleep_for(std::chrono::seconds(1));
- } while (!op->done());
+ } while (not op->done());
writer->Write(*op);
logger_.Emit(LogLevel::Trace, "Finished WaitExecution {}", hash);
return ::grpc::Status::OK;
diff --git a/src/buildtool/execution_api/execution_service/operations_server.cpp b/src/buildtool/execution_api/execution_service/operations_server.cpp
index 23023c7d..0654a5ff 100644
--- a/src/buildtool/execution_api/execution_service/operations_server.cpp
+++ b/src/buildtool/execution_api/execution_service/operations_server.cpp
@@ -30,7 +30,7 @@ auto OperarationsServiceImpl::GetOperation(
logger_.Emit(LogLevel::Trace, "GetOperation: {}", hash);
std::optional<::google::longrunning::Operation> op;
op = op_cache_.Query(hash);
- if (!op) {
+ if (not op) {
auto const& str = fmt::format(
"Executing action {} not found in internal cache.", hash);
logger_.Emit(LogLevel::Error, "{}", str);
diff --git a/src/buildtool/execution_api/execution_service/server_implementation.cpp b/src/buildtool/execution_api/execution_service/server_implementation.cpp
index 43edd6aa..988d22a7 100644
--- a/src/buildtool/execution_api/execution_service/server_implementation.cpp
+++ b/src/buildtool/execution_api/execution_service/server_implementation.cpp
@@ -41,7 +41,7 @@ namespace {
template <typename T>
auto TryWrite(std::string const& file, T const& content) noexcept -> bool {
std::ofstream of{file};
- if (!of.good()) {
+ if (not of.good()) {
Logger::Log(LogLevel::Error,
"Could not open {}. Make sure to have write permissions",
file);
@@ -123,7 +123,7 @@ auto ServerImpl::Run(gsl::not_null<LocalContext const*> const& local_context,
fmt::format("{}:{}", interface_, port_), creds, &port_);
auto server = builder.BuildAndStart();
- if (!server) {
+ if (not server) {
Logger::Log(LogLevel::Error, "Could not start execution service");
return false;
}
@@ -133,8 +133,8 @@ auto ServerImpl::Run(gsl::not_null<LocalContext const*> const& local_context,
nlohmann::json const& info = {
{"interface", interface_}, {"port", port_}, {"pid", pid}};
- if (!pid_file_.empty()) {
- if (!TryWrite(pid_file_, pid)) {
+ if (not pid_file_.empty()) {
+ if (not TryWrite(pid_file_, pid)) {
server->Shutdown();
return false;
}
@@ -146,8 +146,8 @@ auto ServerImpl::Run(gsl::not_null<LocalContext const*> const& local_context,
Compatibility::IsCompatible() ? "compatible " : "",
info_str));
- if (!info_file_.empty()) {
- if (!TryWrite(info_file_, info_str)) {
+ if (not info_file_.empty()) {
+ if (not TryWrite(info_file_, info_str)) {
server->Shutdown();
return false;
}
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
index 28400a51..552fab3c 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
@@ -292,7 +292,7 @@ auto BazelCasClient::GetTree(std::string const& instance_name,
while (stream->Read(&response)) {
result = ProcessResponseContents<bazel_re::Directory>(response);
auto const& next_page_token = response.next_page_token();
- if (!next_page_token.empty()) {
+ if (not next_page_token.empty()) {
// recursively call this function with token for next page
auto next_result =
GetTree(instance_name, root_digest, page_size, next_page_token);
@@ -335,7 +335,7 @@ auto BazelCasClient::UpdateSingleBlob(std::string const& instance_name,
blob.digest.hash(),
blob.digest.size_bytes()),
*blob.data);
- if (!ok) {
+ if (not ok) {
logger_.Emit(LogLevel::Error,
"Failed to write {}:{}",
blob.digest.hash(),
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp
index 7cf9e011..15ff2c34 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp
@@ -91,7 +91,7 @@ auto BazelExecutionClient::Execute(std::string const& instance_name,
reader(stub_->Execute(&context, request));
auto [op, fatal, error_msg] = ReadExecution(reader.get(), wait);
- if (!op.has_value()) {
+ if (not op.has_value()) {
return {
.ok = false, .exit_retry_loop = fatal, .error_msg = error_msg};
}
@@ -127,7 +127,7 @@ auto BazelExecutionClient::WaitExecution(std::string const& execution_handle)
auto [op, fatal, error_msg] =
ReadExecution(reader.get(), /*wait=*/true);
- if (!op.has_value()) {
+ if (not op.has_value()) {
return {
.ok = false, .exit_retry_loop = fatal, .error_msg = error_msg};
}
diff --git a/src/buildtool/execution_engine/dag/dag.cpp b/src/buildtool/execution_engine/dag/dag.cpp
index c36ec664..17f4b3af 100644
--- a/src/buildtool/execution_engine/dag/dag.cpp
+++ b/src/buildtool/execution_engine/dag/dag.cpp
@@ -80,21 +80,21 @@ auto DependencyGraph::LinkNodePointers(
gsl::not_null<ActionNode*> const& action_node,
std::vector<NamedArtifactNodePtr> const& input_nodes) noexcept -> bool {
for (auto const& named_file : output_files) {
- if (!named_file.node->AddBuilderActionNode(action_node) ||
- !action_node->AddOutputFile(named_file)) {
+ if (not named_file.node->AddBuilderActionNode(action_node) or
+ not action_node->AddOutputFile(named_file)) {
return false;
}
}
for (auto const& named_dir : output_dirs) {
- if (!named_dir.node->AddBuilderActionNode(action_node) ||
- !action_node->AddOutputDir(named_dir)) {
+ if (not named_dir.node->AddBuilderActionNode(action_node) or
+ not action_node->AddOutputDir(named_dir)) {
return false;
}
}
for (auto const& named_node : input_nodes) {
- if (!named_node.node->AddConsumerActionNode(action_node) ||
- !action_node->AddDependency(named_node)) {
+ if (not named_node.node->AddConsumerActionNode(action_node) or
+ not action_node->AddDependency(named_node)) {
return false;
}
}
diff --git a/src/buildtool/execution_engine/dag/dag.hpp b/src/buildtool/execution_engine/dag/dag.hpp
index c459b4c8..422e42c6 100644
--- a/src/buildtool/execution_engine/dag/dag.hpp
+++ b/src/buildtool/execution_engine/dag/dag.hpp
@@ -440,7 +440,7 @@ class DependencyGraph : DirectedAcyclicGraph {
}
[[nodiscard]] auto HasBuilderAction() const noexcept -> bool {
- return !base::Children().empty();
+ return not base::Children().empty();
}
[[nodiscard]] auto BuilderActionNode() const noexcept
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index bf107e31..1b2bfe26 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -540,7 +540,7 @@ class ExecutorImpl {
bool count_as_executed = false) -> bool {
logger.Emit(LogLevel::Trace, "finished execution");
- if (!response) {
+ if (not response) {
logger.Emit(LogLevel::Trace, "response is empty");
return false;
}
@@ -609,7 +609,7 @@ class ExecutorImpl {
Logger const& logger,
gsl::not_null<DependencyGraph::ActionNode const*> const& action,
IExecutionResponse::Ptr const& response) noexcept {
- if (!response) {
+ if (not response) {
logger.Emit(LogLevel::Error, "response is empty");
return;
}
@@ -657,7 +657,7 @@ class ExecutorImpl {
msg << nlohmann::json(action->Env()).dump();
auto const& origin_map = progress->OriginMap();
auto origins = origin_map.find(action->Content().Id());
- if (origins != origin_map.end() and !origins->second.empty()) {
+ if (origins != origin_map.end() and not origins->second.empty()) {
msg << "\nrequested by";
for (auto const& origin : origins->second) {
msg << "\n - ";
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index ab4f2e0d..0e00537a 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -78,7 +78,7 @@ class FileSystemManager {
auto operator=(DirectoryAnchor const&) -> DirectoryAnchor& = delete;
auto operator=(DirectoryAnchor&&) -> DirectoryAnchor& = delete;
~DirectoryAnchor() noexcept {
- if (!kRestorePath.empty()) {
+ if (not kRestorePath.empty()) {
try {
std::filesystem::current_path(kRestorePath);
} catch (std::exception const& e) {
@@ -483,11 +483,11 @@ class FileSystemManager {
std::filesystem::path const& file) noexcept -> bool {
try {
auto status = std::filesystem::symlink_status(file);
- if (!std::filesystem::exists(status)) {
+ if (not std::filesystem::exists(status)) {
return true;
}
- if (!std::filesystem::is_regular_file(status) and
- !std::filesystem::is_symlink(status)) {
+ if (not std::filesystem::is_regular_file(status) and
+ not std::filesystem::is_symlink(status)) {
return false;
}
return std::filesystem::remove(file);
@@ -505,10 +505,10 @@ class FileSystemManager {
-> bool {
try {
auto status = std::filesystem::symlink_status(dir);
- if (!std::filesystem::exists(status)) {
+ if (not std::filesystem::exists(status)) {
return true;
}
- if (!std::filesystem::is_directory(status)) {
+ if (not std::filesystem::is_directory(status)) {
return false;
}
if (recursively) {
@@ -582,7 +582,7 @@ class FileSystemManager {
-> bool {
try {
auto const status = std::filesystem::symlink_status(file);
- if (!std::filesystem::is_regular_file(status)) {
+ if (not std::filesystem::is_regular_file(status)) {
return false;
}
} catch (std::exception const& e) {
@@ -1080,7 +1080,7 @@ class FileSystemManager {
}
try {
std::ofstream writer{file};
- if (!writer.is_open()) {
+ if (not writer.is_open()) {
Logger::Log(
LogLevel::Error, "can not open file {}", file.string());
return false;
@@ -1220,7 +1220,7 @@ class FileSystemManager {
while ((len = read(in.fd, buf.data(), buf.size())) > 0) {
ssize_t wlen{};
ssize_t written_len{};
- while (written_len < len &&
+ while (written_len < len and
(wlen = write(out.fd,
buf.data() + written_len, // NOLINT
len - written_len)) > 0) {
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index 24d3997e..b4268111 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -611,7 +611,7 @@ class GraphTraverser {
msg_dbg += fmt::format("\n {}: {}", path, id);
}
- if (not clargs_.build.show_runfiles and !runfiles.empty()) {
+ if (not clargs_.build.show_runfiles and not runfiles.empty()) {
message += fmt::format("\n({} runfiles omitted.)", runfiles.size());
}
diff --git a/src/buildtool/main/build_utils.cpp b/src/buildtool/main/build_utils.cpp
index ab03ec08..97b9e1b7 100644
--- a/src/buildtool/main/build_utils.cpp
+++ b/src/buildtool/main/build_utils.cpp
@@ -152,7 +152,7 @@ void WriteTargetCacheEntries(
if (strategy == TargetCacheWriteStrategy::Disable) {
return;
}
- if (!cache_targets.empty()) {
+ if (not cache_targets.empty()) {
Logger::Log(logger,
LogLevel::Info,
"Backing up artifacts of {} export targets",
diff --git a/src/buildtool/main/describe.cpp b/src/buildtool/main/describe.cpp
index e3ab1223..c706545b 100644
--- a/src/buildtool/main/describe.cpp
+++ b/src/buildtool/main/describe.cpp
@@ -292,7 +292,7 @@ auto DescribeTarget(BuildMaps::Target::ConfiguredTarget const& id,
auto const& repo_name = id.target.ToModule().repository;
auto target_root_id =
repo_config->TargetRoot(repo_name)->GetAbsentTreeId();
- if (!target_root_id) {
+ if (not target_root_id) {
Logger::Log(
LogLevel::Error,
"Failed to get the target root id for repository \"{}\"",
@@ -313,8 +313,8 @@ auto DescribeTarget(BuildMaps::Target::ConfiguredTarget const& id,
}
auto const& desc_info =
Artifact::ObjectInfo{.digest = *dgst, .type = ObjectType::File};
- if (!apis.local->IsAvailable(*dgst)) {
- if (!apis.remote->RetrieveToCas({desc_info}, *apis.local)) {
+ if (not apis.local->IsAvailable(*dgst)) {
+ if (not apis.remote->RetrieveToCas({desc_info}, *apis.local)) {
Logger::Log(LogLevel::Error,
"Failed to retrieve blob {} from remote CAS",
desc_info.ToString());
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index d62edf9f..1cf9901b 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -599,7 +599,7 @@ auto DetermineRoots(gsl::not_null<RepositoryConfig*> const& repository_config,
}
}
- if (is_main_repo && keyword_carg) {
+ if (is_main_repo and keyword_carg) {
*keyword_root = FileRoot{*keyword_carg};
}
};
@@ -645,7 +645,7 @@ auto DetermineRoots(gsl::not_null<RepositoryConfig*> const& repository_config,
*keyword_file_name = *it;
}
- if (is_main_repo && keyword_carg) {
+ if (is_main_repo and keyword_carg) {
*keyword_file_name = *keyword_carg;
}
};
diff --git a/src/buildtool/main/serve.cpp b/src/buildtool/main/serve.cpp
index 87f1c9ac..622df15e 100644
--- a/src/buildtool/main/serve.cpp
+++ b/src/buildtool/main/serve.cpp
@@ -60,7 +60,7 @@ namespace {
gsl::not_null<RetryArguments*> const& rargs) noexcept -> bool {
auto max_attempts = config["max-attempts"];
if (max_attempts.IsNotNull()) {
- if (!max_attempts->IsNumber()) {
+ if (not max_attempts->IsNumber()) {
Logger::Log(
LogLevel::Error,
"Invalid value for \"max-attempts\" {}. It must be a number.",
@@ -71,7 +71,7 @@ namespace {
}
auto initial_backoff = config["initial-backoff-seconds"];
if (initial_backoff.IsNotNull()) {
- if (!initial_backoff->IsNumber()) {
+ if (not initial_backoff->IsNumber()) {
Logger::Log(LogLevel::Error,
"Invalid value \"initial-backoff-seconds\" {}. It must "
"be a number.",
@@ -83,7 +83,7 @@ namespace {
}
auto max_backoff = config["max-backoff-seconds"];
if (max_backoff.IsNotNull()) {
- if (!max_backoff->IsNumber()) {
+ if (not max_backoff->IsNumber()) {
Logger::Log(LogLevel::Error,
"Invalid value for \"max-backoff-seconds\" {}. It must "
"be a number.",
@@ -407,7 +407,7 @@ void ReadJustServeConfig(gsl::not_null<CommandLineArguments*> const& clargs) {
}
clargs->endpoint.remote_execution_address = address->String();
}
- if (!ParseRetryCliOptions(serve_config, &clargs->retry)) {
+ if (not ParseRetryCliOptions(serve_config, &clargs->retry)) {
std::exit(kExitFailure);
}
}
diff --git a/src/buildtool/multithreading/notification_queue.hpp b/src/buildtool/multithreading/notification_queue.hpp
index a9f476c2..f1c803e9 100644
--- a/src/buildtool/multithreading/notification_queue.hpp
+++ b/src/buildtool/multithreading/notification_queue.hpp
@@ -92,7 +92,7 @@ class NotificationQueue {
[[nodiscard]] auto pop() -> std::optional<Task> {
std::unique_lock lock{mutex_};
auto there_is_something_to_pop_or_we_are_done = [&]() {
- return !queue_.empty() || done_;
+ return not queue_.empty() or done_;
};
if (not there_is_something_to_pop_or_we_are_done()) {
total_workload_->Decrement();
@@ -113,7 +113,7 @@ class NotificationQueue {
// otherwise pops the front element of the queue and returns it
[[nodiscard]] auto try_pop() -> std::optional<Task> {
std::unique_lock lock{mutex_, std::try_to_lock};
- if (!lock || queue_.empty()) {
+ if (not lock or queue_.empty()) {
return std::nullopt;
}
auto t = std::move(queue_.front());
@@ -140,7 +140,7 @@ class NotificationQueue {
[[nodiscard]] auto try_push(FunctionType&& f) -> bool {
{
std::unique_lock lock{mutex_, std::try_to_lock};
- if (!lock) {
+ if (not lock) {
return false;
}
total_workload_->Increment();
diff --git a/src/buildtool/progress_reporting/exports_progress_reporter.cpp b/src/buildtool/progress_reporting/exports_progress_reporter.cpp
index 30ca8935..7b48eee6 100644
--- a/src/buildtool/progress_reporting/exports_progress_reporter.cpp
+++ b/src/buildtool/progress_reporting/exports_progress_reporter.cpp
@@ -45,7 +45,7 @@ auto ExportsProgressReporter::Reporter(gsl::not_null<Statistics*> const& stats,
has_serve ? fmt::format(", {} served", served) : "",
uncached + not_eligible);
- if ((active > 0) && !sample.empty()) {
+ if ((active > 0) and not sample.empty()) {
msg = fmt::format(
"{} ({}{})", msg, sample, active > 1 ? ", ..." : "");
}
diff --git a/src/buildtool/progress_reporting/progress_reporter.cpp b/src/buildtool/progress_reporting/progress_reporter.cpp
index 94280fe0..3dd76b1e 100644
--- a/src/buildtool/progress_reporting/progress_reporter.cpp
+++ b/src/buildtool/progress_reporting/progress_reporter.cpp
@@ -32,10 +32,10 @@ auto ProgressReporter::Reporter(gsl::not_null<Statistics*> const& stats,
int queued = stats->ActionsQueuedCounter();
int active = queued - run - cached;
std::string now_msg;
- if (active > 0 and !sample.empty()) {
+ if (active > 0 and not sample.empty()) {
auto const& origin_map = progress->OriginMap();
auto origins = origin_map.find(sample);
- if (origins != origin_map.end() and !origins->second.empty()) {
+ if (origins != origin_map.end() and not origins->second.empty()) {
auto const& origin = origins->second[0];
now_msg = fmt::format(" ({}#{}{})",
origin.first.target.ToString(),
diff --git a/src/buildtool/serve_api/remote/configuration_client.cpp b/src/buildtool/serve_api/remote/configuration_client.cpp
index fdc9952b..90645538 100644
--- a/src/buildtool/serve_api/remote/configuration_client.cpp
+++ b/src/buildtool/serve_api/remote/configuration_client.cpp
@@ -36,7 +36,7 @@ ConfigurationClient::ConfigurationClient(
auto ConfigurationClient::CheckServeRemoteExecution() const noexcept -> bool {
auto const client_remote_address = remote_config_.remote_address;
- if (!client_remote_address) {
+ if (not client_remote_address) {
logger_.Emit(LogLevel::Error,
"Internal error: the remote execution endpoint should "
"have been set.");
diff --git a/src/buildtool/serve_api/remote/target_client.cpp b/src/buildtool/serve_api/remote/target_client.cpp
index 0cb47ffd..4d11fe84 100644
--- a/src/buildtool/serve_api/remote/target_client.cpp
+++ b/src/buildtool/serve_api/remote/target_client.cpp
@@ -41,14 +41,14 @@ auto TargetClient::ServeTarget(const TargetCacheKey& key,
const std::string& repo_key) const noexcept
-> std::optional<serve_target_result_t> {
// make sure the blob containing the key is in the remote cas
- if (!apis_.local->RetrieveToCas({key.Id()}, *apis_.remote)) {
+ if (not apis_.local->RetrieveToCas({key.Id()}, *apis_.remote)) {
return serve_target_result_t{
std::in_place_index<1>,
fmt::format("Failed to retrieve to remote cas ObjectInfo {}",
key.Id().ToString())};
}
// make sure the repository configuration blob is in the remote cas
- if (!apis_.local->RetrieveToCas(
+ if (not apis_.local->RetrieveToCas(
{Artifact::ObjectInfo{.digest = ArtifactDigest{repo_key, 0, false},
.type = ObjectType::File}},
*apis_.remote)) {
@@ -95,7 +95,7 @@ auto TargetClient::ServeTarget(const TargetCacheKey& key,
}
auto const& dispatch_info = Artifact::ObjectInfo{
.digest = ArtifactDigest{*dispatch_dgst}, .type = ObjectType::File};
- if (!apis_.local->RetrieveToCas({dispatch_info}, *apis_.remote)) {
+ if (not apis_.local->RetrieveToCas({dispatch_info}, *apis_.remote)) {
return serve_target_result_t{
std::in_place_index<1>,
fmt::format("Failed to upload blob {} to remote cas",
@@ -127,8 +127,8 @@ auto TargetClient::ServeTarget(const TargetCacheKey& key,
ArtifactDigest{response.target_value()};
auto const& obj_info = Artifact::ObjectInfo{
.digest = target_value_dgst, .type = ObjectType::File};
- if (!apis_.local->IsAvailable(target_value_dgst)) {
- if (!apis_.remote->RetrieveToCas({obj_info}, *apis_.local)) {
+ if (not apis_.local->IsAvailable(target_value_dgst)) {
+ if (not apis_.remote->RetrieveToCas({obj_info}, *apis_.local)) {
return serve_target_result_t{
std::in_place_index<1>,
fmt::format(
@@ -138,7 +138,7 @@ auto TargetClient::ServeTarget(const TargetCacheKey& key,
}
auto const& target_value_str =
apis_.local->RetrieveToMemory(obj_info);
- if (!target_value_str) {
+ if (not target_value_str) {
return serve_target_result_t{
std::in_place_index<1>,
fmt::format("Failed to retrieve blob {} from local cas",
diff --git a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp
index 6c7b4843..3edf04e0 100644
--- a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp
+++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp
@@ -48,7 +48,7 @@ namespace {
template <typename T>
auto TryWrite(std::string const& file, T const& content) noexcept -> bool {
std::ofstream of{file};
- if (!of.good()) {
+ if (not of.good()) {
Logger::Log(LogLevel::Error,
"Could not open {}. Make sure to have write permissions",
file);
@@ -167,7 +167,7 @@ auto ServeServerImpl::Run(
fmt::format("{}:{}", interface_, port_), creds, &port_);
auto server = builder.BuildAndStart();
- if (!server) {
+ if (not server) {
Logger::Log(LogLevel::Error, "Could not start serve service");
return false;
}
@@ -177,8 +177,8 @@ auto ServeServerImpl::Run(
nlohmann::json const& info = {
{"interface", interface_}, {"port", port_}, {"pid", pid}};
- if (!pid_file_.empty()) {
- if (!TryWrite(pid_file_, pid)) {
+ if (not pid_file_.empty()) {
+ if (not TryWrite(pid_file_, pid)) {
server->Shutdown();
return false;
}
@@ -192,8 +192,8 @@ auto ServeServerImpl::Run(
with_execute ? "s" : "",
info_str));
- if (!info_file_.empty()) {
- if (!TryWrite(info_file_, info_str)) {
+ if (not info_file_.empty()) {
+ if (not TryWrite(info_file_, info_str)) {
server->Shutdown();
return false;
}
diff --git a/src/buildtool/serve_api/serve_service/source_tree.cpp b/src/buildtool/serve_api/serve_service/source_tree.cpp
index 511acfd3..0b86a9a4 100644
--- a/src/buildtool/serve_api/serve_service/source_tree.cpp
+++ b/src/buildtool/serve_api/serve_service/source_tree.cpp
@@ -200,7 +200,7 @@ auto SourceTreeService::ServeCommitTree(
const ::justbuild::just_serve::ServeCommitTreeRequest* request,
ServeCommitTreeResponse* response) -> ::grpc::Status {
auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config_);
- if (!repo_lock) {
+ if (not repo_lock) {
logger_->Emit(LogLevel::Error, "Could not acquire repo gc SharedLock");
response->set_status(ServeCommitTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -714,7 +714,7 @@ auto SourceTreeService::ServeArchiveTree(
const ::justbuild::just_serve::ServeArchiveTreeRequest* request,
ServeArchiveTreeResponse* response) -> ::grpc::Status {
auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config_);
- if (!repo_lock) {
+ if (not repo_lock) {
logger_->Emit(LogLevel::Error, "Could not acquire repo gc SharedLock");
response->set_status(ServeArchiveTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -790,7 +790,7 @@ auto SourceTreeService::ServeArchiveTree(
}
// acquire lock for CAS
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
logger_->Emit(LogLevel::Error, "Could not acquire gc SharedLock");
response->set_status(ServeArchiveTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -900,7 +900,7 @@ auto SourceTreeService::DistdirImportToGit(
bool sync_tree,
ServeDistdirTreeResponse* response) -> ::grpc::Status {
auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config_);
- if (!repo_lock) {
+ if (not repo_lock) {
logger_->Emit(LogLevel::Error, "Could not acquire repo gc SharedLock");
response->set_status(ServeDistdirTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -1006,7 +1006,7 @@ auto SourceTreeService::ServeDistdirTree(
ServeDistdirTreeResponse* response) -> ::grpc::Status {
// acquire lock for CAS
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
logger_->Emit(LogLevel::Error, "Could not acquire gc SharedLock");
response->set_status(ServeDistdirTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -1296,14 +1296,14 @@ auto SourceTreeService::ServeContent(
auto const& content{request->content()};
// acquire locks
auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config_);
- if (!repo_lock) {
+ if (not repo_lock) {
logger_->Emit(LogLevel::Error, "Could not acquire repo gc SharedLock");
response->set_status(ServeContentResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
}
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
logger_->Emit(LogLevel::Error, "Could not acquire gc SharedLock");
response->set_status(ServeContentResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -1412,14 +1412,14 @@ auto SourceTreeService::ServeTree(
auto const& tree_id{request->tree()};
// acquire locks
auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config_);
- if (!repo_lock) {
+ if (not repo_lock) {
logger_->Emit(LogLevel::Error, "Could not acquire repo gc SharedLock");
response->set_status(ServeTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
}
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
logger_->Emit(LogLevel::Error, "Could not acquire gc SharedLock");
response->set_status(ServeTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -1552,14 +1552,14 @@ auto SourceTreeService::CheckRootTree(
auto const& tree_id{request->tree()};
// acquire locks
auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config_);
- if (!repo_lock) {
+ if (not repo_lock) {
logger_->Emit(LogLevel::Error, "Could not acquire repo gc SharedLock");
response->set_status(CheckRootTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
}
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
logger_->Emit(LogLevel::Error, "Could not acquire gc SharedLock");
response->set_status(CheckRootTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
@@ -1660,7 +1660,7 @@ auto SourceTreeService::GetRemoteTree(
auto const& tree_id{request->tree()};
// acquire locks
auto lock = GarbageCollector::SharedLock(storage_config_);
- if (!lock) {
+ if (not lock) {
logger_->Emit(LogLevel::Error, "Could not acquire gc SharedLock");
response->set_status(GetRemoteTreeResponse::INTERNAL_ERROR);
return ::grpc::Status::OK;
diff --git a/src/buildtool/serve_api/serve_service/target.cpp b/src/buildtool/serve_api/serve_service/target.cpp
index a0289cc0..ea0c36c9 100644
--- a/src/buildtool/serve_api/serve_service/target.cpp
+++ b/src/buildtool/serve_api/serve_service/target.cpp
@@ -163,13 +163,13 @@ auto TargetService::ServeTarget(
// acquire locks
auto repo_lock =
RepositoryGarbageCollector::SharedLock(*local_context_.storage_config);
- if (!repo_lock) {
+ if (not repo_lock) {
auto msg = std::string("Could not acquire repo gc SharedLock");
logger_->Emit(LogLevel::Error, msg);
return ::grpc::Status{::grpc::StatusCode::INTERNAL, msg};
}
auto lock = GarbageCollector::SharedLock(*local_context_.storage_config);
- if (!lock) {
+ if (not lock) {
auto msg = std::string("Could not acquire CAS gc SharedLock");
logger_->Emit(LogLevel::Error, msg);
return ::grpc::Status{::grpc::StatusCode::INTERNAL, msg};
@@ -217,7 +217,7 @@ auto TargetService::ServeTarget(
// make sure all artifacts referenced in the target cache value are in
// the remote cas
std::vector<Artifact::ObjectInfo> artifacts;
- if (!target_entry->first.ToArtifacts(&artifacts)) {
+ if (not target_entry->first.ToArtifacts(&artifacts)) {
auto msg = fmt::format(
"Failed to extract artifacts from target cache entry {}",
target_entry->second.ToString());
@@ -291,7 +291,7 @@ auto TargetService::ServeTarget(
this,
&target_cache_key_digest,
&error_msg](std::string const& key) -> bool {
- if (!target_description_dict->At(key)) {
+ if (not target_description_dict->At(key)) {
error_msg =
fmt::format("TargetCacheKey {} does not contain key \"{}\"",
target_cache_key_digest.hash(),
@@ -302,8 +302,8 @@ auto TargetService::ServeTarget(
return true;
};
- if (!check_key("repo_key") or !check_key("target_name") or
- !check_key("effective_config")) {
+ if (not check_key("repo_key") or not check_key("target_name") or
+ not check_key("effective_config")) {
return ::grpc::Status{::grpc::StatusCode::NOT_FOUND, error_msg};
}
@@ -433,7 +433,7 @@ auto TargetService::ServeTarget(
// setup logging for analysis and build; write into a temporary file
auto tmp_dir =
local_context_.storage_config->CreateTypedTmpDir("serve-target");
- if (!tmp_dir) {
+ if (not tmp_dir) {
auto msg = std::string("Could not create TmpDir");
logger_->Emit(LogLevel::Error, msg);
return ::grpc::Status{::grpc::StatusCode::INTERNAL, msg};
@@ -557,7 +557,7 @@ auto TargetService::ServeTarget(
// make sure all artifacts referenced in the target cache value are in
// the remote cas
std::vector<Artifact::ObjectInfo> tc_artifacts;
- if (!target_entry->first.ToArtifacts(&tc_artifacts)) {
+ if (not target_entry->first.ToArtifacts(&tc_artifacts)) {
auto msg = fmt::format(
"Failed to extract artifacts from target cache entry {}",
target_entry->second.ToString());
@@ -755,7 +755,7 @@ auto TargetService::ServeTargetDescription(
// Get repository lock before inspecting the root git cache
auto repo_lock =
RepositoryGarbageCollector::SharedLock(*local_context_.storage_config);
- if (!repo_lock) {
+ if (not repo_lock) {
auto msg = std::string("Could not acquire repo gc SharedLock");
logger_->Emit(LogLevel::Error, msg);
return ::grpc::Status{::grpc::StatusCode::INTERNAL, msg};
@@ -895,7 +895,7 @@ auto TargetService::ServeTargetDescription(
// acquire lock for CAS
auto lock = GarbageCollector::SharedLock(*local_context_.storage_config);
- if (!lock) {
+ if (not lock) {
auto error_msg = fmt::format("Could not acquire gc SharedLock");
logger_->Emit(LogLevel::Error, error_msg);
return ::grpc::Status{::grpc::StatusCode::INTERNAL, error_msg};
diff --git a/src/buildtool/storage/file_chunker.cpp b/src/buildtool/storage/file_chunker.cpp
index b94f487a..08f0dc11 100644
--- a/src/buildtool/storage/file_chunker.cpp
+++ b/src/buildtool/storage/file_chunker.cpp
@@ -45,7 +45,7 @@ auto FileChunker::IsOpen() const noexcept -> bool {
}
auto FileChunker::Finished() const noexcept -> bool {
- return stream_.eof() && pos_ == size_;
+ return stream_.eof() and pos_ == size_;
}
auto FileChunker::NextChunk() noexcept -> std::optional<std::string> {
diff --git a/src/other_tools/git_operations/git_ops_types.hpp b/src/other_tools/git_operations/git_ops_types.hpp
index c30d5819..7c4b03a5 100644
--- a/src/other_tools/git_operations/git_ops_types.hpp
+++ b/src/other_tools/git_operations/git_ops_types.hpp
@@ -46,8 +46,8 @@ struct GitOpParams {
[[nodiscard]] auto operator==(GitOpParams const& other) const noexcept
-> bool {
// not all fields are keys
- return target_path == other.target_path && git_hash == other.git_hash &&
- branch == other.branch;
+ return target_path == other.target_path and
+ git_hash == other.git_hash and branch == other.branch;
}
};
diff --git a/src/other_tools/git_operations/git_repo_remote.cpp b/src/other_tools/git_operations/git_repo_remote.cpp
index 00114b50..810df860 100644
--- a/src/other_tools/git_operations/git_repo_remote.cpp
+++ b/src/other_tools/git_operations/git_repo_remote.cpp
@@ -490,7 +490,7 @@ auto GitRepoRemote::UpdateCommitViaTmpRepo(
err_str = *cmd_err;
}
std::string output{};
- if (!out_str.empty() || !err_str.empty()) {
+ if (not out_str.empty() or not err_str.empty()) {
output = fmt::format(" with output:\n{}{}", out_str, err_str);
}
(*logger)(fmt::format("List remote commits command {} failed{}",
@@ -644,7 +644,7 @@ auto GitRepoRemote::FetchViaTmpRepo(StorageConfig const& storage_config,
err_str = *cmd_err;
}
std::string output{};
- if (!out_str.empty() || !err_str.empty()) {
+ if (not out_str.empty() or not err_str.empty()) {
output = fmt::format(" with output:\n{}{}", out_str, err_str);
}
(*logger)(fmt::format("Fetch command {} failed{}",
diff --git a/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp b/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp
index b768a2f5..c0e5c78f 100644
--- a/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp
+++ b/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp
@@ -34,7 +34,7 @@ auto JustMRProgressReporter::Reporter(
auto const sample = progress->TaskTracker().Sample();
auto msg =
fmt::format("{} local, {} cached, {} done", local, cached, run);
- if ((active > 0) && !sample.empty()) {
+ if ((active > 0) and not sample.empty()) {
msg = fmt::format("{}; {} fetches ({}{})",
msg,
active,
diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.cpp b/src/other_tools/ops_maps/git_tree_fetch_map.cpp
index 9206486e..550dab7e 100644
--- a/src/other_tools/ops_maps/git_tree_fetch_map.cpp
+++ b/src/other_tools/ops_maps/git_tree_fetch_map.cpp
@@ -528,7 +528,7 @@ auto CreateGitTreeFetchMap(
err_str = *cmd_err;
}
std::string output{};
- if (!out_str.empty() || !err_str.empty()) {
+ if (not out_str.empty() or not err_str.empty()) {
output =
fmt::format(".\nOutput of command:\n{}{}",
out_str,
diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp
index 65efbcbf..853bf549 100644
--- a/src/other_tools/repo_map/repos_to_setup_map.cpp
+++ b/src/other_tools/repo_map/repos_to_setup_map.cpp
@@ -805,7 +805,7 @@ auto CreateReposToSetupMap(
auto /* unused */,
auto const& key) {
auto repos = (*config)["repositories"];
- if (main && (key == *main) && interactive) {
+ if (main and (key == *main) and interactive) {
// no repository checkout required
nlohmann::json cfg({});
SetReposTakeOver(&cfg, repos, key);
diff --git a/src/utils/cpp/type_safe_arithmetic.hpp b/src/utils/cpp/type_safe_arithmetic.hpp
index 090c266b..373f76fc 100644
--- a/src/utils/cpp/type_safe_arithmetic.hpp
+++ b/src/utils/cpp/type_safe_arithmetic.hpp
@@ -87,7 +87,7 @@ class type_safe_arithmetic {
constexpr auto get() const -> value_t { return m_value; }
constexpr void set(value_t value) {
- Expects(value >= min_value && value <= max_value &&
+ Expects(value >= min_value and value <= max_value and
"value output of range");
m_value = value;
}
diff --git a/src/utils/cpp/verify_hash.hpp b/src/utils/cpp/verify_hash.hpp
index e827680d..f105eb2b 100644
--- a/src/utils/cpp/verify_hash.hpp
+++ b/src/utils/cpp/verify_hash.hpp
@@ -27,7 +27,7 @@
/// \returns Nullopt on success, error message on failure.
[[nodiscard]] static inline auto IsAHash(std::string const& s) noexcept
-> std::optional<std::string> {
- if (!std::all_of(s.begin(), s.end(), [](unsigned char c) {
+ if (not std::all_of(s.begin(), s.end(), [](unsigned char c) {
return std::isxdigit(c);
})) {
return fmt::format("Invalid hash {}", s);
diff --git a/test/buildtool/build_engine/base_maps/directory_map.test.cpp b/test/buildtool/build_engine/base_maps/directory_map.test.cpp
index eaeb806a..d001f50e 100644
--- a/test/buildtool/build_engine/base_maps/directory_map.test.cpp
+++ b/test/buildtool/build_engine/base_maps/directory_map.test.cpp
@@ -68,7 +68,7 @@ TEST_CASE("simple usage") {
bool as_expected{false};
auto name = ModuleName{"", "."};
auto consumer = [&as_expected](auto values) {
- if (values[0]->ContainsBlob("file") &&
+ if (values[0]->ContainsBlob("file") and
not values[0]->ContainsBlob("does_not_exist")) {
as_expected = true;
};
diff --git a/test/buildtool/build_engine/base_maps/json_file_map.test.cpp b/test/buildtool/build_engine/base_maps/json_file_map.test.cpp
index 19814231..91e74877 100644
--- a/test/buildtool/build_engine/base_maps/json_file_map.test.cpp
+++ b/test/buildtool/build_engine/base_maps/json_file_map.test.cpp
@@ -100,7 +100,7 @@ TEST_CASE("non existent") {
auto consumer = [&as_expected](auto values) {
// Missing optional files are expected to result in empty objects with
// no entries in it.
- if (values[0]->is_object() && values[0]->empty()) {
+ if (values[0]->is_object() and values[0]->empty()) {
as_expected = true;
};
};
diff --git a/test/buildtool/build_engine/target_map/target_map.test.cpp b/test/buildtool/build_engine/target_map/target_map.test.cpp
index ae376b14..061ce387 100644
--- a/test/buildtool/build_engine/target_map/target_map.test.cpp
+++ b/test/buildtool/build_engine/target_map/target_map.test.cpp
@@ -175,7 +175,7 @@ TEST_CASE("simple targets", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
auto artifacts = result->Artifacts();
ExpressionPtr artifact = artifacts->Get("c/d/foo", none_t{});
@@ -201,7 +201,7 @@ TEST_CASE("simple targets", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
auto artifacts = result->Artifacts();
ExpressionPtr artifact = artifacts->Get("c/d/link", none_t{});
@@ -799,7 +799,7 @@ TEST_CASE("generator functions in string arguments", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->ToJson()["index.txt"]["type"] == "KNOWN");
CHECK(result->Blobs()[0] == "bar.txt;baz.txt;foo.txt;link");
@@ -823,7 +823,7 @@ TEST_CASE("generator functions in string arguments", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->ToJson()["index.txt"]["type"] == "KNOWN");
CHECK(result->Blobs()[0] == "bar.txt;baz.txt;foo.txt;link");
@@ -920,7 +920,7 @@ TEST_CASE("built-in rules", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->Map().size() == 1);
CHECK(result->Artifacts()->ToJson()["out"]["type"] == "ACTION");
@@ -945,7 +945,7 @@ TEST_CASE("built-in rules", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts() == result->RunFiles());
auto stage = result->Artifacts()->ToJson();
@@ -991,7 +991,7 @@ TEST_CASE("built-in rules", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->ToJson()["generated.txt"]["type"] ==
"KNOWN");
@@ -1017,7 +1017,7 @@ TEST_CASE("built-in rules", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->ToJson()["generated_link"]["type"] ==
"KNOWN");
@@ -1051,7 +1051,7 @@ TEST_CASE("built-in rules", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(bar_result->Artifacts()->ToJson()["foo.txt."]["type"] == "KNOWN");
CHECK(
@@ -1155,7 +1155,7 @@ TEST_CASE("target reference", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->ToJson()["hello.txt"]["type"] == "ACTION");
CHECK(result->Artifacts()->ToJson()["hello.txt"]["data"]["path"] ==
@@ -1187,7 +1187,7 @@ TEST_CASE("target reference", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->ToJson()["link"]["type"] == "ACTION");
CHECK(result->Artifacts()->ToJson()["link"]["data"]["path"] == "link");
@@ -1218,7 +1218,7 @@ TEST_CASE("target reference", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Artifacts()->ToJson()["absolute"]["data"]["path"] ==
"x/x/foo");
@@ -1319,7 +1319,7 @@ TEST_CASE("trees", "[target_map]") {
error_msg = msg;
});
}
- CHECK(!error);
+ CHECK(not error);
CHECK(error_msg == "NONE");
CHECK(result->Actions().size() == 1);
CHECK(result->Actions()[0]->ToJson()["input"]["tree"]["type"] ==
diff --git a/test/buildtool/build_engine/target_map/target_map_internals.test.cpp b/test/buildtool/build_engine/target_map/target_map_internals.test.cpp
index c562b8fd..7db66c7c 100644
--- a/test/buildtool/build_engine/target_map/target_map_internals.test.cpp
+++ b/test/buildtool/build_engine/target_map/target_map_internals.test.cpp
@@ -55,11 +55,11 @@ TEST_CASE("No conflict", "[tree_conflict]") {
REQUIRE(no_overlap);
auto no_overlap_conflict =
BuildMaps::Target::Utils::tree_conflict(no_overlap);
- CHECK(!no_overlap_conflict);
+ CHECK(not no_overlap_conflict);
auto single_root = Expression::FromJson(R"({ ".": "content-1"})"_json);
REQUIRE(single_root);
auto single_root_conflict =
BuildMaps::Target::Utils::tree_conflict(single_root);
- CHECK(!single_root_conflict);
+ CHECK(not single_root_conflict);
}
diff --git a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
index 103c7be3..3aae8db2 100644
--- a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
@@ -61,7 +61,7 @@ TEST_CASE("Bazel internals: CAS Client", "[execution_api]") {
auto digests = cas_client.FindMissingBlobs(instance_name, {digest});
CHECK(digests.size() <= 1);
- if (!digests.empty()) {
+ if (not digests.empty()) {
// Upload blob, if not found
std::vector<gsl::not_null<BazelBlob const*>> to_upload{&blob};
CHECK(cas_client.BatchUpdateBlobs(
diff --git a/test/buildtool/execution_engine/traverser/traverser.test.cpp b/test/buildtool/execution_engine/traverser/traverser.test.cpp
index c500a0d2..fcdc5ef7 100644
--- a/test/buildtool/execution_engine/traverser/traverser.test.cpp
+++ b/test/buildtool/execution_engine/traverser/traverser.test.cpp
@@ -174,12 +174,12 @@ class TestProject {
action_id, std::filesystem::path{output})
.Id();
auto [_, is_inserted] = artifacts_to_be_built_.insert(out_id);
- if (!is_inserted) {
+ if (not is_inserted) {
return false;
}
}
auto inputs_desc = ActionDescription::inputs_t{};
- if (!inputs.empty()) {
+ if (not inputs.empty()) {
command.emplace_back("FROM");
for (auto const& input_desc : inputs) {
auto artifact = ArtifactDescription::FromJson(input_desc);
diff --git a/test/buildtool/logging/log_sink_file.test.cpp b/test/buildtool/logging/log_sink_file.test.cpp
index 069480be..2dde74b8 100644
--- a/test/buildtool/logging/log_sink_file.test.cpp
+++ b/test/buildtool/logging/log_sink_file.test.cpp
@@ -114,7 +114,7 @@ TEST_CASE("LogSinkFile", "[logging]") {
for (auto const& line : lines) {
CHECK_THAT(
line,
- Catch::Matchers::ContainsSubstring("somecontent") ||
+ Catch::Matchers::ContainsSubstring("somecontent") or
Catch::Matchers::ContainsSubstring("this is thread"));
}
}
diff --git a/test/buildtool/multithreading/async_map_consumer.test.cpp b/test/buildtool/multithreading/async_map_consumer.test.cpp
index a2de18b7..f65c7851 100644
--- a/test/buildtool/multithreading/async_map_consumer.test.cpp
+++ b/test/buildtool/multithreading/async_map_consumer.test.cpp
@@ -237,7 +237,7 @@ TEST_CASE("ErrorPropagation", "[async_map_consumer]") {
[&fail_cont_counter]() { fail_cont_counter++; });
}
CHECK(execution_failed);
- CHECK(!consumer_called);
+ CHECK(not consumer_called);
CHECK(fail_cont_counter == 1);
}
diff --git a/test/buildtool/multithreading/task.test.cpp b/test/buildtool/multithreading/task.test.cpp
index fab83547..772b3e83 100644
--- a/test/buildtool/multithreading/task.test.cpp
+++ b/test/buildtool/multithreading/task.test.cpp
@@ -47,18 +47,18 @@ struct RefCaptureCallable {
TEST_CASE("Default constructed task is empty", "[task]") {
Task t;
- CHECK(!t);
- CHECK(!(Task()));
- CHECK(!(Task{}));
+ CHECK(not t);
+ CHECK(not(Task()));
+ CHECK(not(Task{}));
}
TEST_CASE("Task constructed from empty function is empty", "[task]") {
std::function<void()> empty_function;
Task t_from_empty_function{empty_function};
- CHECK(!Task(std::function<void()>{}));
- CHECK(!Task(empty_function));
- CHECK(!t_from_empty_function);
+ CHECK(not Task(std::function<void()>{}));
+ CHECK(not Task(empty_function));
+ CHECK(not t_from_empty_function);
}
TEST_CASE("Task constructed from user defined callable object is not empty",
diff --git a/test/utils/large_objects/large_object_utils.cpp b/test/utils/large_objects/large_object_utils.cpp
index de8e6c7d..a30a9276 100644
--- a/test/utils/large_objects/large_object_utils.cpp
+++ b/test/utils/large_objects/large_object_utils.cpp
@@ -95,7 +95,7 @@ auto LargeObjectUtils::GenerateFile(std::filesystem::path const& path,
try {
std::ofstream stream(path);
- for (std::size_t i = 0; i < step_count && stream.good(); ++i) {
+ for (std::size_t i = 0; i < step_count and stream.good(); ++i) {
const std::size_t index = (pool_index + i * pool_shift) % kPoolSize;
if (i != step_count - 1) {
stream << Pool::Instance()[index];