3 ms·
It says not to combine refactoring with bug fixing. But like any advice, it's relative: a drive-by cleanup can be easier for everyone than reviewing a separate
by RustyRussell 4y ago
It says not to combine refactoring with bug fixing. But like any advice, it's relative: a drive-by cleanup can be easier for everyone than reviewing a separate PR. And sometimes a refactor makes the bug (and all related ones!) vanish or trivially caught.
To quote Kernighan and Plauger: "Don't patch bad code: rewrite it".
- wtetzner 4y agoI think doing a refactor and bug fix in separate PRs makes sense. But I would say do the refactor first, and then do the bug fix on top of it. This solves two problems: * It can make the bug fix diff much easier to read/understand * It makes the refactor a dependency of the bug fix, so it doesn't end up getting dropped as "not important enough" Of course, if the refactor automatically makes the bug go away, then it's fine to do a single PR, because the refactor is the bug fix.