hamcrest / JavaHamcrest

Java (and original) version of Hamcrest

Home Page:http://hamcrest.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduce a consistent Code style

alb-i986 opened this issue · comments

While working on #294 I noticed there's a bit of a mess from a code style point of view.
See e.g. IsCollectionWithSize: there's a mix of tabs with 2 spaces and others with 4 spaces.

That's unfortunate. My preference is for 2 spaces (I like to conserve horizontal line space). This is not just the thing about initial indentation vs further indentation?

If it is simply an indentation concern, then I think it's straightforward to address that using CheckStyle to assist with a consistent code style. I've opened up a PR which adds such a rule.

Yes, thanks @brownian-motion, that's what I meant.
Shall we go a little further and provide a code style settings so that everyone is on the same page and up & running in few secs?

I like this idea, but I'm only familiar with a small set of style settings. I know IntelliJ can import code style from CheckStyle, can Eclipse or other IDEs do the same? If all can, it may be simple enough to define a CheckStyle file.

I don't know, but if we want to keep it simple, we may just use Google's styles: they are using 2 spaces anyways.
https://github.com/google/styleguide
They provide both for Eclipse and Intellij.