-
Notifications
You must be signed in to change notification settings - Fork 199
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
Clang-tidy CI test: bump version from 15 to 16 #5592
Clang-tidy CI test: bump version from 15 to 16 #5592
Conversation
Is there a specific reason why you want to move to version 16 as opposed to even newer versions? |
@EZoni , the main reason is to split into two PRs the changes that will be required with newer versions of |
Source/BoundaryConditions/PML.H
Outdated
@@ -112,7 +112,7 @@ public: | |||
} | |||
|
|||
private: | |||
const amrex::BoxArray& m_grids; | |||
amrex::BoxArray m_grids; |
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.
Why not simply a ref?
amrex::BoxArray m_grids; | |
amrex::BoxArray & m_grids; |
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.
@ax3l , the goal of avoid-const-or-ref-data-members is to avoid using const
or ref
data members, on the grounds that
Having such members is rarely useful, and makes the class only copy-constructible but not copy-assignable
This recommendation is part of the C++ Core Guidelines, and clant-tidy
documentation suggests also this additional reading on the topic.
That said, we are not forced to enforce this rule in WarpX (although I think that this rule makes sense in most cases), or we could make an exception specifically for this line. For the moment I've implemented @WeiqunZhang 's suggestion, but I can revert it and just add a NOLINT
.
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.
Agreed, but my suggestion just adds &
not const
back :D
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.
LGTM 👍
This PR bumps the version used for
clang-tidy
CI tests from 15 to 16.It also addresses all the issues found with the upgraded tool.
Most of the issues are related to this newly introduced check:
The check enforces CppCoreGuidelines about constant and reference data members .
In general, I understand the argument against using constant or reference data members.
There is however one case in which I am not fully convinced by the suggestion of the tool: in PML.H(we are now using a pointer forconst amrex::BoxArray& m_grids;
becomesamrex::BoxArray m_grids;
and I am wondering if this can be an issue for performances. Maybe we could consider using a (possibly smart) pointer to theBoxArray
, instead of making a copy.amrex::BoxArray m_grids;
).Few issues were instead related to these checks:
modernize-loop-convert
This check was already enabled, but
clang-tidy-16
broadens its scope with respect to previous versions.modernize-use-auto
Only one case. I am a bit confused because this should have been found also by version 15 of the tool.
misc-use-anonymous-namespace
This is a new check. Actually, the issues found with this check were false positives, but they disappeared when I properly set
misc-use-anonymous-namespace.HeaderFileExtensions
in the.clang-tidy
configuration file to recognize.H
files as headers.misc-misplaced-const
Only one case. I am a bit confused because this should have been found also by version 15 of the tool.
readability-misleading-indentation [NOW DISABLED DUE TO FALSE POSITIVES]
This check was already enabled. However, with this newer version of the tool, it seems to me that it generates some false positives. Therefore, I would like to propose to disable it. We may try to re-enable it when we will bump the version from 16 to 17.