Skip to content

STYLE: Remove space between class and member names in C++ source files#2096

Merged
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Remove-space-between-class-and-member-name
Nov 9, 2020
Merged

STYLE: Remove space between class and member names in C++ source files#2096
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Remove-space-between-class-and-member-name

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

@N-Dekker N-Dekker commented Nov 4, 2020

It appears that clang-format has in some cases introduced a space
character between ClassName and ::MemberName. This typically seems
to have happened when there originally was a line break between the
class name and the member name.

This commit fixes the formatting by removing those spaces, as follows:

find . \( -iname *.cxx -and ! -path *ThirdParty* \) -exec perl -pi -w -e 's/([A-Z][a-z]+) \:\:([A-Z][a-z])/$1::$2/g;' {} \;
find . \( -iname *.hxx -and ! -path *ThirdParty* \) -exec perl -pi -w -e 's/([A-Z][a-z]+) \:\:([A-Z][a-z])/$1::$2/g;' {} \;
find . \( -iname *.h -and ! -path *ThirdParty* \) -exec perl -pi -w -e 's/([A-Z][a-z]+) \:\:([A-Z][a-z])/$1::$2/g;' {} \;

@N-Dekker N-Dekker force-pushed the Remove-space-between-class-and-member-name branch from ee97ee1 to bdb852f Compare November 4, 2020 20:13
@N-Dekker N-Dekker changed the title WIP: Remove space between class and member names DataObject WIP: Remove space between class and member names in *.cxx files Nov 4, 2020
@N-Dekker
Copy link
Copy Markdown
Contributor Author

N-Dekker commented Nov 5, 2020

@hjmjohnson Do you also like this commit? I realize, you wrote that regarding code formatting, "automation is key", while this commit is only semi-automatic!

If you don't like this commit, it would be OK to me to close the PR without merge. No problem. Because it's really a very minor cosmetic thing to me. But if you do like it, I think I should adjust the *.hxx files as well.

Copy link
Copy Markdown
Member

@hjmjohnson hjmjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@N-Dekker I love this commit !!

Please remove "WIP: and it can be merged".

@N-Dekker
Copy link
Copy Markdown
Contributor Author

N-Dekker commented Nov 6, 2020

I love this commit !!

@hjmjohnson Thanks, I'm glad to hear so :-) You know it's partially a matter of taste, so I can image that some people actually like to have a space before the ::MemberName. But still it looks like a Clang-Format bug anyway.

For the sake of completeness, I think I should also do the *.hxx file, before the PR is ready!

It appears that clang-format has in some cases introduced a space
character between `ClassName` and `::MemberName`. This typically seems
to have happened when there originally was a line break between the
class name and the member name.

This commit fixes the formatting by removing those spaces, as follows:

    find . \( -iname *.cxx -and ! -path *ThirdParty* \) -exec perl -pi -w -e 's/([A-Z][a-z]+) \:\:([A-Z][a-z])/$1::$2/g;' {} \;
    find . \( -iname *.hxx -and ! -path *ThirdParty* \) -exec perl -pi -w -e 's/([A-Z][a-z]+) \:\:([A-Z][a-z])/$1::$2/g;' {} \;
@N-Dekker N-Dekker force-pushed the Remove-space-between-class-and-member-name branch from bdb852f to 60726f3 Compare November 8, 2020 22:21
@N-Dekker N-Dekker changed the title WIP: Remove space between class and member names in *.cxx files STYLE: Remove space between class and member names in C++ source files Nov 8, 2020
@N-Dekker N-Dekker marked this pull request as ready for review November 8, 2020 22:26
@dzenanz dzenanz merged commit 734d6f8 into InsightSoftwareConsortium:master Nov 9, 2020
@N-Dekker N-Dekker deleted the Remove-space-between-class-and-member-name branch November 10, 2020 16:39
N-Dekker added a commit to SuperElastix/elastix that referenced this pull request Nov 27, 2020
It appears that clang-format has in some cases introduced a space character between `ClassName` and `::MemberName`. This typically seems to have happened when there originally was a line break between the class name and the member name.

This commit fixes the formatting by removing those spaces, as follows:

    find . \( -iname *.cxx \) -exec perl -pi -w -e 's/([A-Z][a-z]+) \:\:([A-Z][a-z])/$1::$2/g;' {} \;

Follows ITK:
 - pull request InsightSoftwareConsortium/ITK#2096
 - commit: InsightSoftwareConsortium/ITK@734d6f8
N-Dekker added a commit to SuperElastix/elastix that referenced this pull request Nov 30, 2020
It appears that clang-format has in some cases introduced a space character between `ClassName` and `::MemberName`. This typically seems to have happened when there originally was a line break between the class name and the member name.

This commit fixes the formatting by removing those spaces, as follows:

    find . \( -iname *.cxx \) -exec perl -pi -w -e 's/([A-Z][a-z]+) \:\:([A-Z][a-z])/$1::$2/g;' {} \;

Follows ITK:
 - pull request InsightSoftwareConsortium/ITK#2096
 - commit: InsightSoftwareConsortium/ITK@734d6f8
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Mar 4, 2021
It appears that clang-format has in some cases introduced an unintended
space character between the class name and the `::~`, in the definition
of a destructor. This typically seems to have happened when there
originally was a line break between the class name and the colon
characters.

Follow-up to:
"STYLE: Remove space between class and member names in C++ source files"
pull request InsightSoftwareConsortium#2096
commit 734d6f8
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Mar 10, 2021
It appears that clang-format has in some cases introduced an unintended
space character between the class name and the `::~`, in the definition
of a destructor. This typically seems to have happened when there
originally was a line break between the class name and the colon
characters.

Follow-up to:
"STYLE: Remove space between class and member names in C++ source files"
pull request InsightSoftwareConsortium#2096
commit 734d6f8
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Mar 10, 2021
It appears that clang-format has in some cases introduced an unintended
space character between the class name and the `::`, in the definition
of an `operator`.

Follow-up to:
"STYLE: Remove space between class and member names in C++ source files"
pull request InsightSoftwareConsortium#2096
commit 734d6f8
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Mar 10, 2021
It appears that clang-format (version 8.0.1) has in some cases
introduced an unintended space character between the class name and the
`::`, in the definition of a destructor or overloaded `operator`. This
typically seems to have happened when there originally was a line break
between the class name and the colon characters.

Follow-up to:
"STYLE: Remove space between class and member names in C++ source files"
pull request InsightSoftwareConsortium#2096
commit 734d6f8

Related to "Bug 44189 - clang-format does not remove space between
non-macro identifier and ::", reported by Pablo Martin-Gomez, 2019-12-01
https://bugs.llvm.org/show_bug.cgi?id=44189
dzenanz pushed a commit that referenced this pull request Mar 11, 2021
It appears that clang-format (version 8.0.1) has in some cases
introduced an unintended space character between the class name and the
`::`, in the definition of a destructor or overloaded `operator`. This
typically seems to have happened when there originally was a line break
between the class name and the colon characters.

Follow-up to:
"STYLE: Remove space between class and member names in C++ source files"
pull request #2096
commit 734d6f8

Related to "Bug 44189 - clang-format does not remove space between
non-macro identifier and ::", reported by Pablo Martin-Gomez, 2019-12-01
https://bugs.llvm.org/show_bug.cgi?id=44189
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Sep 26, 2022
Removed spaces between class and member names of IO classes, that were
accidentally introduced with pull request InsightSoftwareConsortium#1191
commit 2074c2f "STYLE: Enforce ITK style
defined by .clang-format".

Follow-up to pull request InsightSoftwareConsortium#2096
commit 734d6f8 "STYLE: Remove space between
class and member names in C++ source files"
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Sep 26, 2022
Removed spaces between class and member names, that were
accidentally introduced with pull request InsightSoftwareConsortium#1191
commit 2074c2f "STYLE: Enforce ITK style
defined by .clang-format".

Using bash commands like:

  find . \( -iname *.cxx \) -exec perl -pi -w -e 's/([A-Z]\w+) \:\:(\w)/$1::$2/g;' {} \;

Follow-up to pull request InsightSoftwareConsortium#2096
commit 734d6f8 "STYLE: Remove space between
class and member names in C++ source files"
dzenanz pushed a commit that referenced this pull request Sep 27, 2022
Removed spaces between class and member names, that were
accidentally introduced with pull request #1191
commit 2074c2f "STYLE: Enforce ITK style
defined by .clang-format".

Using bash commands like:

  find . \( -iname *.cxx \) -exec perl -pi -w -e 's/([A-Z]\w+) \:\:(\w)/$1::$2/g;' {} \;

Follow-up to pull request #2096
commit 734d6f8 "STYLE: Remove space between
class and member names in C++ source files"
hjmjohnson pushed a commit to hjmjohnson/ITK that referenced this pull request May 6, 2026
It appears that clang-format (version 8.0.1) has in some cases
introduced an unintended space character between the class name and the
`::`, in the definition of a destructor or overloaded `operator`. This
typically seems to have happened when there originally was a line break
between the class name and the colon characters.

Follow-up to:
"STYLE: Remove space between class and member names in C++ source files"
pull request InsightSoftwareConsortium#2096
commit 4b95bbd

Related to "Bug 44189 - clang-format does not remove space between
non-macro identifier and ::", reported by Pablo Martin-Gomez, 2019-12-01
https://bugs.llvm.org/show_bug.cgi?id=44189
hjmjohnson pushed a commit to hjmjohnson/ITK that referenced this pull request May 6, 2026
Removed spaces between class and member names, that were
accidentally introduced with pull request InsightSoftwareConsortium#1191
commit 38e2d2d "STYLE: Enforce ITK style
defined by .clang-format".

Using bash commands like:

  find . \( -iname *.cxx \) -exec perl -pi -w -e 's/([A-Z]\w+) \:\:(\w)/$1::$2/g;' {} \;

Follow-up to pull request InsightSoftwareConsortium#2096
commit 4b95bbd "STYLE: Remove space between
class and member names in C++ source files"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants