Good code measuring tools?
Asked Answered
L

3

8

Are there any good code measuring tools available?

I found code measure pretty useful and interesting, but I don't think I can pay $1K/year for just using the measuring tool.

I imagine there might be a tool that is/can

  • open source software
  • language independent
  • OS independent
  • measure the metrics from different categories : LOC, LOC without blank lines, Number of functions ...
Luedtke answered 25/6, 2010 at 13:33 Comment(3)
@0xA3 - CodeMeasure describes itself as "language independent". So if that is the yardstick...Patterson
en.wikipedia.org/wiki/List_of_tools_for_static_code_analysisYaya
How would you count functions in a language independent way? How would you even recognize comments in a language indepent way?Waterfowl
V
4

For basic line-count metrics like the ones you describe, try cloc.

My 2c-worth: code metrics are generally worse than useless. The only value I've ever gotten out of them is to measure the efficiency of one language against another.

Virgate answered 25/6, 2010 at 13:35 Comment(5)
Cloc is good, I use it for all my projects where I care about line count.Loot
Which metrics are you talking about as "worse than useless"? Your statement is too broad to help.Hydrangea
@Andy: Pretty much all of them: lines of code, cyclomatic complexity, defect injection rates, etc. On one occasion, after I had reduced several thousands lines of code down to a 200-line code-gen script, a colleague who was obsessed with metrics told me that my code was of average quality, because my defect-injection-rate-to-LOC ratio was par for the language we were using. It didn't bother him at all that the LOC had dropped by an order of magnitude while the defect count remained unchanged. Metrics help when you bake cookies every day, not when everything you write is brand new.Virgate
thanks for the story as defect-injection-rate-to-LOC ratio sounds seductively useful, especially to management, and it's nice to have a counter-example. Have you considered any of the OO quality metrics such as SOLID and the Chidamber and Kemerer metrics? They are the ones I'm most interested in, especially how they change in a project. As someone who aims to improve code, LOC is a metric I've long ignored. Good code often gets smaller.Hydrangea
@Andy: I'm not much of a fan of OO in general (strongly favouring functional and process-oriented (ala Erlang) style) so Chidamber & Kemerer doesn't interest me very much. I prefer to build everything as small, self-contained units that communicate via clearly defined message-based protocols. AFAICT, this approach automatically satisfies C&K.Virgate
R
0

With 82 code metrics supported NDepend is the code metrics Roll's Royce tooling for .NET developers.

Rufe answered 30/8, 2010 at 16:29 Comment(0)
D
0

Sonar is a Java based server side application for code measurement. It is mostly targeting Java, but support for other languages is available via plugins.

Divisibility answered 30/8, 2010 at 16:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.