문제

I am about to employ Checkstyle on a project to improve coding standards and discovered in my research that I can also setup Checkstyle to return some coding metrics as well as some other useful checks. However there seems to be a glaring omission, which is Lines of Code. I know its a horrible metric but I've been asked to produce it! Does anyone know if Checkstyle can return lines of code on the project and if so how?

Cheers

도움이 되었습니까?

해결책

Checkstyle calculates mutiple LOC-like metrics:

  • FileLength (com.puppycrawl.tools.checkstyle.checks.sizes) The default maximum is 2000.

  • ExecutableStatementCount and JavaNCSS, i.e., Non Commenting Source Statements. In a way, it is close to SLOC (source lines of code) or even better LLOC (logical lines of code). LLOC, ExecutableStatementCount and JavaNCSS are aware of the fact that one statement can be spread over multiple physical lines of code and that one physical line of code can contain multiple statements. JavaNCSS adheres to the specification for the JavaNCSS-Tool written by Chr. Clemens Lee. The specification can be found on http://www.kclee.de/clemens/java/javancss/#specification

다른 팁

The HONEST answer is that Checkstyle simply doesn't offer LOC or LLOC. In fact, as far as I can see, no Eclipse Juno Plugin for Java offers this eminently useful feature. I wonder why so is that now . . .

Even very crude IDEs like GPS gives a full catalogue of all the usual metrics. It seems to say something about the people at IBM and Oracle.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top