Coding style¶
Change with diff in mind¶
For better traceability in the VCS history, avoid unnecessary changes just for cosmetics.
Bad Example:
const FOO = "Bar";
const BAZINGA = "default";
The example above would require to adjust the cosmetical indendation for the whole code block if a longer const
was added in a new line. This introduces a change where semantically no real change happened.
Don't mix style changes with functional changes¶
If you adjust the formatting, put it into a dedicated commit to allow later generations see better what happened.
Have a newline at the end of the file¶
For consistency, configure your IDE to always put a newline character at the end of the file.
Crop trailing whitespaces¶
Configure your IDE to crop trailing whitespaces in the code. Make sure to do this only for lines that are changed anyways or you will introduce changed lines only because trailing spaces were cropped.