Questions tagged [code-metrics]

Software metrics are quantitative data pertaining to source code, e.g. number of lines of code (LOC) for a file.

Questions with this tag will often be about which metrics are most useful for certain purposes or which tools are available to provide certain metrics.

276 questions
20
votes
1 answer

What does package tangle index data indicate in Sonar?

I have the following data on one of the 7 axes (See the second picture) after running a Sonar analysis on my project. What information can be decoded from this data? Also which of the axes in the diagram below does this data pertain to?
Inquisitive
  • 7,476
  • 14
  • 50
  • 61
19
votes
15 answers

What can be alternative metrics to code coverage?

Code coverage is propably the most controversial code metric. Some say, you have to reach 80% code coverage, other say, it's superficial and does not say anything about your testing quality. (See Jon Limjap's good answer on "What is a reasonable…
guerda
  • 23,388
  • 27
  • 97
  • 146
18
votes
4 answers

Hudson/Jenkins source code metrics?

Are there any useful plugins for source code metrics for Hudson/Jenkins? I'm looking for total lines of code, total number of tests, classes, etc. with graphing. Does anything like this exist?
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
16
votes
4 answers

Why Does This Maintainability Index Increase?

I would be appreciative if someone could explain to me the difference between the following two pieces of code in terms of Visual Studio's Code Metrics rules. Why does the Maintainability Index increase slightly if I don't encapsulate everything…
Timothy
  • 4,630
  • 8
  • 40
  • 68
16
votes
8 answers

Should LOC counting include tests and comments?

While LOC (# lines of code) is a problematic measurement of a code's complexity, it is the most popular one, and when used very carefully, can provide a rough estimate of at least relative complexities of code bases (i.e. if one program is 10KLOC…
Eli Bendersky
  • 263,248
  • 89
  • 350
  • 412
16
votes
2 answers

cyclomatic complexity = 1 + #if statements?

I found the following paragraph regarding cyclomatic complexity on Wikipedia: It can be shown that the cyclomatic complexity of any structured program with only one entrance point and one exit point is equal to the number of decision points (i.e.,…
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
14
votes
6 answers

Accurately accessing VB6 limitations

As antiquated and painful as it is - I work at a company that continues to actively use VB6 for a large project. In fact, 18 months ago we came up against the 32k identifier limit. Not willing to give up on the large code base and rewrite…
Brian Mueller
14
votes
3 answers

An error occurred while calculating code metrics

Issue description When I tried to run code metrics in Visual Studio 2013 for c# project (Analyze -> Calculate Code Metrics for Solution) I get following error: "an error occurred while calculating code metrics" This error occurred even for the…
Sh4DoV
  • 141
  • 1
  • 5
13
votes
3 answers

Python: code statistics

Do you know if there's a Python library that generates statistics about code? I'm thinking about pointing to a package and getting number of classes, functions, methods, docblock lines etc. It could eventually include useless stuff like number of…
moraes
  • 13,213
  • 7
  • 45
  • 59
13
votes
5 answers

Free C# metrics calculation library (DLL)

I wanted to ask whether you know about some free C# libraries (dlls) that calculate CK metrics (mainly Cyclomatic Complexity). I would need that for a project I'm planning to do. I know that there are already some finished solutions that calculate…
Juri
  • 32,424
  • 20
  • 102
  • 136
12
votes
4 answers

Cyclomatic complexity metric practices for Python

I have a relatively large Python project that I work on, and we don't have any cyclomatic complexity tools as a part of our automated test and deployment process. How important are cyclomatic complexity tools in Python? Do you or your project use…
Matt Messersmith
  • 12,939
  • 6
  • 51
  • 52
12
votes
1 answer

How do I gather TeamCity code coverage reports from multiple projects into one report?

We use the build in coverage application in TeamCity 6 (about to upgrade to 7.1) If we wish to see the code coverage (or other metrics) of a particular build it is fine as we can navigate to that build, but it would be great if we could pluck out a…
Loofer
  • 6,841
  • 9
  • 61
  • 102
11
votes
4 answers

Code metrics and warnings for C++

I have a pretty new code base written in C++. Already I'm starting to see some bad practices creeping into the project (class file with 1000+ lines of code, functions with a lot of parameters, ...). I would like to stop on these right away with…
stimms
  • 42,945
  • 30
  • 96
  • 149
11
votes
8 answers

Are there any good tools to collect Objective-C metrics?

I'm using Jenkins for CI on iOS projects and want to collect some software metrics on them. But the only tool I was able to find was CLOC which only counts lines of codes (LOCs). Nevertheless it's better than nothing. What I really want to count are…
Jens Kohl
  • 5,899
  • 11
  • 48
  • 77
11
votes
3 answers

How to automate Visual Studio's Code Metrics feature

I want to automate the process of gathering code metrics on a .NET solution. Is there any way of getting msbuild to run the Code Metrics feature included in VS2008 Development Edition? I may end up using SourceMonitor, but I would like to know if…
Mark Heath
  • 48,273
  • 29
  • 137
  • 194
1
2
3
18 19