Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aDD3l-0003cA-6R for pgsql-jdbc@arkaria.postgresql.org; Sun, 27 Dec 2015 15:16:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aDD3k-00037r-Oh for pgsql-jdbc@arkaria.postgresql.org; Sun, 27 Dec 2015 15:16:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDD3j-00037Y-4e for pgsql-jdbc@postgresql.org; Sun, 27 Dec 2015 15:16:35 +0000 Received: from smtprelay03.ispgateway.de ([80.67.31.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDD3a-0002AS-6a for pgsql-jdbc@postgresql.org; Sun, 27 Dec 2015 15:16:34 +0000 Received: from [88.66.15.213] (helo=Zauselmaus) by smtprelay03.ispgateway.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from ) id 1aDD27-00033N-5r; Sun, 27 Dec 2015 16:14:55 +0100 From: "Markus KARG" To: "'Vladimir Sitnikov'" , "'Gavin Flower'" , "'Dave Cramer'" Cc: "'List'" References: <062c01d14031$c4f01aa0$4ed04fe0$@eu> <567FEF32.9010300@archidevsys.co.nz> <567FF2A3.8060003@archidevsys.co.nz> In-Reply-To: Subject: Re: PgJDBC: code reformat Date: Sun, 27 Dec 2015 16:16:23 +0100 Organization: Markus KARG, Staatl. gepr. Inf. Message-ID: <064101d140b9$8cf3f260$a6dbd720$@eu> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdFAt4euU8aOxsSHQVOOdXueLw4+CAAAc4xg Content-Language: de X-AVK-Virus-Check: AVA 25.4584;60149F5 X-AVK-Spam-Check: 1; str=0001.0A0C0205.568000C5.00C7,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0; F1206 X-Df-Sender: bWFya3VzQGhlYWRjcmFzaGluZy5ldQ== 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 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 produce= s a style a do not like much. -Markus -----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 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/197175039068446a15c30d2b5e949f1eae085= 15d/pgjdbc/src/main/java/org/postgresql/hostchooser/HostRequirement.java#L1= 6-L29 I have just two requirements: 1) IDEA's autoformat should be able to produce the desired style (minimal m= odifications are bearable) 2) The style should be enforced, in other words, checkstyle (or whatever to= ols 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 sugge= st how to fix checkstyle errors? For instance: /home/travis/build/pgjdbc/pgjdbc/pgjdbc/src/main/java/org/postgresql/jdbc/P= gResultSet.java:2439: error: 'object def lcurly' have incorrect indentation level 6, expected lev= el should be one of the following: 2, 4. https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae085= 15d/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/197175039068446a15c30d2b5e949f1eae085= 15d/pgjdbc/src/main/java/org/postgresql/Driver.java#L353-L373 There are probably better ways of writing that, but those "new lines for op= ening 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 writ= ten code" with "reformat code" approach. That just does not work. Compare this one: https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d2b5e949f1eae085= 15d/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2462-L2512 with this one: https://github.com/pgjdbc/pgjdbc/blob/197175039068446a15c30d= 2b5e949f1eae08515d/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecuto= rImpl.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 form= at the braces. I believe, "readability" comes from proper segmentation (code blocks vs met= hods) and proper variable naming. Vladimir --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc