MCPcopy Create free account
hub / github.com/Kitware/CMake / UseRule

Method UseRule

Source/cmSarifLog.cxx:99–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99std::size_t cmSarif::ResultsLog::UseRule(std::string const& id) const
100{
101 // Check if the rule is already in the index
102 auto it = this->RuleToIndex.find(id);
103 if (it != this->RuleToIndex.end()) {
104 // The rule is already in use. Return the known index
105 return it->second;
106 }
107
108 // This rule is not yet in the index, so check if it is recognized
109 auto itKnown = this->KnownRules.find(id);
110 if (itKnown == this->KnownRules.end()) {
111 // The rule is not known. Add an empty rule to the known rules so that it
112 // is included in the output
113 this->KnownRules.emplace(RuleBuilder(id.c_str()).Build());
114 }
115
116 // Since this is the first time the rule is used, enable it and add it to the
117 // index
118 std::size_t idx = this->EnabledRules.size();
119 this->RuleToIndex[id] = idx;
120 this->EnabledRules.emplace_back(id);
121 return idx;
122}
123
124cmSarif::ResultSeverityLevel cmSarif::MessageSeverityLevel(MessageType t)
125{

Callers 1

LogMethod · 0.95

Calls 8

RuleBuilderClass · 0.85
emplaceMethod · 0.80
c_strMethod · 0.80
emplace_backMethod · 0.80
findMethod · 0.45
endMethod · 0.45
BuildMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected