Question

I have got legacy project with a lot of too big classes. I need to present that as report to manager to start cleaning-up and refactoring. I already have Jenkins job for this project with PMD maven goal configured:

pmd:pmd

I am researching on:

How to get list of Java classes (and JavaScript, HTML files ...) longer that 500 lines?

How to get list of Java classes with functions longer that 50 lines?

And it would be perfect to have that publish on Jenkins, i.e. as a report.
However any simple solution would do. For example: plain listing as full class name, LOC (lines of code). Sorted by LOC descending.

Simple Format

Name LOC
com.example.HugeClass 5000
com.example.BigClass  3540
com.example.BigClass2 3390
Was it helpful?

Solution

Use Checkstyle, or use SONAR, which aggregates Checkstyle, PMD, Findbugs and other checks and generates reports and more.

OTHER TIPS

There are a lot of tools. http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Java You need to pick one and find out how configure it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top