How to measure file complexity in C ++ or Java?

I want to start measuring what Michael Perse called code turbulence, namely, rebound and complexity .

To do this, I need to measure the complexity of a C ++ or Java file. So I found a couple of tools that measure cyclic complexity (CC). Each of them measures CC at the level of a function or method. However, I need a file level metric, and they are not very good there. One tool simply returns the average of all the complexities of the method in the file, and the other tool processes the entire file as one giant method, i.e. It takes into account all decision points in the entire file.

So, I did some research and found that McCabe defines CC only in terms of modules - and they define a module as a function, not as a file (see slides 20 and 30 of this presentation ). And I think that makes sense.

So now I can not figure out how to represent the complexity of the files. My thought is that I should use the maximum CC method for this file.

Any thoughts on this approach or any other suggestions?

Thanks!

Ken

+4
source share
1 answer

A few years ago I had the same question. I answered this as follows and it worked and works great for me:

. , - ​​ "", .. . "" , total/max/min/etc, - , . "summary" , , .

, , - / , //? , . , 1000 , , , "" "" . / ...

, . "", . /. - "", "" "" .

, , . , " ". , , , .. ( , , , ). , , ...

: Metrix ++, , .

+2

All Articles