3/17 You are editing someone else's code. Formatting is terrible or
does not comform to your standards.
What do you normally do to the code formatting?
\_ go north
\_ If there is a code standard I change it as minimally as possible
to conform to the standard. If there isn't a well defined standard
I leave it alone. Making huge diffs in your source control system
really sucks.
\_ Agreed. But your organization should have agreed-upon
coding standards.
\_ Lots of companies I've worked for have coding standards that
leave a lot of leeway for personal choice.
\_ I conform to the sloppy code, where there is consistency.
\_ I conform to the sloppy code, where there is conformity.
Generally this means lining up my modifications with whatever the
indent is and putting my pointer *'s left or right.
\_ Seconded. When I add code to existing code, I try to conform to
the existing code' formatting as long as one exists, even if it's
lousy. When I create new code, I conform to my own formatting
standard. I refrain from re-formatting existing code unless I'm
making big changes to it. --- yuen
\_ From our coding guidelines doc at work:
"A single file should have a single formatting style (i.e., when in
Rome...). If you are maintaining code written in a style different
from yours, pretend you're a spy sent on a secret mission to make an
undetectable change to that code. It's lots of fun!"
I found that amusing. --dbushong
\_ M-x indent-region.
\_ Small edits, conform. Major additions or rewrites, use personal
style. If the old code becomes a sufficiently small portion of the
file, it gets reformatted. |