From: | Kevin Wooten <kdubb(at)me(dot)com> |
---|---|
To: | Markus KARG <markus(at)headcrashing(dot)eu> |
Cc: | Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Dave Cramer <pg(at)fastcrypt(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: PgJDBC: code reformat |
Date: | 2015-12-27 15:20:29 |
Message-ID: | F35672BE-1EEF-4D02-83EC-9395853520E5@me.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I have no dog in this fight… but a helpful hint WRT IDEs is to make a format in Eclipse, export the XML, and check it into the project. Netbeans & IDEA can import the Eclipse format.
Then you're not limited by whatever is included by the IDE.
> On Dec 27, 2015, at 8:16 AM, Markus KARG <markus(at)headcrashing(dot)eu> wrote:
>
> I actually did NOT vote for "braces on new line". In fact I hate that style and always have opening braces on the SAME line. What I actually said was that if we decide for a near-Sun-Style it makes more sense to go with pure-sun-Style instead, as that is built into IDEs already -- even if it produces a style a do not like much.
> -Markus
>
> -----Original Message-----
> From: Vladimir Sitnikov [mailto:sitnikov(dot)vladimir(at)gmail(dot)com]
> Sent: Sonntag, 27. Dezember 2015 16:02
> To: Gavin Flower; Dave Cramer; Markus KARG
> Cc: List
> Subject: Re: [JDBC] PgJDBC: code reformat
>
> I did try reformatting with "opening braces on new line".
> It turned out it is incompatible with checkstyle:
> https://travis-ci.org/pgjdbc/pgjdbc/jobs/98976190
>
> There are 17 "... have incorrect indentation level" failures.
> Most of which are due to enum initialization in
> https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae08515d/pgjdbc/src/main/java/org/postgresql/hostchooser/HostRequirement.java#L16-L29
>
> I have just two requirements:
> 1) IDEA's autoformat should be able to produce the desired style (minimal modifications are bearable)
> 2) The style should be enforced, in other words, checkstyle (or whatever tools is used) should be able to catch most of the styling issues.
>
> As Garvin/Dave/Markus vote for "braces on new line", would you please suggest how to fix checkstyle errors?
> For instance:
> /home/travis/build/pgjdbc/pgjdbc/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java:2439:
> error: 'object def lcurly' have incorrect indentation level 6, expected level should be one of the following: 2, 4.
> https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae08515d/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2439
>
>
> PS.
> I do not care where the braces are.
> However, this makes me cry:
> https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae08515d/pgjdbc/src/main/java/org/postgresql/Driver.java#L353-L373
> There are probably better ways of writing that, but those "new lines for opening brackets" make it much worse.
>
>
> PPS.
>> The other style looks cluttered, and is harder to see
>
> Gavin,
> I feel your pain, however I still think you are trying to solve "badly written code" with "reformat code" approach.
> That just does not work.
>
> Compare this one:
> https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae08515d/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2462-L2512
> with this one: https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae08515d/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L264-L311
>
> Do you see how QueryExecutorImpl.java#L264-L311 is much readable?
>
> PgResultSet#getFastLong is very hard to follow no matter which way you format the braces.
> I believe, "readability" comes from proper segmentation (code blocks vs methods) and proper variable naming.
>
> Vladimir
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
From | Date | Subject | |
---|---|---|---|
Next Message | Vladimir Sitnikov | 2015-12-27 15:30:11 | Re: PgJDBC: code reformat |
Previous Message | Markus KARG | 2015-12-27 15:16:23 | Re: PgJDBC: code reformat |