Tools that improve team collaboration and code quality

It gets even worse where multiple styles start mixing in the same file.There are many reasons for this situation… They might use different editors, follow different guidelines, have different opinions or just don’t care about code style at all.GuidelinesThat’s usually the time when you start defining common guidelines which is not an easy step..I mean every developer argued at least once in his career or at least witnessed a debate on whether to use tabs or spaces for indentation, right?Once you reach an agreement, you document the project guidelines and everybody starts following them..Not quite..To follow guidelines you have to read and understand them..That’s the first pitfall..Team members that were included in the definition of the guidelines might not have issues to know and follow them, but those that start on the project usually don’t tend to read lengthy documentation and rather start to code right away.Lengthy coding guidelines are often unknown, forgotten or simply ignoredSo somebody in the team has to tediously review each pull request to enforce your guidelines..But guidelines are usually simple rules..Rules is something that can be automatized, right?.Right!LintersLinters are little tools that you can configure according to your guidelines to verify the code for you.You just commit the linter configuration with your code, and they take care of the rest.First you should add your linters as a pre-commit hooks..You can either write your own scripts and have every developer install it as hook on their machine, but that is not something you can enforce.I currently prefer to do it with Husky..Once done, the hooks, should prevent anybody to commit code that doesn’t match your guidelines.Pre-commit hooks hinders developer to commit code that doesn’t match your guidelinesThat’s good news for the reviewer, but might be frustrating for team members that get their commit constantly rejected and have to get back to their code..It would be better if they could be warned about guidelines while writing their code.EditorsGood news, most linters are either included in many IDEs or can be added in form of a plugin.. More details

Leave a Reply