Find Dead Code with Unused
Today I discovered a fascinating tool called Unused, written by Josh Clayton.
Unused leverages two of my favorite projects, Exhuberant Ctags and The Silver Searcher, to identify dead code. I installed it with homebrew.
Dead code is code that is never used by your application. It wastes electricity and mental bandwidth, and can hang around unnoticed for years. We need powerful tools to find and remove it.
Unused threw out a few false positives, as expected. Use with caution and a solid test suite.
The Unused website highlights several pull requests removing dead code from popular open source projects. I was able to use it on 'Today I Learned' itself. A small win: