Given some legacy module in a ten year old project, where you have seen none of the code and not used the application, how long will it take you to grok 10000 lines of code from that module?

The permutations of possible setbacks and or further-complicating conditions is endless, I know. Let the above problem be a fun thought exercise. 

How should you deal with this type of situation if you are the project manager?

And as the coder, how much time is it reasonable to spend preening the code?

---

This question is not about finding a formula where the input is lines-of-code *times* type-of-problem and the result is hours spent doing *whatever*.

This question is about exploring feasible strategies for predicting how much time is worth putting into refactoring a code base and for setting limits to such efforts.

---

This may seem theoretical, but from my perspective, it is super-worth-it to rewrite deprecated garbage and put 10-15% of allotted time into sheer cosmetic changes (*actually demand* 10-15% extra for any task). The project lead on the other hand could not care less about how ugly the stuff is, but the said person could soon retire...