hamcrest / JavaHamcrest

Java (and original) version of Hamcrest
http://hamcrest.org/
BSD 3-Clause "New" or "Revised" License
2.11k stars 378 forks source link

Introduce a consistent Code style #295

Open alb-i986 opened 4 years ago

alb-i986 commented 4 years ago

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.

sf105 commented 4 years ago

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?

brownian-motion commented 4 years ago

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.

alb-i986 commented 4 years ago

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?

brownian-motion commented 4 years ago

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.

alb-i986 commented 4 years ago

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.