commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: [all] Checkstyle and '+' should be on the previous line.
Date Mon, 03 Sep 2012 22:22:53 GMT
On Mon, Sep 03, 2012 at 02:19:01PM -0700, Phil Steitz wrote:
> 
> 
> 
> 
> On Sep 3, 2012, at 12:25 PM, Gary Gregory <garydgregory@gmail.com> wrote:
> 
> > On Sep 3, 2012, at 14:13, Gilles Sadowski <gilles@harfang.homelinux.org> wrote:
> > 
> >> On Mon, Sep 03, 2012 at 09:59:55AM -0700, Phil Steitz wrote:
> >>> On 9/1/12 10:11 AM, Gary Gregory wrote:
> >>> 
> >>> I have not tried using it, but the eclipse config that Luc posted
> >>> [1] includes this line, which I suspect configures this behavior:
> >>> 
> >>> <setting
> >>> id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator"
> >>> value="false"/>
> >>> 
> >>> I am curious why you don't like it.  To me, it is similar to putting
> >>> the open paren for a method call on the preceding line.  Easier to
> >>> read for me at least.  Of course, in keeping with my normal "too
> >>> many rules == evil" view, I don't see it as something that needs to
> >>> be standardized :)
> >> 
> >> One way to "explain" it: You would not write unary minus on the previous
> >> line:
> >> double minusOne = -
> >>   1;
> > 
> > That makes sense for unary guys at least.
> > 
> Sort of ridiculous example,

Perhaps you didn't get it...

> as the - would never be followed by a space,

And why not?

> so would never be wrapped that way.

Never?  I've just wrapped it that way. It's a valid expression, and not
using that notation is purely a result convention/rule/best practice/taste.

> The rule above and I suspect the checkstyle    check, refers to binary operators. 

What's the point?

My point is that

  -
  x

is not more ridiculous than

  y -
    x

If you do find it ridiculous, it is indeed only because of habit; others
might be used to (and thus prefer)

  y
  - x


Gilles

> 
> Phil
> 
> > G
> > 
> >> 
> >> Similarly, before one has become used to this (arbitrary) rule, this is as
> >> strange:
> >> double xMinusOne = x -
> >>   1;
> >> 
> >> [A rationale for writing parenthesis on the same line is that you can figure
> >> out more quickly that it is a method call, rather than a reference to a
> >> variable.]
> >> 
> >> 
> >> Gilles
> >> 
> >>> 
> >>> Phil
> >>> 
> >>> [1] http://markmail.org/message/djnlefeodk2xa7bz
> >>> 
> >>>> Hi All:
> >>>> 
> >>>> Checkstyle can report warnings like:
> >>>> 
> >>>> '+' should be on the previous line.
> >>>> 
> >>>> FWIW, I'm not fond of this particular checkstyle rule.
> >>>> 
> >>>> Does anyone know if the Eclipse formatter can be made to behave like
this?
> >>>> I've not found such setting in the giant formatter options dialog. I
am on
> >>>> Eclipse 3.7.2. Are there any 4.x users out there? If so, does 4.x deal
with
> >>>> this?
> >>>> 
> >>>> Thank you,
> >>>> Gary
> >>>> 
> >>> 
> >>> 
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >>> For additional commands, e-mail: dev-help@commons.apache.org
> >>> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: dev-help@commons.apache.org
> >> 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message