Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actualize Eclipse Che Java coding standards #5772

Closed
skabashnyuk opened this issue Jul 21, 2017 · 27 comments
Closed

Actualize Eclipse Che Java coding standards #5772

skabashnyuk opened this issue Jul 21, 2017 · 27 comments
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Milestone

Comments

@skabashnyuk
Copy link
Contributor

skabashnyuk commented Jul 21, 2017

The goal of this issues is to revise our existed guidelines
https://github.com/eclipse/che/wiki/Coding-Guidelines and adapt
it to realities and the challenges that we have today.

As for me I can see such problems

  1. Unfortunately, Java has no single format standard like GO lang has and there is no single tool that all have to follow.
  2. Existed document is quite a long read and a bit hard to follow.
    More general: people want that this thing has to work some how, but not to pay a lot of attention to it.
  3. We want some kind of automation that can check if coding standards has followed.
  4. We don't to spend a lot of time to support different tools our format. Like config for Eclipse or config for IntelliJ, etc.

I'm proposing following direction.

  1. We can use Google Java Style Guide https://google.github.io/styleguide/javaguide.html
  2. We can reformat existed code according to new rules.
  3. We can use https://github.com/google/google-java-format https://github.com/coveo/fmt-maven-plugin tool to automate format checking as we have with a license checking.
  4. We can reuse existing configuration of Google formatter for Eclipse IDE, Eclipse Che and IntelliJ
@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

AFAIK we use 4 spaces indent in Java code while google is using 2 spaces indent. Using option 1. will change impact almost all lines of Java files

@skabashnyuk
Copy link
Contributor Author

yes.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

@skabashnyuk could you describe more the yes ?

  • we will use a custom template to avoid that change causing a lot of merging troubles.
  • we will change all codes to stick to google ?

because when I read "we can" it seems to be still an option, not the way to go.

@skabashnyuk
Copy link
Contributor Author

No our plan to use " Google Java Style" as is without modification.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

I didn't see public discussion around the "our plan"

@garagatyi
Copy link

For sure it will impact whole code database. I suppose even without changing indentation from 4 to 2 spaces we will get huge amount of changed lines

@garagatyi
Copy link

Issues and PRs are public and discussion is allowed here

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

This kind of change should be discussed publicly on mailing lists.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

Especially when the word "our" is used while I saw no previous discussion before.

@skabashnyuk
Copy link
Contributor Author

Ok. Guys. The main idea is to not to have any "holly wars" around format and reuse something popular as is without a single modification. Because when we can use some automation like this https://github.com/coveo/fmt-maven-plugin

@benoitf what do you propose?

@garagatyi
Copy link

Nothing is committed yet, so you can drive the discussion now. I don't see a problem here.
I do believe that creation of a PR or issue is allowed without sending a mail to che email list.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

@skabashnyuk my point was more on the process. Informing the community first, grab feedback about expectations of users, propose options, etc. Instead of a list of tasks in a github issue.

@skabashnyuk
Copy link
Contributor Author

10 days is not enough to inform?

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

@skabashnyuk IMHO Informing the community is not creating an issue on github.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

on the question: I mainly see that the proposed solution is only targetting java files. But Eclipse Che "coding standards" is also for other type of files like : XML, TypeScript. I saw nothing on the description about that part while users can contribute to other files than "Java".

I heared in a previous meeting that EditorConfig could be used but I don't see it in the list. (because here it targets only Eclipse IDE, Che and Intellij

@skabashnyuk
Copy link
Contributor Author

yes. You are right. I'll change the scope of this issue to Java only.

@skabashnyuk skabashnyuk changed the title Actualize Eclipse Che coding standards Actualize Eclipse Che Java coding standards Jul 31, 2017
@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

but why isn't it a broader scope that only Java ?

@skabashnyuk
Copy link
Contributor Author

I doubt that this is potentially resolvable in close future. Don't want to take to much at once.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

@skabashnyuk I think including EditorConfig as proposed by others should clearly help supporting not only Java as well as it can address some "classic PR comments" in the Pull Request like missing newline at the end of file, trim of spaces, indent for not only java files and is supported by a wide list of Editors.
This would really help on xml, Dockerfiles, typescript, JSON, etc.

@skabashnyuk
Copy link
Contributor Author

I'm ok with your proposal. Can you do that as a separate issue?

Why separate?

Because one of the core parts is java only [3] https://github.com/google/google-java-format https://github.com/coveo/fmt-maven-plugin without them I think it's almost impossible to guarantee same results on different editors.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

it's a separate Pull Requests but I don't think it should be a fully separate issue as it's still under the same goal "Adopt tools to make contributions/reviews easier around Coding Style" (so more under the same "epic")

BTW EditorConfig is more global than Java. I mean, these are global rules (like indent, space triming) but there is nothing on order of imports (specific to java, etc)
So it's not trying to replace google format but it's an extra check for all other files.

@gazarenkov
Copy link
Contributor

@benoitf we started to discuss it at least 4 months ago, you can check che-dev mail list, thread name is: "Che developers formatting rules for Java" (you took part and it was ended with practically the same resolution), then we discussed it in other places (like mattermost) and have several votes in this issue too. So, it definitely can be considered as "our decision".
I'd prefer "good enough" solution now (community really needs it) and not "presumably perfect" in several years.
Really appreciate @skabashnyuk who took responsibility for this dirty job.

@benoitf
Copy link
Contributor

benoitf commented Jul 31, 2017

@gazarenkov well community should be still informed about steps that will follow a 4 months old discussion.

@benoitf
Copy link
Contributor

benoitf commented Aug 1, 2017

thanks @skabashnyuk for the mail on che-dev

@sunix
Copy link
Contributor

sunix commented Aug 4, 2017

Thanks @skabashnyuk for the mail, I've created #5900 for dog fooding :)

@voievodin
Copy link
Contributor

Make sure https://github.com/eclipse/che/wiki/Coding-Guidelines is removed

@skabashnyuk
Copy link
Contributor Author

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

No branches or pull requests

6 participants