Add an "Ok, with warnings" overall status.

In outputs it could be confusing to see a line:

<filename>: Ok

followed by a set of warnings.

To differentiate this, add a top level status "Ok, with warnings" when
rule loading was successful but had warnings.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
This commit is contained in:
Mark Stemm
2022-08-10 18:21:56 -07:00
committed by poiana
parent 3c7b6e037a
commit 8e61e46016
2 changed files with 29 additions and 4 deletions

View File

@@ -266,7 +266,19 @@ const std::string& rule_loader::result::as_summary_string()
os << name << ": "; os << name << ": ";
} }
os << (success ? "Ok" : "Invalid"); if(success)
{
os << "Ok";
if (!warnings.empty())
{
os << ", with warnings";
}
}
else
{
os << "Invalid";
}
if(!errors.empty()) if(!errors.empty())
{ {
@@ -326,7 +338,19 @@ const std::string& rule_loader::result::as_verbose_string(const rules_contents_t
os << name << ": "; os << name << ": ";
} }
os << (success ? "Ok" : "Invalid"); if(success)
{
os << "Ok";
if (!warnings.empty())
{
os << ", with warnings";
}
}
else
{
os << "Invalid";
}
if (!errors.empty()) if (!errors.empty())
{ {

View File

@@ -102,8 +102,9 @@ application::run_result application::validate_rules_files()
{ {
// If here, there must be only warnings. // If here, there must be only warnings.
// Add a line to the summary noting that the // Add a line to the summary noting that the
// file was ok without printing the warnings. // file was ok with warnings, without actually
summary += filename + ": Ok"; // printing the warnings.
summary += filename + ": Ok, with warnings";
// If verbose is true, print the warnings now. // If verbose is true, print the warnings now.
if(m_options.verbose) if(m_options.verbose)