Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aDD8E-0003uL-MP for pgsql-jdbc@arkaria.postgresql.org; Sun, 27 Dec 2015 15:21:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aDD8E-0004JI-9E for pgsql-jdbc@arkaria.postgresql.org; Sun, 27 Dec 2015 15:21:14 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDD7j-0003l7-3A for pgsql-jdbc@postgresql.org; Sun, 27 Dec 2015 15:20:43 +0000 Received: from st11p05im-asmtp002.me.com ([17.172.109.150]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aDD7a-0000IT-CM for pgsql-jdbc@postgresql.org; Sun, 27 Dec 2015 15:20:41 +0000 Received: from [192.168.100.12] (ip70-176-202-56.ph.ph.cox.net [70.176.202.56]) by st11p05im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O0000IYVVY5DA40@st11p05im-asmtp002.me.com> for pgsql-jdbc@postgresql.org; Sun, 27 Dec 2015 15:20:32 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-12-27_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1512270290 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: PgJDBC: code reformat From: Kevin Wooten In-reply-to: <064101d140b9$8cf3f260$a6dbd720$@eu> Date: Sun, 27 Dec 2015 08:20:29 -0700 Cc: Vladimir Sitnikov , Gavin Flower , Dave Cramer , List Content-transfer-encoding: quoted-printable Message-id: References: <062c01d14031$c4f01aa0$4ed04fe0$@eu> <567FEF32.9010300@archidevsys.co.nz> <567FF2A3.8060003@archidevsys.co.nz> <064101d140b9$8cf3f260$a6dbd720$@eu> To: Markus KARG X-Mailer: Apple Mail (2.3112) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org I have no dog in this fight=E2=80=A6 but a helpful hint WRT IDEs is to make= a format in Eclipse, export the XML, and check it into the project. Netbe= ans & 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 wrote: >=20 > I actually did NOT vote for "braces on new line". In fact I hate that sty= le and always have opening braces on the SAME line. What I actually said wa= s that if we decide for a near-Sun-Style it makes more sense to go with pur= e-sun-Style instead, as that is built into IDEs already -- even if it produ= ces a style a do not like much. > -Markus >=20 > -----Original Message----- > From: Vladimir Sitnikov [mailto:sitnikov.vladimir@gmail.com]=20 > Sent: Sonntag, 27. Dezember 2015 16:02 > To: Gavin Flower; Dave Cramer; Markus KARG > Cc: List > Subject: Re: [JDBC] PgJDBC: code reformat >=20 > 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 >=20 > There are 17 "... have incorrect indentation level" failures. > Most of which are due to enum initialization in > https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae0= 8515d/pgjdbc/src/main/java/org/postgresql/hostchooser/HostRequirement.java#= L16-L29 >=20 > 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. >=20 > As Garvin/Dave/Markus vote for "braces on new line", would you please sug= gest 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 l= evel should be one of the following: 2, 4. > https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae0= 8515d/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2439 >=20 >=20 > PS. > I do not care where the braces are. > However, this makes me cry: > https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae0= 8515d/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. >=20 >=20 > PPS. >> The other style looks cluttered, and is harder to see >=20 > Gavin, > I feel your pain, however I still think you are trying to solve "badly wr= itten code" with "reformat code" approach. > That just does not work. >=20 > Compare this one: > https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae0= 8515d/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2462-L2512 > with this one: https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c3= 0d2b5e949f1eae08515d/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecu= torImpl.java#L264-L311 >=20 > Do you see how QueryExecutorImpl.java#L264-L311 is much readable? >=20 > PgResultSet#getFastLong is very hard to follow no matter which way you fo= rmat the braces. > I believe, "readability" comes from proper segmentation (code blocks vs m= ethods) and proper variable naming. >=20 > Vladimir >=20 >=20 >=20 > --=20 > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc