How to deal with developers who lack standards?
How do you deal with developers that don't comment their code? They're fully aware that they should and that it's the decent thing to do or when they update functions and move things around, they actually remove the comments.
Things like PEP8 or PSR-2 mean nothing to them.
I could also mention changing functionality, but not making sure that the tests are updated.
14 comments
[ 4.5 ms ] story [ 44.5 ms ] threadUse hooks to check quality automatically on your repos and/or CI server. Change the environment so a developer can't push code unless linting and tests pass. If you configure the remote to use receive.denyNonFastForwards they won't even be able to use --force. Then add linting rules so you have to comment things (eg https://eslint.org/docs/rules/valid-jsdoc). It won't enforce quality, but that comes later once people habitually know to write comments.
Expect a lot of resistance to this sort of solution though.
Maybe the real problem is people writing code that is so hard to understand you need a comment to explain what it does.
- Some algorithms are inherently complex and difficult to understand, so they may actually need comments to explain how they work.
- If code deals with entities in the real world, like bank accounts or car engines, it may be subject to rules that are not obvious just from reading the code. Comments can explain the relationship between the code and the domain the code is operating in.
May be the environment they are working on constricts them. May be they are pushed to deliver ASAP and given no time to think about maintainability because management doesn’t care about technical debt.
If you want higher standards drive it through by giving talks to your team and suggesting a style guideline be adopted to whoever the tech lead and introduce code reviews to ensure this adhered to.
Who knows, maybe they have a legit reason for the behavior. Or maybe they simply did not give it enough thought. Either way, the humane appreach, talking, could help here.
If you don’t fire them even after talking and asking them to change their behavior then stop complaining and accept it as a fact of life.