LibrePDF / OpenPDF

OpenPDF is a free Java library for creating and editing PDF files, with a LGPL and MPL open source license. OpenPDF is based on a fork of iText. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository.
Other
3.5k stars 581 forks source link

Code Convention and Style Guide #283

Open asturio opened 4 years ago

asturio commented 4 years ago

OpenPDF had till 2019-10-12 no Coding Convention or Style guide. And the formatting of the code is really a mess.

So from now on, please use our Style Guide for Java code. This is a very short modification of the Google Guide for Java code: https://google.github.io/styleguide/javaguide.html

The differences are only: Indentation by 4 spaces, Continuation by 8 spaces. This way there should be not much reformatting in the project.

For IntelliJ: https://github.com/LibrePDF/OpenPDF/blob/master/intellij-java-openpdf-style.xml For Eclipse: Help wanted

sixdouglas commented 4 years ago

@asturio: what kind of help do you want on this issue? Creating the Eclipse settings file? Or more than that? Like running these settings on the master and submit a PR?

asturio commented 4 years ago

@asturio: what kind of help do you want on this issue? Creating the Eclipse settings file? Or more than that? Like running these settings on the master and submit a PR?

An Eclipse file would be nice, the first step. Then we could add some more rules to checkstyle, but only one at time, so there will be no overwhelming warnings.

I think the curly braces rule and the indentation should be the first one, as these are the more significant rules, I think.

asturio commented 6 months ago

Little Update:

I'm going to reformat all the code, to follow the convention, and turn on some checkstyles to catch any violations.