Title: For the past several hours I&#x27;ve been struggling to unravel a pull request from a newly hired coworker. It was apparent from a quick glance that it needed some work but I underestimated how bad it was. The main logic is in a monolithic ~400LOC function (in a dynamic language, not verbose Java or C) consisting of a deeply nested if&#x2F;else spaghetti code. I wouldn&#x27;t dare touching it with a 10 foot pole without tests but fortunately there are some and the original test coverage isn&#x27;t bad. So I&#x27;ve cut it down to almost half the size so far but there&#x27;s still way to go until it reaches a somewhat maintainable state. I&#x27;ve also found and fixed a few bugs along the way so strict refactoring is not even a goal at this point.<p>So I&#x27;m wondering how to go about this. A few code review comments here and there won&#x27;t cut it. If I was to be brutally honest, I&#x27;d outright reject the PR and tell him to rewrite it from scratch in a clean way but that&#x27;s probably not the ideal response. How do you deal with situations like this?
Upvote: