pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Markus KARG <markus@headcrashing.eu>
To: 'Vladimir Sitnikov' <sitnikov.vladimir@gmail.com>
To: 'Gavin Flower' <GavinFlower@archidevsys.co.nz>
To: 'Dave Cramer' <pg@fastcrypt.com>
Cc: 'List' <pgsql-jdbc@postgresql.org>
Subject: Re: PgJDBC: code reformat
Date: Sun, 27 Dec 2015 16:16:23 +0100
Message-ID: <064101d140b9$8cf3f260$a6dbd720$@eu> (raw )
In-Reply-To: <CAB=Je-He4RtXP-m2vkD9KKm+vPwFY7y3M-z_cKtmho=tExiJmg@mail.gmail.com >
References: <CAB=Je-F1PtJ1Dbsswr=oaj2z8KYpZANHW_kLc2y5DuzjpAJqeQ@mail.gmail.com >
<062c01d14031$c4f01aa0$4ed04fe0$@eu >
<CAB=Je-GTY_09RLYOA9FgoydadEyiGD+ea+xvDqt7J0ijYnqPfg@mail.gmail.com >
<CADK3HHLGRSzbWnbkwixGz2dregiBJJMSBtA9NaUt3eYC8RZ+cA@mail.gmail.com >
<567FEF32.9010300@archidevsys.co.nz >
<CADK3HHLD3aAWcEPtUXVCxDrLzENvpAGbqC__dYfzrKEz1wh2VA@mail.gmail.com >
<567FF2A3.8060003@archidevsys.co.nz >
<CAB=Je-He4RtXP-m2vkD9KKm+vPwFY7y3M-z_cKtmho=tExiJmg@mail.gmail.com >
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
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.vladimir@gmail.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/...
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/...
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/...
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/...
with this one: https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae08515d/pgjdbc/src/main/java/...
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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
view thread (33+ messages) latest in thread
Message-ID: <064101d140b9$8cf3f260$a6dbd720$@eu>
Permalink: ../064101d140b9$8cf3f260$a6dbd720$@eu/
Also on: postgresql.org/message-id/064101d140b9$8cf3f260$a6dbd720$@eu
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: markus@headcrashing.eu, sitnikov.vladimir@gmail.com, GavinFlower@archidevsys.co.nz, pg@fastcrypt.com
Subject: Re: PgJDBC: code reformat
In-Reply-To: <064101d140b9$8cf3f260$a6dbd720$@eu>
References: <CAB=Je-F1PtJ1Dbsswr=oaj2z8KYpZANHW_kLc2y5DuzjpAJqeQ@mail.gmail.com> <062c01d14031$c4f01aa0$4ed04fe0$@eu> <CAB=Je-GTY_09RLYOA9FgoydadEyiGD+ea+xvDqt7J0ijYnqPfg@mail.gmail.com> <CADK3HHLGRSzbWnbkwixGz2dregiBJJMSBtA9NaUt3eYC8RZ+cA@mail.gmail.com> <567FEF32.9010300@archidevsys.co.nz> <CADK3HHLD3aAWcEPtUXVCxDrLzENvpAGbqC__dYfzrKEz1wh2VA@mail.gmail.com> <567FF2A3.8060003@archidevsys.co.nz> <CAB=Je-He4RtXP-m2vkD9KKm+vPwFY7y3M-z_cKtmho=tExiJmg@mail.gmail.com> <064101d140b9$8cf3f260$a6dbd720$@eu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox