0

Can any of the existing source code analzyers provide metrics on where code is used? I'm trying to find code that is either unused or consumed only by tests, basically candidates for deletion.

xenoterracide
  • 16,274
  • 24
  • 118
  • 243

5 Answers5

0

Resharper does for .net. I believe the Java equivalent is IntelliJ

m0r6aN
  • 850
  • 1
  • 11
  • 19
0

In IntelliJ (for example), you can use the Inspections which can point out the unused methods. You will find some details there: How to use IntelliJ IDEA to find all unused code?

If you want to scan a set of projects, you can also use Sonar, an open source platform for Continuous Inspection of code quality. It provides a few plugins for finding dead code, such as this one.

Community
  • 1
  • 1
Vincent Durmont
  • 813
  • 8
  • 16
0

There is an eclipse plugin called CodePro AnalytiX from google developer tools which has the capability of dead code analysis. Click here

Kvk
  • 522
  • 5
  • 15
0

PMD is a standalone analyzer with plugins for several IDE's. It can analyze java, javacript, android etc. and find unused code.

mister270
  • 366
  • 1
  • 15
0

(sorry cannot comment yet)

What environment do you use for development? I use Eclipse, which provide nice reporting on unused/unreachable code and imports. Just import your project into eclipse, and you will see all the warnings in Problems view.

I hope it was helpful

Jama Djafarov
  • 358
  • 3
  • 11