#64 Line breaks before operator

release_2.3
closed
None
5
2012-10-10
2002-05-07
No

Hi,

a common violation of the rules we use here is to put
the line break after the operator:

veryLongVariableName +
anotherVeryLongVariableName

we consider this bad practice because looking at the
second line it is sometimes hard to spot that it is
a continuation. This

veryLongVariableName
+ anotherVeryLongVariableName

is much better (try it with real long lines and you'll
know what I mean).

Operators include everything that can occur in a
statement and is not part of a variable or a comma,
this includes "." in particular. (I got some silly
formatted code from C programmers who considered "," an
operator. But it really isn't in Java.)

How about checking this?

Regards,

Michael

Discussion

  • Oliver Burn

    Oliver Burn - 2002-05-13

    Logged In: YES
    user_id=218824

    I like this idea - I have recently adopted the recommended
    style above after rereading the Sun coding standard. It is
    quite nice.

     
  • Oliver Burn

    Oliver Burn - 2002-05-29

    Logged In: YES
    user_id=218824

    the check has been added and is in CVS. Will be in the next
    release.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks