Automate Your Coding Standard — by Filip van Laenen
Coding standards should make it easier to work on a project, and maintain development speed from the beginning to the end.
It follows, then, that everybody should agree on the coding standard, too — it does not help if one developer uses three spaces to indent code, and another uses four.
There exists a wealth of tools that can be used to produce code quality reports and to document and maintain the coding standards, but that is not the whole solution. It should be automated and enforced by possible. Here are a few examples.
✅Make sure code formatting is part of the build process so that everybody runs it automatically every time they compile the code.
✅Use a static code analysis tool to scan the code for unwanted anti-patterns. If any are found breaking the build.
✅Learn to configure those tools so that you can scan for your own, project-specific anti-pattern.
✅Do not only measure test coverage but automatically check the results, too. Again, break the build if the test coverage is too low.
Try to do this for everything you consider important. Finally, the coding standards should be dynamic, rather than static. As the project evolves, the needs of the project change, and what has seemed smart in the beginning is not necessarily smart a few months later.
Do you agree with this statement? Which automated tools do you use in your projects? Let me know in the comments👉
Happy Coding!
Top comments (0)