-
Notifications
You must be signed in to change notification settings - Fork 31
Add clang-tidy suppression for InsertingVisitor reference members using NOLINTBEGIN/NOLINTEND blocks #2031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members) suppression to the m_collection_name member in InsertingVisitor struct. The lifetime of the referenced string is guaranteed to outlive the visitor in this usage pattern, as the visitor is created and used immediately within the same scope where the collection name string exists. Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
m_collection_name
being a referencefor more information, see https://pre-commit.ci
…ability Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
@copilot Please include the JEvent reference in the NOLINT block :-) |
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Head branch was pushed to by a user without write access
Included the JEvent reference in the NOLINT block. Both reference members are now covered by the same suppression block. (commit: 8a0857e) |
No Clang-Tidy warnings found so I assume my comments were addressed
This PR addresses clang-tidy warnings about reference members in the
InsertingVisitor
struct. The warnings were flagged by thecppcoreguidelines-avoid-const-or-ref-data-members
check.Changes Made
Added a targeted suppression using
NOLINTBEGIN
/NOLINTEND
blocks to both reference members with an explanatory comment:Justification
The
NOLINTBEGIN
/NOLINTEND
block approach is preferred over inlineNOLINT
comments because it provides format-stable suppression that isn't dependent on line positioning, preventing issues when code formatters reflow long comment lines.Both reference members are safe in this specific usage pattern because:
InsertingVisitor
is created and used immediately within the same scope inGetEvent()
event
andcoll_name
) come from the calling context and have guaranteed lifetimes that extend beyond the visitor's usageThis follows the established pattern in the codebase for suppressing specific clang-tidy warnings with appropriate justification comments.
Fixes #1981.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.