Always write code with the knowledge that others will be reading it now and in the future:
errorType
makes a hell of a lot more sense than et
.When you write code with a team, simple beats clever, every time. If your clever trick requires an explanatory comment that is longer than the code itself, consider simplifying it so it’s easier to read, understand, and maintain.
Set your editor to the following settings to avoid common code inconsistencies and dirty diffs:
Consider documenting and applying these preferences to your project's .editorconfig
file. For an example, see the one in Bootstrap. Learn more about EditorConfig.
The rules in this guide, once agreed upon by your team, can and should be referred to and cited in code reviews.
Also consider setting up code linters in your test suite to enforce these standards, to reduce the pain of instilling good citizenship and keeping the code clean.