When writing suggestions in code reviews I have used all of these forms:
* Should we extract this to a separate function?
* Could you extract this to a separate function?
* I would extract this to a separate function.
* This could be extracted to a separate function.
* This should be extracted to a separate function.
* Extract this to a separate function.
As you can see, these have very different tones and I would like to be more consistent and as constructive as possible. Is there some general best practice for this? Are you or your team using a set of rules or guidelines?
None of your examples provide feedback as to why you want a change. That may be why you have been led to ask this question.
Consider:
* There is a potential overflow in this code. The library function xyz already does this and can log when the app is in debugging mode.
* This portion duplicates the same set of processes as over there. Refactor these into a single function, and we'll be good to go.
* While I don't have feedback yet on this function, it's too long for me to follow. It would be easier to read and for future maintenance if you refactor this part into a function.
* Since we're in closedown we can only take certain types of changes. If you refactor this into a separate function in the library, this change can be accepted.
* Or, I hate to be the process person, but the internal guidelines for this team call for all code to be structured the same way. Refactor this part into a separate function and I'll approve the PR.
There are lots of ways to provide feedback. I suggest stating the problem with the code and providing a solution. If that's the only possible solution to get past your review, state and don't ask. You can also give a carrot with "do this and I'll approve the merge."
How would you speak when sitting next to the person face-to-face? What tone do you want your boss to use when providing a performance review during a 1on1?