简体   繁体   中英

Generating total cyclomatic complexity for Java 8

I would like to understand the quality of a large Java 8 codebase. To do this I am interested in generating a (McCabe) cyclomatic complexity score for each individual project, relative to the total number of lines of code per project. This will help to understand relative quality and determine if developers' subjective sense of technical debt is correct. This will also allow me to graph such metrics over time which will help to understand if quality is increasing or decreasing. At least, these are my hypotheses.

Are there any tools that can generate such complexity scores? Tools such as Checkstyle and PMD can evaluate complexity of methods etc. against a threshold, but this is not what I need; I need a total complexity score for a given codebase. I have heard of tools such as JavaNCSS but alas this is no longer maintained.

Lizard can give you a method-level cyclomatic complexity score(CCN) and the lines of code(NLOC) side-by-side. You can sum up the CCN numbers and the NLOC numbers to get an "Average complexity" of the code-base. Lizard does an average of averages, ie it finds a method-level average complexity, and prints the average of all these averages. If you find the latter useful, you can go for it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM