Skip to main content

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

Still would be nice to know what's wrong. It's like good old Dick Cheney said: "I don't know when, I don't know where, but they're out there, and they're planning evil!" No need to potentially process thousands of files when a single one would suffice.

/Thomas


On 08/21/2017 12:46 PM, Sergii Kabashniuk wrote:
It's not that hard.
you just need to call mvn fmt:format.

On Mon, Aug 21, 2017 at 1:37 PM, Thomas Mäder <tmader@xxxxxxxxxx> wrote:
Having rebased this morning, I'm trying to do a full build, it fails for formatting reasons:

[INFO] --- fmt-maven-plugin:1.8.0:check (default) @ ls-java-agent ---
[warn] Test source directory '/home/thomas/development/git/chedev/che/agents/ls-java/src/test/java' does not exist, ignoring.
[error] Found 1 non-complying files, failing build (validateOnly is true)

Without knowing which file is failing, it's hard to fix :-(

/Thomas



On 08/19/2017 11:25 AM, Sergii Kabashniuk wrote:
Hello
I've just merged this PRs related that applies Google Java code-style



A couple of useful links:

Here you can find configuration for different editors https://github.com/google/styleguide
Here https://github.com/google/google-java-format you can find a java tool for code formatting.
Here you can find maven plugin to format code with maven https://github.com/coveo/fmt-maven-plugin

Please note if some tool provide some unexpected result - then maven plugin result is the last 
"Single source of truth". The project would not build if maven plugin will note an error.
If you want to ask plugin to format your code please run "mvn license:format fmt:format"


On Sat, Aug 12, 2017 at 12:24 PM, Gennady Azarenkov <gazarenk@xxxxxxxxxx> wrote:
Good job, thanks

On Fri, Aug 11, 2017 at 2:43 PM, Sergii Kabashniuk <skabashn@xxxxxxxxxx> wrote:
Hello, folks.
CQ has been approved.
It means that at the beginning of the next week I will merge PRs listed above.
Don't hesitate to ask any questions if you have.


On Wed, Aug 2, 2017 at 5:44 PM, Sergii Kabashniuk <skabashn@xxxxxxxxxx> wrote:
Hello
I think we are very close in adoption of Google Java coding standards in Eclipse Che


We are waiting for CQ approval from Eclipse Che IP team https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13960.
As soon as it will be approved we will start merging process.

Here you can find configuration for different editors https://github.com/google/styleguide
Here https://github.com/google/google-java-format you can find a java tool for code formatting.
Here you can find maven plugin to format code with maven https://github.com/coveo/fmt-maven-plugin

Please note if some tool provide some unexpected result - then maven plugin result is the last 
"Single source of truth". The project would not build if maven plugin will notes an error.
If you want to ask plugin to format your code please run "mvn license:format fmt:format"



On Tue, Aug 1, 2017 at 10:02 AM, Sergii Kabashniuk <skabashnyuk@xxxxxxxxxxx> wrote:
FYI this is a steps what we are going to adapt for Eclipse Che Java source code

On Wed, Apr 12, 2017 at 11:34 PM, Alexander Garagatyi <agaragatyi@xxxxxxxxxxx> wrote:
Yes I meant trying #5 and 6.
Thank you, Florent, for pointing out.

--
Codenvy | Alexander Garagatyi | Software Engineer | agaragatyi@xxxxxxxxxxx

12 апр 2017 г. 11:08 PM пользователь "Florent Benoit" <fbenoit@xxxxxxxxxxx> написал:

@Alexander

It seems there is an issue on your last sentence on #7 as it seems you don't like it but wanted to try it ? I suppose it was for #5 ?

Le 12 avr. 2017 9:59 PM, "Alexander Garagatyi" <agaragatyi@xxxxxxxxxxx> a écrit :
I’m confused a bit. That Google’s repo contains several entities. Which of them are suggested for usage? In which cases?
Here are variants, that we can use (one or several):
1. Declare change in formatter for source code of Che.
2. Reformat Che codebase.
3. Embed formatter into Eclipse Che editor as default.
4. Add tool into the mvn build that would allow a dev to reformat code on demand. We have similar tool for fixing license headers and sorting pom.xml files. 
Note that it won’t be aplied by default on build to not change sources unwillingly. 
5. Add tool into the build that fails build in case code is not correctly formatted. 
6. As in #5 but don’t enable by default in build and enable it in PRs CI.
7. Add tool into the build that automatically reformats code on each build.

Personally I would apply #1, 2, 3, 4 for sure. I don’t like #7 option. And would try #6 and 7 to see how stable and fast they are.


Alexander Garagatyi | Software Engineer | agaragatyi@​codenvy.​com








On Apr 12, 2017, at 3:07 PM, Gennady Azarenkov <gazarenkov@xxxxxxxxxxx> wrote:

Looks good, i think we can discuss for a bit the rules itself (supposedly they are good enough) and apply with minimal effort, afaik che formatter uses eclipse, am i right.
Thoughts?

On Wed, Apr 12, 2017 at 10:42 AM Sun Tan <sutan@xxxxxxxxxx> wrote:
I've found that https://github.com/google/google-java-format could be easily integrated to Che

Le mer. 29 mars 2017 à 15:28, Gennady Azarenkov <gazarenkov@xxxxxxxxxxx> a écrit :

Gennady Azarenkov - @ codenvy.com


On Wed, Mar 29, 2017 at 4:24 PM, Sun Tan <sutan@xxxxxxxxxx> wrote:
But (unfortunately :)) we can not require every one to use exclusively Che IDE neither are able to provide formatters to all existed code editors/tools.

We can at least require every che committers to use most of the time Eclipse Che IDE. If we can not do it, how can we convince other developers to use Che ?

Yes of course! but it is a little bit diff topic ;)
 

 
Hi Thomas,

There are no doubts about default formatting in our IDE which is naturally valid for Che's code. We actually have it (so far non-configurable).
But (unfortunately :)) we can not require every one to use exclusively Che IDE neither are able to provide formatters to all existed code editors/tools.

That's why I think we need reasonable small list of "must have" formatting rules (good enough to most of us) and implementable by any tool relatively easy. 

Gennady Azarenkov - @ codenvy.com


On Wed, Mar 29, 2017 at 3:37 PM, Thomas Mäder <tmader@xxxxxxxxxx> wrote:

Hi folks,

Ah...the beast of the programming apocalypse rears is its ugly head: code formatting discussions. The end must be nigh! In my many travels, I have learned that life is too short to format code by hand. From this spring two options I find acceptable:

1. Format automatically upon save, check-in, whatever. Nobody gets to do their own formatting.

2. Give me a format command in the IDE. Everyone is free to use the formatting command on everyone elses code.

I really don't give a hoot what code formatting rules we use as long as they are automatic. I would even argue that we DON'T make up our own rules. Just use someone preexisting set. JDK, Eclipse, whatever. Just don't make me work on formatting files.

/Thomas

PS: Repent! Repent!
PPS: Except opening braces on a new line. That's just horrible ;-)


On 29.03.2017 10:51, Sun Tan wrote:
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 :)

...

[Message clipped]  



Back to the top