DEV Community

Discussion on: How to make code reviews developer-conflict free?

Collapse
 
matthewbdaly profile image
Matthew Daly

I think coding standards should probably fall outside the scope of code reviews. I would be inclined to do the following:

  • Have everyone discuss and agree a consistent coding standard for each language you use, ideally an industry standard one like PEP8 or PSR2/12
  • Set up linting and code quality tools on your projects to enforce those standards, and where possible automate correcting them (Things like ESLint and PHP CodeSniffer will do this), and provide feedback in editors and IDEs
  • Consider setting up continuous integration to catch these issues and report them

That way, no-one has an excuse. You've all agreed to abide by the coding standard, and after the initial on-boarding everyone will start to appreciate the benefits of consistent code styles. If someone isn't co-operating you can say "Bob, we all agreed to abide by these coding standards", and that should be the end of the matter. You can also then start to add other automated tools to the mix, such as static analysis, copy-paste detection, and so on.

The great benefit about automated tools for these kinds of things is that there's no judgement - it's just presenting these issues factually so it's less likely someone's ego will get in the way.