UpCodes interview question

When do you consider to make a code refactoring?