That's an interesting take. I've usually encouraged removing commented code because every line of code is a liability, even if commented out.
That's an interesting take. I've usually encouraged removing commented code because every line of code is a liability, even if commented out.
Still, commented-out code is generally worthless and should be deleted. Unless it is actively being worked on and only commented out to achieve some short-term goal. In which case it should also not be commented out but instead live on a branch.
Occasionally you might have two flows and you're not sure which is best. But in that case keep them in separate functions and one of those will not be used but can still be covered with tests. And all static analysis tools will work on it. Just needs a comment about why this unused code is there.
With that being said, commented code is rarely useful and it cna be a liability indeed.
Maybe put a comment about the removal if you want something that can easily lead back to the commit which did it.