SERG-Delft / jpacman-framework

Pacman-inspired game, for teaching testing purposes.
123 stars 254 forks source link

Add checkstyle rules for uniform indentation #113

Closed casperboone closed 7 years ago

casperboone commented 7 years ago

At the moment many variations of indentation are used throughout the project. This PR introduces checkstyle rules to make the type of indentation consistent.

The rules disallow the use of tabs (as done in both Google Java Style as Checkstyle Style), because "Developers should not need to configure the tab width of their text editors in order to be able to read source code." (http://checkstyle.sourceforge.net/config_whitespace.html#FileTabCharacter).

There are also rules for the number of spaces, based on Checkstyle Style and the current state of the project.

In my opinion these are the rules that fit the project best, but that is of course a bit personal. Any other opinions are welcome.

Since this PR is mostly meant as a proposal, it does not yet include the actual style fixes for the rules. Also, the commit for that will be touching a lot of lines, so it will influence currently open PRs or code that people are already working on a lot.

avandeursen commented 7 years ago

Yes, I agree with this as well.

However, I would like to only do this is we also actually make the full code base compliant. So we need to merge all open PRs, do a little code freeze, and then commit the big update.

We should then do the same with JPacman-Template.

Let's first finalize some last open issues, and then deal with this. OK?

avandeursen commented 7 years ago

I actually checked this checkstyle settings file with https://github.com/SERG-Delft/jpacman-template, and it seems it does not require any changes to the code there. So maybe you want to do this PR in that repo? Then all solutions will follow this template?

casperboone commented 7 years ago

Let's first finalize some last open issues, and then deal with this. OK?

Agree, sounds like a good idea.

So maybe you want to do this PR in that repo? Then all solutions will follow this template?

Done, https://github.com/SERG-Delft/jpacman-template/pull/28

TimvdLippe commented 7 years ago

@casperboone Could you add a .editorconfig file with the following configuration:

root = true

[*.java]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4

(based on http://editorconfig.org/)

casperboone commented 7 years ago

@TimvdLippe Done, thanks for the suggestion :).

casperboone commented 7 years ago

All tabs are now replaced with spaces 🎉 .

Also fixed some line length and missing Javadoc warnings, so that there are 0 checkstyle issues left.

avandeursen commented 7 years ago

Awesome, thanks!