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

Put code style settings for IntelliJ IDEA under version control #426

Open
peterdemaeyer opened this issue Apr 27, 2012 · 20 comments
Open

Put code style settings for IntelliJ IDEA under version control #426

peterdemaeyer opened this issue Apr 27, 2012 · 20 comments

Comments

@peterdemaeyer
Copy link
Contributor

It would be convenient to enforce code style conventions (like imports) by committing them as Eclipse 'project specific settings' into the VCS. The Eclipse project settings are already under version control anyway. That way, new and unwary developers that wish to contribute to the project automatically use the correct code style.

@awulder
Copy link

awulder commented Aug 18, 2012

I've submitted some pull requests and I've noticed that the code style is very inconsistent. For example the use of curly brackets, indenting and some other things. I see code style as part of code qualtiy. Is it possible that the JUnit team commits the code style settings to keep the quality high?

@dsaff
Copy link
Member

dsaff commented Aug 20, 2012

The formatting settings are already committed for Eclipse users:

https://github.com/KentBeck/junit/blob/master/.settings/org.eclipse.jdt.core.prefs

Do you think we should require submitters to import the project to Eclipse for formatting? I could certainly go along with that.

@awulder
Copy link

awulder commented Aug 20, 2012

I've overlooked the Eclipse file :) I use Intellij IDEA. Is it an option to commit the a formatting file for Intellij IDEA as well?
I think you should require submitters to use the formatting file to keep the code style conistent.

@dsaff
Copy link
Member

dsaff commented Aug 20, 2012

I think it could be really useful if someone took a look at the style of especially most of the junit.framework classes, and found formatter settings for IDEA that would maintain them. I'd be happy to accept such a patch.

@awulder
Copy link

awulder commented Aug 20, 2012

I will see what I can do

@awulder
Copy link

awulder commented Aug 21, 2012

Is it possible to change the code style a bit like the missing space before the equal sign?

@dsaff
Copy link
Member

dsaff commented Aug 21, 2012

Arjan,

Yes, I'd be open to that (the current style is, I believe, an amalgam between IBM Java style and SmallTalk.) But I'd want to update all the code to the new style at once, which would be quite an undertaking.

@awulder
Copy link

awulder commented Aug 21, 2012

I understand that you want to update all the code at once but I think that with the IDE nowadays that it isn't a problem.
Maybe we can use the standard sun coding conventions and add checkstyle to the Ant build file that checks the code?

@dsaff
Copy link
Member

dsaff commented Aug 21, 2012

I'm not sure what you mean by "isn't a problem". If we adjust the formatting rules without also bringing the code into line, we'll end up with a situation where > 50% of the lines in each change are just adjusting whitespace, which is hard to review.

@awulder
Copy link

awulder commented Aug 21, 2012

What I actually mean is that it's easy with the modern IDE's the apply a (new) coding style to a whole project. So reformatting the current code base is not difficult.

@dsaff
Copy link
Member

dsaff commented Aug 21, 2012

Got it. Is it easy enough to try the Sun coding conventions, issue a pull
request, and let me see if anything looks off? Thanks,

David Saff

On Tue, Aug 21, 2012 at 4:27 PM, Arjan [email protected] wrote:

What I actually mean is that it's easy with the modern IDE's the apply a
(new) coding style to a whole project. So reformatting the current code
base is not difficult.


Reply to this email directly or view it on GitHubhttps://github.com/KentBeck/junit/issues/426#issuecomment-7914890.

@awulder
Copy link

awulder commented Aug 21, 2012

I reformatted the code (indenting, use of curly braces, use of whitespace) and then I ran Checkstyle with the sun_checks.xml configuration file. There are 3342 violations. A lot of line length and javadoc style violations. There are also al lot of warnings about parameters that should be final.

Before submitting a pull request I think it must be clear how to deal with these violations. One approach is to modify the sun_checks.xml file to disable the checks that are irrelevant to the JUnit team or another approach can be to deal with all these warnings. I would actually have choosen the first approach.

Or just leave out the checkstyle check :)

awulder pushed a commit to awulder/junit that referenced this issue Aug 22, 2012
Reformatted the code base for an consistent coding/formatting style
awulder pushed a commit to awulder/junit that referenced this issue Sep 8, 2012
Issue junit-team#426 Description of the coding style
awulder pushed a commit to awulder/junit that referenced this issue Sep 12, 2012
Issue junit-team#426 Removed confusing whitespaces.
awulder pushed a commit to awulder/junit that referenced this issue Sep 13, 2012
Removed the Markdown syntax, changed import order and removed confusing
Maximum Blank Lines section.
awulder pushed a commit to awulder/junit that referenced this issue Sep 27, 2012
- Do not align JavaDoc parameter description
- Removed "Keep empty .. JavaDoc tag"
- corrected typp
dsaff pushed a commit that referenced this issue Oct 4, 2012
issue #426 Description of the coding style
awulder pushed a commit to awulder/junit that referenced this issue Oct 4, 2012
Applied the new coding style to the code base for issue junit-team#426.
@marcphilipp
Copy link
Member

Fixed by #522.

@dsaff
Copy link
Member

dsaff commented Oct 24, 2012

Arjan,

Do you currently have an Eclipse formatter settings file that we can check in to help others who want to follow this style? Thanks.

@marcphilipp
Copy link
Member

Oops, sorry, I thought those were committed in #522. Reopening the issue...

@marcphilipp marcphilipp reopened this Oct 24, 2012
@marcphilipp
Copy link
Member

@awulder Ping!

@awulder
Copy link

awulder commented Nov 14, 2012

@marcphilipp I've been very busy lately. I don't use Eclipse but I will commit the formatter setting for Eclipse and Intellij IDEA.

@marcphilipp
Copy link
Member

@awulder Sounds good! If you don't find enough time, please let us know. It would be great to finally make formatting a non-issue in pull requests.

@marcphilipp
Copy link
Member

@awulder Have you started to work on this or should someone else take over?

@Tibor17
Copy link
Contributor

Tibor17 commented Jan 23, 2013

Does anybody have a spare time to check the *.prefs files in .settings folder if matching the CODING_STYLE?
Possibly update it.
Thx.

@kcooney kcooney changed the title Put code style settings under version control Put code style settings for IntelliJ IDEA under version control Jul 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants