Let’s track down some code that’s not actually in use (and delete it, naturally).
If you have a different method for finding unused code that works well for you, please share it here so others can benefit.
As always, please share your results. I’d love to hear how many lines you manage to excise.
I’m working with a TypeScript monorepo, and it’s very easy for unused code to stay around when features are removed. unused didn’t cut it, but I finally got the chance to try out ts-prune.
It doesn’t work perfectly with monorepos, but it was simple to use and it helped me detect a dead folder with ~400 LOC. It’s not a big deal, but it makes the code a bit cleaner without all of these little unused files
Done! I was able to remove a bunch of unused methods and properties, as well as a couple of entire files. I had never specifically looked for unused code in a .NET solution before, but I found out that Resharper can do it for you. There is a lot more to work through, but I at least got a good start.
Did some yak shaving on the way since I updated the work laptop to Ventura last night so homebrew/Xcode/ctags config fun. Anyway our codebase has so many candidates, but managed to get rid of a dead method from 2007 that was last called anywhere in 2015.
But most importantly, this exercise reminded me how bad meta-programming affects readability, because the unsued tools reported tons of false positives. Some false positives very obvious to me and I ignored them right away. But others were very obscure, and I was happy that my test suite covered those, and I didn’t delete stuff that was actually still in use and called by meta-programming.
I removed some meta-programming that didn’t actually add much value and replaced it with more explicit code to improve readability and maintainability.