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

Class RuleBuilder

Source/cmSarifLog.h:115–150  ·  view source on GitHub ↗

@brief A builder for SARIF rules `Rule` is a data model for SARIF rules. Known rules are usually initialized manually by field. Using a builder makes initialization more readable and prevents issues with reordering and optional fields.

Source from the content-addressed store, hash-verified

113/// manually by field. Using a builder makes initialization more readable and
114/// prevents issues with reordering and optional fields.
115class RuleBuilder
116{
117public:
118 /// @brief Construct a new rule builder for a rule with the given ID
119 RuleBuilder(char const* id) { this->NewRule.Id = id; }
120
121 /// @brief Set the name of the rule
122 RuleBuilder& Name(std::string name)
123 {
124 this->NewRule.Name = std::move(name);
125 return *this;
126 }
127
128 /// @brief Set the full description of the rule
129 RuleBuilder& FullDescription(std::string fullDescription)
130 {
131 this->NewRule.FullDescription = std::move(fullDescription);
132 return *this;
133 }
134
135 /// @brief Set the default message for the rule
136 RuleBuilder& DefaultMessage(std::string defaultMessage)
137 {
138 this->NewRule.DefaultMessage = std::move(defaultMessage);
139 return *this;
140 }
141
142 /// @brief Build the rule
143 std::pair<std::string, Rule> Build() const
144 {
145 return std::make_pair(this->NewRule.Id, this->NewRule);
146 }
147
148private:
149 Rule NewRule;
150};
151
152/// @brief Get the SARIF severity level of a CMake message type
153ResultSeverityLevel MessageSeverityLevel(MessageType t);

Callers 2

ResultsLogMethod · 0.85
UseRuleMethod · 0.85

Calls 1

moveFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…