4 ms·
Removing dead code is something we could have much better automated tools for. I’m thinking like https://github.com/uber/piranha https://github.com/uber/piranha
by turadg 6y ago
Removing dead code is something we could have much better automated tools for. I’m thinking like https://github.com/uber/piranha https://github.com/uber/piranha on steroids.
What would you pay to have a service that did this automatically on your codebase? You remove something in a PR and it adds a commit that cleans up everything else that can be.
- brundolf 6y agoFor a fully static language, it wouldn't contribute much value because existing tooling can do that already. For a dynamic language (like in the OP), it would be an impossible problem to solve perfectly and I wouldn't trust it to be automated.
- ozim 6y agoFor big web applications or an API, even if they are build in static language you still cannot just remove an endpoint. Maybe something is calling that endpoint once a month and you don't see it, maybe even less, then you only will get to know a lot later.
- brundolf 6y agoNo matter what, you could only ever hope to verify things that you know can only ever be called by the very code being analyzed. Proving the negative is what you're really trying to do. So static languages can exhaustively prove "deadness" for any non-exported definitions, but external APIs - be they functions or web endpoints or otherwise - are outside the scope of the problem.
- anton_gogolev 6y agoThat’s not called “deleting old code”. This is now “breaking backwards compatibility”.
- karmakaze 6y agoThis could be done by fuzzing and running tests. If the tests pass with code removed, then either a test that exercises the wanted code could be added or the removal accepted.