Honestly it depends on the context. If you received it as a code review, then it is your job to talk with the author and ask why it was done this way. If it was a high priority fix for prod and tests prove it works, sure deploy and refactor afterwards. If it is a random ticket, and no real reason is supplied, educate the author how to refactor it to something proper and assign it back.
In the actual interview I would ask for the context, because I think this question deserves a context aware response. If you get the question why do you need the context, then explain different contexts deserve different actions.
Honestly it depends on the context. If you received it as a code review, then it is your job to talk with the author and ask why it was done this way. If it was a high priority fix for prod and tests prove it works, sure deploy and refactor afterwards. If it is a random ticket, and no real reason is supplied, educate the author how to refactor it to something proper and assign it back.
In the actual interview I would ask for the context, because I think this question deserves a context aware response. If you get the question why do you need the context, then explain different contexts deserve different actions.
So there are even more cases then I originally thought. Never make an assumption is also a good lesson. Thanks you for that.