Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Coding Standard

Wlad edited this page Dec 19, 2020 · 2 revisions

Google Java Style (⚠️ WIP)

⚠️ This is not deployed to develop yet!

This project is following Google Java Style Guide by utilizing the open source projects google-java-format and git-code-format-maven-plugin.

As a result any developer machine will automatically get the latest version of google-java-format tool as well as a pre-commit hook deployed which will format all staged changes before each commit. That said, in the unlikely case of code that does not comply with Google Java Style being pushed to remote the CI build will break pointing out the files which violate expected code style.

What do I have to do to set up my dev machine?

Not much 😉 All you have to do is to git clone this repository and to do an initial build.

git clone https://github.com/ehrbase/fhir-bridge.git
cd fhir-bridge
mvn clean install

This will deploy google-java-format code formatter as a pre-commit git hook and after that on any commit, the hook will automatically format staged java files. For more details check the plugin's README.

How do I recognize a CI build fail due to code style violation?

Since the maven plugin enforces deployment of a pre-commit hook that will format staged files automatically on every developer's machine it is very unlikely that you'll see this happen. But in case it happens the CI job BUILD FHIR-BRIDGE will output an error message similar to this one 👇 :

[INFO] --- git-code-format-maven-plugin:3.0:validate-code-format (default-cli) @ fhir-bridge ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.703 s
[INFO] Finished at: 2020-12-19T23:13:11+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.cosium.code:git-code-format-maven-plugin:3.0:validate-code-format (default-cli)
on project fhir-bridge:
.../fhir-bridge/src/main/java/org/ehrbase/fhirbridge/ehr/converter/BodyHeightCompositionConverter.java
is not correctly formatted ! -> [Help 1]
[ERROR] 

Other Frequently Asked Questions

Head over to plugin's README

Help, I'm using Eclipse!

Normally I'd say: selbst schuld! But I'll fast forward you to this stackoverflow answer

Clone this wiki locally