PgJDBC: code reformat - Mailing list pgsql-jdbc

From Vladimir Sitnikov
Subject PgJDBC: code reformat
Date
Msg-id CAB=Je-F1PtJ1Dbsswr=oaj2z8KYpZANHW_kLc2y5DuzjpAJqeQ@mail.gmail.com
Whole thread Raw
Responses Re: PgJDBC: code reformat
List pgsql-jdbc
Hi,

I would like to raise a discussion on coding guidelines.
As discussed, single style is good.

As there are no suggestions, I went ahead and tried "Google style, 100
characters per line".
Here are some of the results: [1], [2], [3]
I've spent ~3 hours to achieve that, notable part of which was
figuring out how to configure checkstyle.

What works:
0) IDEA reformat gives checkstyle-compatible code
1) IDEA checkstyle plugin can show violations
2) mvn checkstyle:check
3) Travis

Please vote:
+1 [ ] The style is wonderful
+0 [ ] It is good enough
-0 [ ] Generally it is ok, but ...
-1 [ ] I do not like it since ...

Google style basically means:
1) K&R Egyptian brackets
2) Line break is inserted _before_ binary operators.
For instance:
   "line 1"
   + "line 2"
3) Every variable should be declared on its own line. In other words,
"int a,b;" is forbidden
4) Certain variable & method naming conventions (<-- I have not yet
looked into this)

My idea is to see how far IDEA can reformat the code to please
checkstyle validator.
I've taken checkstyle configuration from their official sample (see
[5]) and disabled certain checks (the ones that cannot be applied
automatically like variable naming conventions).

There are still some checkstyle warnings (I think they should be
converted to errors): [4]

[1] https://github.com/pgjdbc/pgjdbc/blob/format_code/pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java
[2] https://github.com/pgjdbc/pgjdbc/blob/format_code/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
[3] https://github.com/pgjdbc/pgjdbc/blob/format_code/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
[4] https://travis-ci.org/pgjdbc/pgjdbc/jobs/98907638
[5] https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml

--
Regards,
Vladimir Sitnikov


pgsql-jdbc by date:

Previous
From: Kevin Wooten
Date:
Subject: Re: JDBC and positioned updates
Next
From: "Markus KARG"
Date:
Subject: Re: PgJDBC: code reformat