Closed MatMoore closed 4 years ago
https://ncrcoe.gitbooks.io/java-for-small-teams/specifics.html also has some good advice that's a bit more high level than the google style guide, but I didn't think it worth going into that much detail in our guidance, otherwise it will get quite long.
Have moved a lot of that code style into the linting rules page, which cuts down on a lot of duplication.
I spent about half an hour trying to get checkstyle to use built in configuration files, but I couldn't figure out how to make it work with the gradle plugin. According to this post it can be done but I gave up and just documented the method we've got working instead.
This is a first stab at putting together some common guidance for java teams at the MOJ.
It's heavily based on the GDS way guidance.
We've made the following changes:
Promote Google Style Guide as the default format instead of Intellij defaults. I don't think Intellij is a good fit for MOJ because you can't easily apply the same conventions to other IDEs/static analysis tools. We can potentially expand on this to suggest other alternatives, but I think this is a decent starting point and this was the main recommendation I got when I first asked around about coding standards on slack.
Take out the section about dependency injection and web frameworks - this is better suited to the tech menu and MOJ use the spring ecosystem whereas GDS don't
Take out the section about imports, this should be covered by the google style guide
Take out the section about testing, as we have another page for that
Slightly rewrite the section about the JDK. I think this is quite confusing and I want to explicitly recommend going with the latest JDK version unless there's a good reason not to.