-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
STYLE: Use auto
for variables initialized by New()
in Examples
#2994
STYLE: Use auto
for variables initialized by New()
in Examples
#2994
Conversation
A few notes:
I think it is fair to leave them as they are without further explanation, since they are still accurate even if using
Edit: Examples are built for macOS CI 👌. |
6bcf7cb
to
a945c77
Compare
Very nice @jhlegarreta Indeed, the commit that I did (828453d), did not deal with the situation of having the Just some comment on your commit message: I would suggest to have a slightly different subject line, so that your commit can be distinguished more easily from mine. For example:
Or just:
The commit message says:
That particular commit appears to produce a warning on GitHub, saying: "This commit does not belong to any branch ..." On the Git Bash command prompt, this particular commit cannot be found from a fresh ITK git clone, as I tried by doing So I would suggest to instead mention the corresponding commit at the master branch: Also I think it would be nice to mention the corresponding pull request in the commit message: My two cents, Niels |
Replace initializations of the form `T::Pointer var = T::New()` (sometimes starting with `typename`) with `auto var = T::New()` in `Examples` to reduce code redundancy In accordance with C++ Core Guidelines, August 19, 2021: "ES.11: Use `auto` to avoid redundant repetition of type names" https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-auto Following PR InsightSoftwareConsortium#2826 and commit 828453d.
a945c77
to
41cedd7
Compare
auto
for declaration of variables initialized by New()
auto
for variables initialized by New()
in Examples
Note that I essentially only looked at the very same PR you mentioned https://github.com/InsightSoftwareConsortium/ITK/pull/2826/commits, and as you can see the commit reference was accurate. The message you mention does appear on the web interface as well. For some reason the commit does not appear in the web history, but usually when a PR is merged from a fork, a new merge commit with the message Not sure what's up with that commit, but it is done in any case. |
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.
👍
@jhlegarreta The commit you originally referred to (5ab79bc) belongs to PR #2826, indeed, so I guess that indeed, it will be kept in the history at github.com/InsightSoftwareConsortium/ITK for a long time. However, it won't be available "offline" at local ITK clones of end users. That's just why I prefer to mention the commit from the master branch (828453d), as that one is available at local ITK clones. And it may be available for an even longer time... 😃 Thanks for adjusting the commit message! |
We might be able to handle the multi-line statements with |
Replaced initializations of the forms `T::Pointer var = T::New()` and `typename T::Pointer var = T::New()` with `auto var = T::New()`, to reduce code redundancy. Using Notepad++ v8.3.3, Find in Files (Regular expression): Find what: typename (\w+)::Pointer[ ]+(\w+) = \1::New\(\); Replace with: auto $2 = $1::New\(\); And then again without `typename`. Following ITK pull request InsightSoftwareConsortium/ITK#2994 commit InsightSoftwareConsortium/ITK@2f291f8 "STYLE: Use `auto` for variables initialized by `New()` in Examples", by Jon Haitz Legarreta Gorroño, merged on 27 December 2021.
Replaced initializations of the forms `T::Pointer var = T::New()` and `typename T::Pointer var = T::New()` with `auto var = T::New()`, to reduce code redundancy. Using Notepad++ v8.3.3, Find in Files (Regular expression): Find what: typename (\w+)::Pointer[ ]+(\w+) = \1::New\(\); Replace with: auto $2 = $1::New\(\); And then again without `typename`. Following ITK pull request InsightSoftwareConsortium/ITK#2994 commit InsightSoftwareConsortium/ITK@2f291f8 "STYLE: Use `auto` for variables initialized by `New()` in Examples", by Jon Haitz Legarreta Gorroño, merged on 27 December 2021.
Replace initializations of the form
T::Pointer var = T::New()
(sometimes starting with
typename
) withauto var = T::New()
inExamples
toreduce code redundancy
In accordance with C++ Core Guidelines, August 19, 2021:
"ES.11: Use
auto
to avoid redundant repetition of type names"https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-auto
Following PR #2826
and commit 828453d.
PR Checklist