Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -100,15 +100,15 @@ mbgl::filesystem::path getValidPath(const std::string& manifestPath, const std::
} // namespace
std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifestPath,
std::string testFilter) {
std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifestPath, std::string testFilter) {
Manifest manifest;
const auto filePath = mbgl::filesystem::path(manifestPath);
manifest.manifestPath = manifestPath.substr(0, manifestPath.find(filePath.filename()));
auto contents = readJson(filePath);
if (!contents.is<mbgl::JSDocument>()) {
mbgl::Log::Error(mbgl::Event::General, "Provided manifest file: " + std::string(filePath) + " is not a valid json");
mbgl::Log::Error(mbgl::Event::General,
"Provided manifest file: " + std::string(filePath) + " is not a valid json");
return std::nullopt;
}
@@ -116,8 +116,8 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
if (document.HasMember("result_path")) {
const auto& resultPathValue = document["result_path"];
if (!resultPathValue.IsString()) {
mbgl::Log::Warning(
mbgl::Event::General, "Invalid result_path is provided inside the manifest file: " + std::string(filePath));
mbgl::Log::Warning(mbgl::Event::General,
"Invalid result_path is provided inside the manifest file: " + std::string(filePath));
return std::nullopt;
}
manifest.resultPath = (getValidPath(manifest.manifestPath, resultPathValue.GetString()) / "").string();
@@ -128,8 +128,8 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
if (document.HasMember("cache_path")) {
const auto& cachePathValue = document["cache_path"];
if (!cachePathValue.IsString()) {
mbgl::Log::Warning(
mbgl::Event::General, "Invalid cache_path is provided inside the manifest file: " + std::string(filePath));
mbgl::Log::Warning(mbgl::Event::General,
"Invalid cache_path is provided inside the manifest file: " + std::string(filePath));
return std::nullopt;
}
manifest.cachePath = (getValidPath(manifest.manifestPath, ".") / cachePathValue.GetString()).string();
@@ -137,7 +137,7 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
return std::nullopt;
}
}
//TODO:PP
// TODO:PP
if (document.HasMember("access_token")) {
const auto& apiKeyValue = document["access_token"];
if (!apiKeyValue.IsString()) {
@@ -155,7 +155,9 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
const auto& testPathValue = document["base_test_path"];
if (!testPathValue.IsString()) {
mbgl::Log::Warning(mbgl::Event::General,
"Invalid base_test_path is provided inside the manifest file: " + std::string(filePath));
"Invalid base_test_path is provided inside the manifest "
"file: " +
std::string(filePath));
return std::nullopt;
}
baseTestPath = getValidPath(manifest.manifestPath, testPathValue.GetString());
@@ -167,8 +169,8 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
if (document.HasMember("metric_path")) {
const auto& metricPathValue = document["metric_path"];
if (!metricPathValue.IsString()) {
mbgl::Log::Warning(
mbgl::Event::General, "Invalid metric_path is provided inside the manifest file: " + std::string(filePath));
mbgl::Log::Warning(mbgl::Event::General,
"Invalid metric_path is provided inside the manifest file: " + std::string(filePath));
return std::nullopt;
}
expectedMetricPath = getValidPath(manifest.manifestPath, metricPathValue.GetString());
@@ -181,13 +183,17 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
const auto& expectationPathValue = document["expectation_paths"];
if (!expectationPathValue.IsArray()) {
mbgl::Log::Warning(mbgl::Event::General,
"Provided expectation_paths inside the manifest file: %s is not a valid array" + std::string(filePath));
"Provided expectation_paths inside the manifest file: %s is "
"not a valid array" +
std::string(filePath));
return std::nullopt;
}
for (const auto& value : expectationPathValue.GetArray()) {
if (!value.IsString()) {
mbgl::Log::Warning(mbgl::Event::General,
"Invalid expectation path item is provided inside the manifest file: " + std::string(filePath));
"Invalid expectation path item is provided inside the "
"manifest file: " +
std::string(filePath));
return std::nullopt;
}
expectationPaths.emplace_back(getValidPath(manifest.manifestPath, value.GetString()));
@@ -200,14 +206,17 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
if (document.HasMember("ignore_paths")) {
const auto& ignorePathValue = document["ignore_paths"];
if (!ignorePathValue.IsArray()) {
mbgl::Log::Warning(mbgl::Event::General,
"Provided ignore_paths inside the manifest file: " + std::string(filePath) + " is not a valid array");
mbgl::Log::Warning(
mbgl::Event::General,
"Provided ignore_paths inside the manifest file: " + std::string(filePath) + " is not a valid array");
return std::nullopt;
}
for (const auto& value : ignorePathValue.GetArray()) {
if (!value.IsString()) {
mbgl::Log::Warning(mbgl::Event::General,
"Invalid ignore path item is provided inside the manifest file: " + std::string(filePath));
"Invalid ignore path item is provided inside the manifest "
"file: " +
std::string(filePath));
return std::nullopt;
}
ignorePaths.emplace_back(getValidPath(manifest.manifestPath, value.GetString()));
@@ -221,15 +230,17 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
if (document.HasMember("probes")) {
const auto& probesValue = document["probes"];
if (!probesValue.IsArray()) {
mbgl::Log::Warning(mbgl::Event::General,
"Provided probes inside the manifest file: " + std::string(filePath) + "is not a valid array");
mbgl::Log::Warning(
mbgl::Event::General,
"Provided probes inside the manifest file: " + std::string(filePath) + "is not a valid array");
return std::nullopt;
}
for (const auto& value : probesValue.GetArray()) {
if (!value.IsString()) {
mbgl::Log::Warning(mbgl::Event::General,
"Invalid probe type is provided inside the manifest file: " +
std::string(filePath));
"Invalid probe type is provided inside the manifest "
"file: " +
std::string(filePath));
return std::nullopt;
}
manifest.probes.emplace(value.GetString());
@@ -239,8 +250,8 @@ std::optional<Manifest> ManifestParser::parseManifest(const std::string& manifes
if (testFilter.empty() && document.HasMember("filter")) {
const auto& filterValue = document["filter"];
if (!filterValue.IsString()) {
mbgl::Log::Warning(
mbgl::Event::General, "Invalid filter is provided inside the manifest file: " + std::string(filePath));
mbgl::Log::Warning(mbgl::Event::General,
"Invalid filter is provided inside the manifest file: " + std::string(filePath));
return std::nullopt;
}