Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmluk committed Sep 6, 2024
1 parent 4660077 commit f7ff1c9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
11 changes: 0 additions & 11 deletions config_utilities/include/config_utilities/formatting/asl.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ class AslFormatter : public Formatter {
std::string formatSubconfig(const MetaData& data, size_t indent) const;
std::string resolveConfigName(const MetaData& data) const;

// Formatting options, currently not exposed in global settings but work if want changed.
// TODO(lschmid): Global formatting options should probably be a config of the formatter.
// If true add subconfig types after the fieldname.
constexpr static bool indicate_subconfig_types_ = true;
// If true label subconfigs as default if all their values are default.
constexpr static bool indicate_subconfig_default_ = true;
// If true indicate that a config is a virtual config in the config name.
constexpr static bool indicate_virtual_configs_ = true;
// If true indicate the number of a check and total number of checks in failed checks.
constexpr static bool indicate_num_checks_ = true;

// Variables.
std::string name_prefix_;
size_t total_num_checks_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ std::string joinNamespace(const std::string& namespace_1,

/**
* @brief Formatting of YAML nodes to strings. Most config types can be neatly represented as low-depth yaml nodes, or
* should otherwise probably be wrapped in a separate confi struct.
* should otherwise probably be wrapped in a separate config struct.
* @param data The data to be formatted.
* @param reformat_float Whether to try and print floats with default stream precision
* @returns The formatted string.
Expand Down
5 changes: 3 additions & 2 deletions config_utilities/src/asl_formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ std::string AslFormatter::formatChecksInternal(const MetaData& data, const std::
}
const std::string rendered_name = check->name().empty() ? "" : " for '" + name_prefix_ + check->name() + "'";
const std::string rendered_num =
indicate_num_checks_ ? "[" + std::to_string(current_check_) + "/" + std::to_string(total_num_checks_) + "] "
: "";
Settings::instance().printing.show_num_checks
? "[" + std::to_string(current_check_) + "/" + std::to_string(total_num_checks_) + "] "
: "";
const std::string msg = sev + "Check " + rendered_num + "failed" + rendered_name + ": " + check->message() + ".";
result.append(wrapString(msg, length, sev.length(), false) + "\n");
}
Expand Down
3 changes: 2 additions & 1 deletion config_utilities/test/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool expectEqual(const YAML::Node& a, const YAML::Node& b) {
for (const auto& kv_pair : a) {
const std::string key = kv_pair.first.Scalar();
if (!b[key]) {
ADD_FAILURE() << "Key " << key << " not found in b.";
ADD_FAILURE() << "Key '" << key << "' not found in b.";
return false;
}
EXPECT_TRUE(expectEqual(kv_pair.second, b[key]));
Expand Down Expand Up @@ -100,4 +100,5 @@ void TestLogger::print() const {
std::cout << internal::severityToString(message.first) << ": " << message.second << std::endl;
}
}

} // namespace config::test

0 comments on commit f7ff1c9

Please sign in to comment.