chore: No ALL_CAPS (#1760)

Fixes #1680
This commit is contained in:
Alex Kremer
2025-01-02 11:39:31 +00:00
committed by GitHub
parent efe5d08205
commit 820b32c6d7
361 changed files with 10061 additions and 9724 deletions

View File

@@ -52,7 +52,7 @@ PortConstraint::checkValueImpl(Value const& port) const
} else {
p = static_cast<uint32_t>(std::get<int64_t>(port));
}
if (p >= portMin && p <= portMax)
if (p >= kPORT_MIN && p <= kPORT_MAX)
return std::nullopt;
return Error{"Port does not satisfy the constraint bounds"};
}
@@ -71,14 +71,14 @@ ValidIPConstraint::checkValueImpl(Value const& ip) const
if (std::get<std::string>(ip) == "localhost")
return std::nullopt;
static std::regex const ipv4(
static std::regex const kIPV4(
R"(^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$)"
);
static std::regex const ip_url(
static std::regex const kIP_URL(
R"(^((http|https):\/\/)?((([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,6})|(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))(:\d{1,5})?(\/[^\s]*)?$)"
);
if (std::regex_match(std::get<std::string>(ip), ipv4) || std::regex_match(std::get<std::string>(ip), ip_url))
if (std::regex_match(std::get<std::string>(ip), kIPV4) || std::regex_match(std::get<std::string>(ip), kIP_URL))
return std::nullopt;
return Error{"Ip is not a valid ip address"};