Skip to content

Commit 1d88ded

Browse files
committed
add unchecked rule list in json report - see #53
1 parent 12d8b4c commit 1d88ded

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/app/report_json.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ bool checkComplianceJsonSpec(Box const& file, SpecDesc const* spec, Json::Array*
145145
auto root = std::make_unique<Json::Object>();
146146
root->content.push_back(std::make_unique<Json::Data>("specification", spec->name));
147147
auto successArray = std::make_unique<Json::Array>("successful_checks");
148+
auto uncheckedArray = std::make_unique<Json::Array>("unchecked");
148149
auto errorArray = std::make_unique<Json::Array>("errors");
149150
auto warningArray = std::make_unique<Json::Array>("warnings");
150151

@@ -223,7 +224,7 @@ bool checkComplianceJsonSpec(Box const& file, SpecDesc const* spec, Json::Array*
223224
auto const count = out.errorCount + out.warningCount;
224225
rule.check(file, &out);
225226

226-
if(count == out.errorCount + out.warningCount && out.lastRuleCovered == true)
227+
if(count == out.errorCount + out.warningCount)
227228
{
228229
auto o = std::make_unique<Json::Object>();
229230
o->content.push_back(std::make_unique<Json::Data>("rule", std::to_string(out.ruleIdx)));
@@ -232,7 +233,11 @@ bool checkComplianceJsonSpec(Box const& file, SpecDesc const* spec, Json::Array*
232233
o->content.push_back(std::make_unique<Json::Data>("id", spec->rules[out.ruleIdx].id));
233234

234235
o->content.push_back(std::make_unique<Json::Data>("details", spec->rules[out.ruleIdx].caption));
235-
successArray->content.push_back(std::move(o));
236+
237+
if(out.lastRuleCovered)
238+
successArray->content.push_back(std::move(o));
239+
else
240+
uncheckedArray->content.push_back(std::move(o));
236241
}
237242
}
238243
catch(std::exception const& e)
@@ -246,6 +251,7 @@ bool checkComplianceJsonSpec(Box const& file, SpecDesc const* spec, Json::Array*
246251
root->content.push_back(std::move(successArray));
247252
root->content.push_back(std::move(errorArray));
248253
root->content.push_back(std::move(warningArray));
254+
root->content.push_back(std::move(uncheckedArray));
249255
array->content.push_back(std::move(root));
250256

251257
for(auto dep : spec->dependencies)

0 commit comments

Comments
 (0)