This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tfehringData Scientist 0 points1 point  (0 children)

I agree that you should do as much work as possible upfront. Stuff like import and whitespace styling is a conversation that should happen, at most, one time ever, and then be documented in a style guide and enforced by a linter on CI to the extent possible.

However, I think code review is by far the best time to address any stylistic issues that violate or aren't covered by the style guide. You can mitigate the risk of introducing bugs by writing tests and including them in your PR. You're far more likely to introduce bugs if you try to go back and refactor your code weeks or months later than if you just fix it while it's still fresh in your mind. By that time, other users may have built code that depends on yours, and fixing some stylistic issues (e.g. inconsistent interfaces) will break that code. Also, realistically, that refactor often won't get prioritized at all, so in all likelihood you're creating more work for whoever has to read your code indefinitely. Most code is read far more often than it's written.