Skip to contentSkip to conversation

CodingStyle on existing code

DISCUSSION Wido den Hollander 5 participants 8 messages Dec 1, 2015 – Dec 9, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

Wido

#1 lore raw
Quoted 10 lines · Wido den Hollander

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

A sane (but long) way to do that is to cleanup when fixing a bug or adding a feature. With (a lot) of patience, it will eventually be better :-)

My 2cts.

Quoted 6 lines

Wido
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Loïc Dachary, Artisan Logiciel Libre
#2 lore raw
Quoted 8 lines · Loic Dachary
Quoted 5 lines · Wido den Hollander

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

Quoted 7 lines
Quoted 5 lines

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

A sane (but long) way to do that is to cleanup when fixing a bug or adding a feature. With (a lot) of patience, it will eventually be better :-)

Yeah, we generally want you to follow the standards in any new code. A mass update of the code style on existing code makes navigating the history a little harder so a lot of people don't like it much, though. *shrug*
-Greg

#3 lore raw
Quoted 12 lines · Gregory Farnum
Quoted 11 lines · Loic Dachary
Quoted 8 lines · Wido den Hollander

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

A sane (but long) way to do that is to cleanup when fixing a bug or adding a feature. With (a lot) of patience, it will eventually be better :-)

Yeah, we generally want you to follow the standards in any new code. A mass update of the code style on existing code makes navigating the history a little harder so a lot of people don't like it much, though.

Understood. But in this case I'm working in PGMonitor.cc. For just 20 lines of code I probably shouldn't refactor the whole file, should I?

Quoted 7 lines

*shrug*
-Greg
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 17 lines · Wido den Hollander
Quoted 15 lines · Gregory Farnum
Quoted 14 lines · Loic Dachary
Quoted 10 lines · Wido den Hollander

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

A sane (but long) way to do that is to cleanup when fixing a bug or adding a feature. With (a lot) of patience, it will eventually be better :-)

Yeah, we generally want you to follow the standards in any new code. A mass update of the code style on existing code makes navigating the history a little harder so a lot of people don't like it much, though.

Understood. But in this case I'm working in PGMonitor.cc. For just 20 lines of code I probably shouldn't refactor the whole file, should I?

Easiest thing is to fix the code around your change.

I'm also open to a wholesale cleanup since it's a low-traffic file and likely won't conflict with other stuff in flight. But, up to you!

sage

#5 lore raw
Quoted 18 lines · Sage Weil
Quoted 17 lines · Wido den Hollander
Quoted 15 lines · Gregory Farnum
Quoted 14 lines · Loic Dachary
Quoted 10 lines · Wido den Hollander

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

A sane (but long) way to do that is to cleanup when fixing a bug or adding a feature. With (a lot) of patience, it will eventually be better :-)

Yeah, we generally want you to follow the standards in any new code. A mass update of the code style on existing code makes navigating the history a little harder so a lot of people don't like it much, though.

Understood. But in this case I'm working in PGMonitor.cc. For just 20 lines of code I probably shouldn't refactor the whole file, should I?

While it annoys me finding a given commit in history that just changes every single line to fix styling, I also recognize that this is the sort of janitorial task that may be warranted for certain files.

As sage mentions below, this is a low-traffic file. And whenever it's changed, is often just tiny bits here and there. That tends to add to the style divergence rather than to convergence.

I'd say go for it. If you are indeed changing those 20 or so lines though, please add those lines on a separate patch from the style changes.

-Joao

Quoted 12 lines

Easiest thing is to fix the code around your change.

I'm also open to a wholesale cleanup since it's a low-traffic file and likely won't conflict with other stuff in flight. But, up to you!

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 32 lines · Joao Eduardo Luis
Quoted 18 lines · Sage Weil
Quoted 17 lines · Wido den Hollander
Quoted 15 lines · Gregory Farnum
Quoted 14 lines · Loic Dachary
Quoted 10 lines · Wido den Hollander

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

A sane (but long) way to do that is to cleanup when fixing a bug or adding a feature. With (a lot) of patience, it will eventually be better :-)

Yeah, we generally want you to follow the standards in any new code. A mass update of the code style on existing code makes navigating the history a little harder so a lot of people don't like it much, though.

Understood. But in this case I'm working in PGMonitor.cc. For just 20 lines of code I probably shouldn't refactor the whole file, should I?

While it annoys me finding a given commit in history that just changes every single line to fix styling, I also recognize that this is the sort of janitorial task that may be warranted for certain files.

Quoted 7 lines

As sage mentions below, this is a low-traffic file. And whenever it's changed, is often just tiny bits here and there. That tends to add to the style divergence rather than to convergence.

I'd say go for it. If you are indeed changing those 20 or so lines though, please add those lines on a separate patch from the style changes.

Here is the first pull request without a functional change. It is just the codingstyle fix: https://github.com/ceph/ceph/pull/6881

If that comes through I can put in the actual code.

Wido

Quoted 15 lines

-Joao

Quoted 12 lines

Easiest thing is to fix the code around your change.

I'm also open to a wholesale cleanup since it's a low-traffic file and likely won't conflict with other stuff in flight. But, up to you!

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Wido den Hollander
42on B.V.
Ceph trainer and consultant

Phone: +31 (0)20 700 9902
Skype: contact42on
#7 lore raw
Quoted 37 lines · Wido den Hollander
Quoted 36 lines · Joao Eduardo Luis
Quoted 18 lines · Sage Weil
Quoted 17 lines · Wido den Hollander
Quoted 15 lines · Gregory Farnum
Quoted 14 lines · Loic Dachary
Quoted 10 lines · Wido den Hollander

Hi,

While working on mon/PGMonitor.cc I see that there is a lot of inconsistency on the code.

A lot of whitespaces, indentation which is not correct, well, a lot of things.

Is this something we want to fix? With some scripts we can probably do this easily, but it might cause merge hell with people working on features.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

A sane (but long) way to do that is to cleanup when fixing a bug or adding a feature. With (a lot) of patience, it will eventually be better :-)

Yeah, we generally want you to follow the standards in any new code. A mass update of the code style on existing code makes navigating the history a little harder so a lot of people don't like it much, though.

Understood. But in this case I'm working in PGMonitor.cc. For just 20 lines of code I probably shouldn't refactor the whole file, should I?

While it annoys me finding a given commit in history that just changes every single line to fix styling, I also recognize that this is the sort of janitorial task that may be warranted for certain files.

As sage mentions below, this is a low-traffic file. And whenever it's changed, is often just tiny bits here and there. That tends to add to the style divergence rather than to convergence.

Quoted 8 lines
Quoted 3 lines

I'd say go for it. If you are indeed changing those 20 or so lines though, please add those lines on a separate patch from the style changes.

Here is the first pull request without a functional change. It is just the codingstyle fix: https://github.com/ceph/ceph/pull/6881

If that comes through I can put in the actual code.

Seems a whole lot less intrusive than I expected. :)

-Joao

Quoted 20 lines

Wido

Quoted 15 lines

-Joao

Quoted 12 lines

Easiest thing is to fix the code around your change.

I'm also open to a wholesale cleanup since it's a low-traffic file and likely won't conflict with other stuff in flight. But, up to you!

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html