summaryrefslogtreecommitdiff
path: root/src/mongo/util/options_parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util/options_parser')
-rw-r--r--src/mongo/util/options_parser/constraints.h7
-rw-r--r--src/mongo/util/options_parser/environment_test.cpp9
-rw-r--r--src/mongo/util/options_parser/option_section.cpp6
-rw-r--r--src/mongo/util/options_parser/options_parser.cpp27
-rw-r--r--src/mongo/util/options_parser/options_parser_test.cpp3
5 files changed, 21 insertions, 31 deletions
diff --git a/src/mongo/util/options_parser/constraints.h b/src/mongo/util/options_parser/constraints.h
index 796f7de8721..6be67a8f31c 100644
--- a/src/mongo/util/options_parser/constraints.h
+++ b/src/mongo/util/options_parser/constraints.h
@@ -131,10 +131,9 @@ private:
T typedVal;
if (!val.get(&typedVal).isOK()) {
return {ErrorCodes::InternalError,
- str::stream() << "Error: value for key: " << _key << " was found as type: "
- << val.typeToString()
- << " but is required to be type: "
- << typeid(typedVal).name()};
+ str::stream() << "Error: value for key: " << _key
+ << " was found as type: " << val.typeToString()
+ << " but is required to be type: " << typeid(typedVal).name()};
}
return _valueCallback(typedVal);
diff --git a/src/mongo/util/options_parser/environment_test.cpp b/src/mongo/util/options_parser/environment_test.cpp
index 9f0737e2ad6..6fbd3d70048 100644
--- a/src/mongo/util/options_parser/environment_test.cpp
+++ b/src/mongo/util/options_parser/environment_test.cpp
@@ -92,8 +92,7 @@ TEST(ToBSONTests, DottedValues) {
ASSERT_OK(environment.set(moe::Key("val1.dotted2"), moe::Value(std::string("string"))));
mongo::BSONObj obj = BSON("val1" << BSON("dotted1" << 6 << "dotted2"
<< "string")
- << "val2"
- << true);
+ << "val2" << true);
// TODO: Put a comparison here that doesn't depend on the field order. Right now it is
// based on the sort order of keys in a std::map.
ASSERT_BSONOBJ_EQ(obj, environment.toBSON());
@@ -108,12 +107,10 @@ TEST(ToBSONTests, DeepDottedValues) {
ASSERT_OK(environment.set(moe::Key("val2"), moe::Value(6.0)));
mongo::BSONObj obj =
BSON("val1" << BSON("first1" << BSON("second1" << BSON("third1" << 6 << "third2" << true)
- << "second2"
- << BSON("third1" << false))
+ << "second2" << BSON("third1" << false))
<< "first2"
<< "string")
- << "val2"
- << 6.0);
+ << "val2" << 6.0);
// TODO: Put a comparison here that doesn't depend on the field order. Right now it is
// based on the sort order of keys in a std::map.
ASSERT_BSONOBJ_EQ(obj, environment.toBSON());
diff --git a/src/mongo/util/options_parser/option_section.cpp b/src/mongo/util/options_parser/option_section.cpp
index e8f3c6f9927..d54922fb29c 100644
--- a/src/mongo/util/options_parser/option_section.cpp
+++ b/src/mongo/util/options_parser/option_section.cpp
@@ -157,8 +157,7 @@ OptionDescription& OptionSection::addOptionChaining(
// Should not be the same as dottedName.
uassert(ErrorCodes::InternalError,
str::stream() << "Attempted to register option with conflict between dottedName and "
- << "deprecatedDottedName: "
- << dottedName,
+ << "deprecatedDottedName: " << dottedName,
!std::count(deprecatedDottedNames.begin(), deprecatedDottedNames.end(), dottedName));
// Verify deprecated single names.
@@ -170,8 +169,7 @@ OptionDescription& OptionSection::addOptionChaining(
// Should not be the same as singleName.
uassert(ErrorCodes::InternalError,
str::stream() << "Attempted to register option with conflict between singleName and "
- << "deprecatedSingleName: "
- << singleName,
+ << "deprecatedSingleName: " << singleName,
!std::count(deprecatedSingleNames.begin(), deprecatedSingleNames.end(), singleName));
// Should not contain any already registered name.
diff --git a/src/mongo/util/options_parser/options_parser.cpp b/src/mongo/util/options_parser/options_parser.cpp
index 76fdc7fd42a..99231dd132c 100644
--- a/src/mongo/util/options_parser/options_parser.cpp
+++ b/src/mongo/util/options_parser/options_parser.cpp
@@ -416,9 +416,7 @@ public:
uassert(ErrorCodes::BadValue,
str::stream()
- << nodeName
- << " expansion block must contain only '"
- << getExpansionName()
+ << nodeName << " expansion block must contain only '" << getExpansionName()
<< "', and optionally 'type', 'trim', and/or 'digest'/'digest_key' fields",
node.size() == numVisitedFields);
@@ -472,8 +470,7 @@ public:
&computed);
uassert(ErrorCodes::BadValue,
str::stream() << "SHA256HMAC of config expansion " << computed.toString()
- << " does not match expected digest: "
- << _digest->toString(),
+ << " does not match expected digest: " << _digest->toString(),
computed == *_digest);
}
@@ -487,8 +484,7 @@ public:
if (!status.isOK()) {
uasserted(status.code(),
str::stream() << "Failed processing output of " << getExpansionName()
- << " block for config file: "
- << status.reason());
+ << " block for config file: " << status.reason());
}
return newNode;
@@ -719,8 +715,7 @@ Status YAMLNodeToValue(const YAML::Node& YAMLNode,
if (stringMap.count(elemKey) > 0) {
return Status(ErrorCodes::BadValue,
str::stream() << "String Map Option: " << key
- << " has duplicate keys in YAML Config: "
- << elemKey);
+ << " has duplicate keys in YAML Config: " << elemKey);
}
stringMap[std::move(elemKey)] = elemVal.Scalar();
@@ -1028,10 +1023,10 @@ Status addYAMLNodesToEnvironment(const YAML::Node& root,
}
/**
-* For all options that we registered as composable, combine the values from source and dest
-* and set the result in dest. Note that this only works for options that are registered as
-* vectors of strings.
-*/
+ * For all options that we registered as composable, combine the values from source and dest
+ * and set the result in dest. Note that this only works for options that are registered as
+ * vectors of strings.
+ */
Status addCompositions(const OptionSection& options, const Environment& source, Environment* dest) {
std::vector<OptionDescription> options_vector;
Status ret = options.getAllOptions(&options_vector);
@@ -1126,9 +1121,9 @@ Status addCompositions(const OptionSection& options, const Environment& source,
}
/**
-* For all options that have constraints, add those constraints to our environment so that
-* they run when the environment gets validated.
-*/
+ * For all options that have constraints, add those constraints to our environment so that
+ * they run when the environment gets validated.
+ */
Status addConstraints(const OptionSection& options, Environment* dest) {
std::vector<std::shared_ptr<Constraint>> constraints_vector;
diff --git a/src/mongo/util/options_parser/options_parser_test.cpp b/src/mongo/util/options_parser/options_parser_test.cpp
index 42530ab08b6..65b61b08ab5 100644
--- a/src/mongo/util/options_parser/options_parser_test.cpp
+++ b/src/mongo/util/options_parser/options_parser_test.cpp
@@ -5096,7 +5096,8 @@ TEST(YAMLConfigFile, canonicalize) {
moe::OptionsParser parser;
moe::Environment env;
std::vector<std::string> argv = {
- "binary", "--bind_ip_all",
+ "binary",
+ "--bind_ip_all",
};
std::map<std::string, std::string> env_map;
ASSERT_OK(parser.run(opts, argv, env_map, &env));