OpenPMDWriter.cpp & HpMultiGrid.H : enforce clang-tidy rule bugprone-branch-clone#1304
Merged
AlexanderSinn merged 2 commits intoHi-PACE:developmentfrom Oct 29, 2025
Conversation
Comment on lines
+183
to
+187
| case 1: | ||
| case 2: | ||
| return 2; | ||
| case 3: | ||
| return 1; |
Member
There was a problem hiding this comment.
Hmm, I feel like the old way is more readable as it looks closer to get_num_comps_acf below it.
Contributor
Author
There was a problem hiding this comment.
If you want uniformity of style, one option would be to change also get_num_comps_acf by writing:
switch (system_type) {
case 1:
return 1;
case 2:
return 2;
case 3:
return 0;
}
There's also the option of disregarding the rule if you don't like it.
Member
There was a problem hiding this comment.
I discussed this with Emanuele on what is more readable, and it is ok to do it the clang-tidy way if also the formatting in get_num_comps_acf is updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a follow-up of #1302 .
By using the tool proposed in #1303 I ran
clang-tidyon the code. This PR fixes the issues found with the rule:Is this something that you would like to enforce in
HiPACE++? In my opinion, most of the checks of thebugprone-*family are quite useful (in WarpX we decided to enable most of them)...These are the only issues found with the following rules:
constisconst)