Re: PgJDBC: code reformat - Mailing list pgsql-jdbc
From | Markus KARG |
---|---|
Subject | Re: PgJDBC: code reformat |
Date | |
Msg-id | 062c01d14031$c4f01aa0$4ed04fe0$@eu Whole thread Raw |
In response to | PgJDBC: code reformat (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>) |
Responses |
Re: PgJDBC: code reformat
|
List | pgsql-jdbc |
-0 [X] I would rather go with Sun style instead of Google style; it is contained in Eclipse as a selectable option, so Idon't have to configure my IDE at all but can rely on auto-format on saving a file. :-) -Markus -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Vladimir Sitnikov Sent: Samstag, 26. Dezember 2015 22:41 To: List Subject: [JDBC] PgJDBC: code reformat 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 howto 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 -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc
pgsql-jdbc by date: