fest-assert-2.x icon indicating copy to clipboard operation
fest-assert-2.x copied to clipboard

Ensure code in master branch follows coding standards and formatting

Open ansgarkonermann opened this issue 13 years ago • 8 comments

Found org.fest.assertions.internal.Arrays#assertHasSameSizeAs()

No formatting applied at all.

Goal:

  • define at least formatting rules
  • apply them automatically before each commit
  • don't accept code which does not follow formatting rules (no pull)

Ideally, we should have some coding standards, too (not only mere formatting)

ansgarkonermann avatar Jul 02 '12 23:07 ansgarkonermann

agreed, we have a contributor guide in the github wiki with eclipse formatting rules (that we may update btw) we miss the idea formatting rules.

joel-costigliola avatar Jul 03 '12 07:07 joel-costigliola

you could give these IntelliJ Idea settings (code style only) a try: https://docs.google.com/open?id=0BykO0Q46iG-mWVBaNjlvZnJnTFU They are based on the current sources, but as expected they don't exactly fit. Expecially a rule regarding whitespaces at line ends would be necessary in Eclipse, but there are some other details missing.

gesellix avatar Jul 03 '12 16:07 gesellix

I have added your file in github and mentioned it in the contributor guide. It is here : https://github.com/alexruiz/fest-assert-2.x/blob/master/src/formatters/fest-idea-formatter.xml

thanks !

joel-costigliola avatar Jul 03 '12 18:07 joel-costigliola

"Son of external code formatter" is an IntelliJ IDEA Plugin capable of re-using Eclipse Code Formatter to do code formatting in IDEA.

We could:

  • define code style in Eclipse (it's the "master" for code style)
  • have IDEA format code by using the plugin + exported code style of eclipse

This way, the formatting in Eclipse and IDEA should be exactly the same. This should be tested a bit IMHO.

ansgarkonermann avatar Jul 06 '12 10:07 ansgarkonermann

Seems fine to me !

joel-costigliola avatar Jul 06 '12 14:07 joel-costigliola

As Ansgar already mentioned, the reference code style could be applied automatically on each commit. Addionally, I would suggest to apply the code style on all repositories once now, so that we can be sure that the upstream repos with their master branches are clean and patches from other contributors can safely use the provided code formats.

gesellix avatar Jul 06 '12 19:07 gesellix

I agree with that, this is something I should have done long time ago, before we start having contribution again.

The fest assert 2.x codebase has different formatting standard than the 1.x but only Alex had the 2.x formatting preferences and as he was not available when I started to contribute on the 2.x so I kept using the 1.x format which is the one that is committed.

Anyway, unless Ansgar disagree, I will format all the code this week.

joel-costigliola avatar Jul 07 '12 08:07 joel-costigliola

You should look into the maven-checkstyle-plugin. It will fail the build on poorly (or incorrectly) formatted code. Combine this with services like CloudBees' BuildHive and you'll get comments on new pull requests with whether or not they build successfully.

JakeWharton avatar Jul 07 '12 08:07 JakeWharton