Hacker News new | ask | show | jobs
by infectoid 3051 days ago
Great advice here. Agree on a process. Do it slowly.

I work with a lot of legacy code and have felt overwhelmed at times by all the different coding styles that have been used through the code base and not know when to refactor or simply clean up.

Over the last year or two I've been using a linter to help me with all this. Basically any code I touch gets cleaned to the point the linter isn't complaining. This is usually a fairly quick and fun process and I've actually learned a lot along the way.

I would refactor as soon as too many things were touching and the code started to have a smell about it even though the linter wasn't complaining.

It has made maintaining legacy code more fun (almost like a game) and given me some better practices when moving into new code.