mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-30 07:49:31 -05:00
Remove Exhaustive parameter for documentation
This commit is contained in:
@@ -131,20 +131,18 @@ DocumentationEntry::DocumentationEntry(std::string key, Verifier* v, Optional op
|
||||
std::move(doc))
|
||||
{}
|
||||
|
||||
Documentation::Documentation(std::string n, std::string id, DocumentationEntries entries,
|
||||
Exhaustive exh)
|
||||
Documentation::Documentation(std::string n, std::string id, DocumentationEntries entries)
|
||||
: name(std::move(n))
|
||||
, id(std::move(id))
|
||||
, entries(std::move(entries))
|
||||
, exhaustive(std::move(exh))
|
||||
{}
|
||||
|
||||
Documentation::Documentation(std::string n, DocumentationEntries entries, Exhaustive exh)
|
||||
: Documentation(n, "", entries, exh)
|
||||
Documentation::Documentation(std::string n, DocumentationEntries entries)
|
||||
: Documentation(n, "", entries)
|
||||
{}
|
||||
|
||||
Documentation::Documentation(DocumentationEntries entries, Exhaustive exh)
|
||||
: Documentation("", "", entries, exh)
|
||||
Documentation::Documentation(DocumentationEntries entries)
|
||||
: Documentation("", "", entries)
|
||||
{}
|
||||
|
||||
TestResult testSpecification(const Documentation& d, const ghoul::Dictionary& dict) {
|
||||
@@ -184,33 +182,6 @@ TestResult testSpecification(const Documentation& d, const ghoul::Dictionary& di
|
||||
}
|
||||
}
|
||||
|
||||
if (d.exhaustive) {
|
||||
// If the documentation is exhaustive, we have to check if there are extra values
|
||||
// in the table that are not covered by the Documentation
|
||||
|
||||
for (const std::string& key : dict.keys()) {
|
||||
auto it = std::find_if(
|
||||
d.entries.begin(),
|
||||
d.entries.end(),
|
||||
[&key](const DocumentationEntry& entry) {
|
||||
if (entry.key == DocumentationEntry::Wildcard) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return entry.key == key;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (it == d.entries.end()) {
|
||||
result.success = false;
|
||||
result.offenses.push_back(
|
||||
{ key, TestResult::Offense::Reason::ExtraKey }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicate offenders that might occur if multiple rules apply to a single
|
||||
// key and more than one of these rules are broken
|
||||
std::set<TestResult::Offense, OffenseCompare> uniqueOffenders(
|
||||
|
||||
Reference in New Issue
Block a user