Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[che-dev] Che developers formatting rules for Java

I'd like to come up with some discussion we hard during reviews: https://github.com/eclipse/che/pull/4556/files/ba9e3984575c49f8f39a56db1df2e07b53786b3e#diff-ab312e4ea4cd0eee68fe53472bab93e1 

1. What tool to use to format code in Java ?
2. Usage of // to force Carriage return in some case

# 1. Some are using Intellij, the others Eclipse IDE and some others are using Eclipse Che as IDE.
For me, it makes sense to have a common formatter tool whatever the IDE we are using. It may also work from the command line and should be opensource. It should be possible to format part of the file. It should support Java files at least.
At the moment I use Che to code on Che so if someone has a formatter tool that meets all the previous requirements, I can take it ... otherwise if there isn't such a tool we should all use Che formatter to format our code :)

# 2. Usage of // to force Carriage return in some case
I had some questions about trailling // that I use to force cariage return when the formatter doesn't want to. The purpose is to avoid someone else that run a formatter to loose the carriage return that was there originally. I think this is the choice of the developer to make the code easier to read and to choose wether a line of code should be break into 2 line of code or not. Pretty much like when we add \ at the end of a bash script or Dockerfile.

--
Sun Tan
Senior Software Engineer
Eclipse Che @ Red Hat

Back to the top