Hello again, I’m in a situation where the one the senior devs on my team just isn’t following best practices we laid out in our internal documentation, nor the generally agreed best practices for react; his code works mind you, but as a a team working on a client piece I’m not super comfortable with something so fragile being passed to the client.
He also doesn’t like unit testing and only includes minimal smoke tests, often times he writes his components in ways that will break existing unit tests (there is a caveat that one of the components which is breaking is super fragile; he also led the creation of that one.) But then leaves me to fix it during PR approval.
It’s weird because I literally went through most of the same training in company with him on best practices and TDD, but he just seems to ignore it.
I’m not super comfortable approving his work, but its functional and I don’t want to hold up sprints,but I’m keenly aware that it could make things really messy whenbwe leave and the client begins to handle it on their own.
What are y’alls thoughts on this, is this sort of thing common?
breaks tests
leaves me to fix them during approval
I’m sorry, what? If he broke it, he fixes it. There should be guard rails that prevent him from merging his code until all the tests pass, and you as a reviewer should refuse to even start a code review unless the build is green.
Yup. Nothing wrong with pushing up a draft PR and asking for feedback; but definitely need to be an active participant in fixing the issues, not just expect somebody else to do your work for you.
That does lead to some sticky inter-personal situations though. Like there’s people on my team that I trust enough to just rubber-stamp a PR that looks good but doesn’t have test coverage etc. Can generally trust those people will let me know if the failing tests uncover some substantial work that needs to be re-reviewed.
There’s other people I don’t trust and will insist their build passes before I review it. Once that person notices they’re being held to a different standard, it can be difficult (but necessary) to have a conversation about what they need to change in order to earn that trust.
I don’t understand why you’d be fixing unit tests he broke during his pr. It seems like he might be bullying you? Maybe discuss with your manager.
Unless it was directly caused by some code he wrote earlier that wasn’t caught at the time, he shouldn’t even consider that
I think this is far more common than one would hope. There are many senior developers out there who got their experience in a different time, when test coverage wasn’t important in many businesses. Writing test code is hard and it might be that your teammate simply don’t know how to do it.
If the tests aren’t there at approval time, they will never be there. I think it is perfectly fine to block approval, especially since you all agreed on it.
Yes, it’s common. No, it shouldn’t be tolerated. Your boss/tech lead/whatever should be involved. Here is what should be done ideally:
- not following best practices: you MUST implement merge requests (GitLab, GitHub, etc.) and his code shouldn’t be approved which means that his code won’t ever be merged in a shitty state. Force 1 or 2 approvals for each MR, and it should not be possible to merge an MR if it has open comments. The boss should ask every day “why is your code not merged yet?” and he’ll have to explain why people don’t approve his shitty code.
- shitty unit-tests: same thing, the boss should show him how to do this, and the MR shouldn’t be approved.
- breaking unit-tests: it’s the job of the CI to literally block MRs that break unit-tests (whether it’s code coverage or unit-tests).
- leaves me to fix it during PR approval: NO, it’s HIS merge request, not yours.
To sum it up: devs must not approve his MRs, the CI must block MRs that break tests.
Last point is SO painful… I have a coworker that writes so much shitty code OR it straight up doesn’t work… he once submitted a PR that didn’t work when used! Like, I just started the thing and it was utterly broken - both the implementation and the design.
More so, some of his PRs are a giant nightmare of over engineered crap that he, at some point, doesn’t even understand.
Worst of all, he gets angry at me for pointing out that either they don’t work or they are a shitty, complex, mess
Honestly, at some point I started approving his PR and calling it a day; oh we don’t have tests cause reasons, I tried to use TS too but since my boss finds it too complicated we are not using it again for new projects… funny
I’d start rejecting his PRs lol, why is anyone but the original developer fixing his PRs?
I agree - if the reviewer doesn’t have the power to reject prs then they aren’t very useful reviews imo.