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
6
votes
2 answers

How does Visual Studios calculate the Maintainability Index?

I have been browsing through the posts and the MSDN, but I am not seeing how the Maintainability Index is created. Only what the good and bad values are. http://msdn.microsoft.com/en-us/library/bb385914.aspx Does anyone know? Can we get a reference…
JPK
  • 1,324
  • 2
  • 14
  • 25
6
votes
2 answers

Why is cyclomatic complexity of those methods so high?

Metrics are calcucated using Visual Studio. First method has CC = 4 private IEnumerable GetRows(DataTable dt, string columnDelimiter) { return from DataRow row in dt.Rows select string.Join(columnDelimiter,…
Piotr Perak
  • 10,718
  • 9
  • 49
  • 86
6
votes
7 answers

Do software metrics work both ways

I just started working for a large company. in a recent internal audit, measuring metrics such as Cyclomatic complexity and file sizes it turned out that several modules including the one owned by my team have a very high index. so in the…
Tom
  • 189
  • 8
6
votes
2 answers

Maven and code metrics: check for existence of a test case for each class

Is there something that can be used in Maven to automate this kind of check? I'm seeing checkstyle and PMD but I'm not finding this feature. Basically I'd like the build to fail if there's a class A and there's not an ATestCase. I know, it is not a…
Andrea
  • 2,714
  • 3
  • 27
  • 38
6
votes
6 answers

Evaluation of Code Metrics

There has been a considerable amout of discussion about code metrics (e.g.: What is the fascination with code metrics?). I (as a software developer) am really interested in those metrics because I think that they can help one to write better code.…
zlajo
  • 2,173
  • 1
  • 19
  • 25
6
votes
4 answers

Visual Studio - Determining Lines No Of Lines of code in a project

Visual Studio - Determining Lines No Of Lines of code in a project - is this possible in VS 2008?
AJM
  • 32,054
  • 48
  • 155
  • 243
6
votes
4 answers

How to use Pixel Tracking across domains in PHP

I understand the basics of pixel tracking, I'm able to insert a pixel that references an image on my tracking domain to other websites. However, how do I increment that actual pixel count on my tracking domain? Is there some kind of log that tells…
Petrogad
  • 4,405
  • 5
  • 38
  • 77
5
votes
3 answers

Seeking C++ metrics tool for Linux

I'm looking for a C++ code quality metrics tool that can run on Linux. Having Eclipse integration would be a bonus but is not required. I found a decent tool called Source Monitor, but that only works on Windows, and the source code is not…
KenK
  • 263
  • 2
  • 10
5
votes
2 answers

Java code Analytic/Metrics tool

I am looking for a free Java code analysis/metrics tool that I can use to see class dependencies, method execution times, etc, and possibly to print out a diagram that shows them. I am currently using a jdepend task in ANT to achieve this, but I'm…
SuperTron
  • 4,203
  • 6
  • 35
  • 62
5
votes
2 answers

Rubocop complains about Metrics/AbcSize

So I'm trying to take the right path here and understand how to solve this cop, this looks like a small piece of code IMO, why is it complaining? moving the nested if-else doesn't change anything, any suggestions on how to solve this cop? class…
Wagner Moreira
  • 1,033
  • 1
  • 16
  • 40
5
votes
2 answers

Calculate code metrics as part of build pipeline in Devops

This seems a pretty straightforward thing to do, but I cannot find relevant information. In Visual Studio is very easy to calculate code metrics for all projects and I would like to do the same during a build pipeline in Azure DevOps. Has anyone…
5
votes
4 answers

Should code coverage be executed EVERY build?

I'm a huge fan of Brownfield Application Development. A great book no doubt and I'd recommend it to all devs out there. I'm here because I got to the point in the book about code coverage. At my new shop, we're using Team City for automated…
A-Dubb
  • 1,670
  • 2
  • 17
  • 22
5
votes
3 answers

Linux tool to show SLOC and SLOC modified, added, removed

I am currently using the SLOCCOUNT tool for gaining source lines of code (SLOC) for a codebase. However, it doesnt support comparing two versions of the codebase and then report: Lines of code (LOC) modified LOC removed LOC added Can anyone…
DEzra
  • 2,978
  • 5
  • 31
  • 50
5
votes
1 answer

HIS-Metric "calling"

I do not understand the reason for this metric/rule: A function should not be called from more than 5 different functions. All calls within the same function are counted as 1. The rule is limited to translation unit scope. It appears to me…
vlad_tepesch
  • 6,681
  • 1
  • 38
  • 80
5
votes
2 answers

How many code lines do my project have

Possible Duplicate: Counting Line Numbers in Eclipse How Can I count the number of lines in my project including all the packages and projects in the Eclipse editor?
seismael
  • 227
  • 1
  • 6
  • 18