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