commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [CONFIGURATION] Formatting braces
Date Wed, 11 Sep 2019 14:43:59 GMT
On Wed, 11 Sep 2019 at 15:15, Gary Gregory <garydgregory@gmail.com> wrote:
>
> On Wed, Sep 11, 2019 at 10:12 AM Gilles Sadowski <gilleseran@gmail.com>
> wrote:
>
> > Hello.
> >
> > +1
> >
> > Le mer. 11 sept. 2019 à 15:54, Gary Gregory <garydgregory@gmail.com> a
> > écrit :
> > >
> > > Hi All:
> > >
> > > I only hope that this will not turn into a bike shedding thread...
> >
> > A uniform coding style (for all components); that *seems* obvious (too)...
> >
>
> Well, yes, it would be nice to share Checkstyle, SpotBugs, and PMD
> configurations but I am only taking one small manageable step here.

+1 in this case; separate lines don't make sense for lambdas

> Gary
>
>
> > Gilles
> >
> > >
> > > Commons Configuration is one of the few components we have that uses the
> > > formatting rule (enforced by Checkstyle) where braces must be on separate
> > > lines. In the age of lambdas, this is, IMO, lame (a technical term ;-)
> > for
> > > example:
> > >
> > >     public static final ConfigurationConsumer<ConfigurationException>
> > > DEFAULT_INCLUDE_LISTENER = e ->
> > >     {
> > >         throw e;
> > >     };
> > >
> > >     public static final ConfigurationConsumer<ConfigurationException>
> > > NOOP_INCLUDE_LISTENER = e ->
> > >     {
> > >         // noop
> > >     };
> > >
> > > Instead of:
> > >
> > >     public static final ConfigurationConsumer<ConfigurationException>
> > > DEFAULT_INCLUDE_LISTENER = e -> { throw e; };
> > >
> > >     public static final ConfigurationConsumer<ConfigurationException>
> > > NOOP_INCLUDE_LISTENER = e -> { /* noop */ };
> > >
> > > I propose a reformatting to use the "{ on the same line" which means that
> > > blocks go from:
> > >
> > > if (test)
> > > {
> > >    // this
> > > }
> > > else
> > > {
> > >   // that
> > > }
> > >
> > > to:
> > >
> > > if (test) {
> > >    // this
> > > } else {
> > >   // that
> > > }
> > >
> > > and so on.
> > >
> > > 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


Mime
View raw message