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 update #3895
clang-tidy update #3895
Conversation
tjhei
commented
Nov 18, 2020
- update clang-tidy rules (taken from deal.II)
- run with new clang-tidy 10
- update and fix contrib/utilities/run_clang_tidy.sh
- apply fixes:
- replace bind() by lambdas
- use range for loop
- various smaller fixes
- update to new clang-tidy-10 settings - disable unity/pch support in script
source/simulator/core.cc
Outdated
prescribed_stokes_solution (PrescribedStokesSolution::create_prescribed_stokes_solution<dim>(prm)), | ||
adiabatic_conditions (AdiabaticConditions::create_adiabatic_conditions<dim>(prm)), | ||
[&]() | ||
{ |
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.
astyle sadly gets confused with the indentation here. Should we leave the bind() call in here?
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.
Is there a real downside of using bind? If not I would personally prefer the readability for now. Also in the other places where bind has been replaced.
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.
Wow, those are a lot of changes. I really like to loop modernizations. Did clang-tidy autofix the code or did you have to fix it all by hand?
I do have a few small comments/questions, but I am generally fine with it being merged.
source/material_model/steinberger.cc
Outdated
@@ -195,8 +195,8 @@ namespace aspect | |||
if (use_lateral_average_temperature) | |||
{ | |||
this->get_lateral_averaging().get_temperature_averages(avg_temp); | |||
for (unsigned int i = 0; i < avg_temp.size(); ++i) | |||
AssertThrow(numbers::is_finite(avg_temp[i]), | |||
for (double i : avg_temp) |
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.
hmm, I think the avg_temp
should be average_temperatures
and i
should be average_temperature
. I will stop marking these out for the rest of the review because I think the point is clear and since this is strictly speaking only addressing the tidy comments it might be out of scope of this pull request.
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.
avg_temp is a class member. Maybe we do this separately after this PR is merged?
source/simulator/core.cc
Outdated
prescribed_stokes_solution (PrescribedStokesSolution::create_prescribed_stokes_solution<dim>(prm)), | ||
adiabatic_conditions (AdiabaticConditions::create_adiabatic_conditions<dim>(prm)), | ||
[&]() | ||
{ |
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.
Is there a real downside of using bind? If not I would personally prefer the readability for now. Also in the other places where bind has been replaced.
undo boost bind change
cba3a06
to
013211d
Compare
Not really. I agree, let's keep it for now. I updated the patch with (most of) your suggestions. |
This uses the |
013211d
to
17080b1
Compare
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.
looks good to me.
avg_temp is a class member. Maybe we do this separately after this PR is merged?
Sure, and since I am the one nitpicking here, I will put in the effort to make the change ;)