如何获得显示大于500行的Java类的报告? (并在Jenkins上发表)

时间:2022-07-07 21:44:54

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:

我有很多太大课程的遗留项目。我需要将其作为报告提交给经理,以便开始清理和重构。我已经为这个项目配备了Jenkins工作,配置了PMD maven目标:

pmd:pmd

I am researching on:

我正在研究:

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

如何获得超过500行的Java类(以及JavaScript,HTML文件...)列表?

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

如何获取函数长度超过50行的Java类列表?

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.

在Jenkins上发表这篇文章是完美的,即作为一份报告。但是任何简单的解决方案都可以例如:普通列表作为完整的类名,LOC(代码行)。按LOC递减排序。

Simple Format

Name LOC
com.example.HugeClass 5000
com.example.BigClass  3540
com.example.BigClass2 3390

2 个解决方案

#1


3  

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

使用Checkstyle,或使用SONAR,它聚合Checkstyle,PMD,Findbugs和其他检查并生成报告等。

#2


1  

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.

有很多工具。 http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Java您需要选择一个并了解如何配置它。

#1


3  

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

使用Checkstyle,或使用SONAR,它聚合Checkstyle,PMD,Findbugs和其他检查并生成报告等。

#2


1  

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.

有很多工具。 http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Java您需要选择一个并了解如何配置它。