Skip to content

Commit 7c829dd

Browse files
chweidlingclaude
andcommitted
Take the tag name as std::string_view in hasName()
Suggested by SonarCloud (cpp:S6009). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2ebb2cb commit 7c829dd

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/actions/tag.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ std::string Tag::getName(Transaction *transaction) {
5757
}
5858

5959

60-
bool Tag::hasName(const std::string &name, Transaction *transaction) {
60+
bool Tag::hasName(std::string_view name, Transaction *transaction) {
6161
if (m_staticName) {
6262
return *m_staticName == name;
6363
}

‎src/actions/tag.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
#include <string>
17+
#include <string_view>
1718
#include <memory>
1819
#include <optional>
1920
#include <utility>
@@ -41,7 +42,7 @@ class Tag : public Action {
4142
: std::optional<std::string>(m_string->evaluate())) { }
4243

4344
std::string getName(Transaction *transaction);
44-
bool hasName(const std::string &name, Transaction *transaction);
45+
bool hasName(std::string_view name, Transaction *transaction);
4546

4647
bool evaluate(RuleWithActions *rule, Transaction *transaction, RuleMessage &ruleMessage) override;
4748

0 commit comments

Comments
 (0)