Eclipse plugin

1.  FindBugs: An Eclipse plug-in tool that can statically analyze bugs that may appear in source code.

2.  JDepend4Eclipse: Evaluate the quality of Java programs, traverse the file directory of Java classes, and take Java packages (packages) as units to automatically generate evaluation reports of package dependencies, stability, reliability, etc. for each package/class.

 

-----------------------------------------------------------------------------------------------------------------------------------------------

 

1. FindBugs

Install FindBugs: Help => Eclipse Marketplace... => Enter "FindBugs" to find and install as required.

Usage: Right click on project => FindBugs => FindBugs

1.1 FindBugs Find project bugs

After clicking, the found bug will be marked on the specific class in the project, as shown below.

1.2 Clear Bug Markers

After running, the mark is cleared, as shown below

1.3 Save XML to generate a report in XML format for the bugs found

1.4 Open Analysis Results in Editor Open the XML report in Eclipse

1.5 Load XML Load XML format report, and display Markers in Eclpse (if there is no Markers), if there are any, it will not be displayed again.

 

-----------------------------------------------------------------------------------------------------------------------------------------------


2. JDepend4Eclipse

Install JDepend4Eclipse: Select the first one, Install.


Usage: select src => right click => Run JDepend Analysis


Then jump to the page to view the evaluation report:


(公司包名含敏感信息,已隐去,见谅)

Selected object(s):选择分析的包

Number of Classes (Cc):被分析package的具体和抽象类(和接口)的数量,用于衡量package的可扩展性。

Afferent Couplings (Ca):依赖于被分析package的其他package的数量,用于衡量pacakge的职责。即有多少包调用了它。

Efferent Couplings (Ce): 被分析package的类所依赖的其他package的数量,用于衡量package的独立性。即它调用了多少其他包。

Abstractness (A): 被分析package中的抽象类和接口与所在package所有类数量的比例,取值范围为0-1。

Instability (I): I=Ce/(Ce+Ca),用于衡量package的不稳定性,取值范围为0-1。I=0表示最稳定,I=1表示最不稳定。即如果这个类不调用任何其他包,则它是最稳定的。

Distance (D): 分析package和理想曲线A+I=1的垂直距离,用于衡量package在稳定性和抽象性之间的平衡。

理想的package要么完全是抽象类和稳定(x=0,y=1),要么完全是具体类和不稳定(x=1,y=0)。取值范围为0-1,

D=0表示完全符合理想标准,

D=1表示package最大程度地偏离了理想标准。即你的包要么全是接口,不调用任何其他包(完全是抽象类和稳定),要么是具体类,不被任何其他包调用。

 

Package with cycle:

Depends upon-efferent dependencies:依赖的包

Used by-afferent dependencies:被引用的包

 

-----------------------------------------------------------------------------------------------------------------------------------------------

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326844619&siteId=291194637