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
1
vote
2 answers

Does passing an aggregate object instead of a long argument list of objects reduce data coupling

I read that data coupling can be reduced by "not passing unnecessary arguments" Say there is a makeCake method which requires many instance variables in the Ingredients class as parameters: makeCake(ingredients.flour, ingredients.egg,…
SonicProtein
  • 840
  • 1
  • 11
  • 28
1
vote
1 answer

Why there is a change in cyclomatic complexity when rearranging switch statements with other dependent factors?

The CC for the below method would be generated as 9 Public Enum Fruits Apple Pineapple Banana PassionFruit Orange Melon Grape Mango End Enum Private Function Fruity(ByVal…
kurozakura
  • 2,339
  • 8
  • 28
  • 41
1
vote
2 answers

Automatic way to obtain the floating-point operation count for some piece of code

I have some rather complex and highly templated code (C++, but this may not be very relevant) of which I'd like to know the number of adds, subs, muls, divs, and sqrts at execution. Is there an automatic way to get this information (the compiler…
Walter
  • 44,150
  • 20
  • 113
  • 196
1
vote
3 answers

code metric analysis for JAVA

do you know of any open source tool that can be used for code metric analysis in java? it should be able to integrate well in jenkins. I'm trying to setup a complete test suite for our project that includes coverage test, unit test, static code…
klambiguit
  • 527
  • 1
  • 3
  • 14
1
vote
1 answer

How does this code have LCOM4 value 1?

The sonar documentation shows the following as a refactored code of LCOM4 = 1. But it seems to me that it should be 2, because there is no cohesion between getFullName and getFullAddress. What am I missing? public class Client { public String…
Miserable Variable
  • 28,432
  • 15
  • 72
  • 133
1
vote
2 answers

Analysing and generating statistics on your code

I was wondering if anyone had any ideas or procedures for generating general statistics on your source code. Off the top of my head I would love to know how many functions in my project's code are called once or very few times or any classes that…
Shane
  • 697
  • 9
  • 24
1
vote
2 answers

Calculate Code Metrics ignoring Code Contracts

Is there anyway to calculate the Code Metrics for a VS 2010 Ultimate solution, but to omit the Code Contracts? Right now, my best idea is to do a calculation, dump the excel file, then reflect over the IL of each class, count the amount of lines…
smartcaveman
  • 41,281
  • 29
  • 127
  • 212
1
vote
2 answers

Is there an average number of lines per commit that can be used as a benchmark?

Trying to keep track of progress and establish company-wide benchmarks. I understand that each language is different, but are there general benchmarks for these sorts of things? Developers probably shouldn't make a TON of changes at once and do it…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
1
vote
1 answer

How can I achive code metrics for C# code in Jenkins?

How can I achieve code metrics for C# code in Jenkins, for example Cyclomatic complexity?
1
vote
3 answers

Counting lines of code of Stored Procedures in SQL Server 2005

Using SQL Server 2005 management studio, I have exported each Sprocs and Functions as a separate .sql file. Is there a way that using CLOC tool, I can produce lines of code metric? The CLOC site states that it supports SQL but it does not generate…
Ajit Singh
  • 1,016
  • 13
  • 26
1
vote
1 answer

how to get a path from tfs in Console Application

i have creating a console application which takes the two argument one as input .xml file and give output as .htm file below is code for the accessing tfs TfsTeamProjectCollection teamProjectCollection = …
aamankhaan
  • 491
  • 1
  • 9
  • 35
1
vote
2 answers

How can CruiseControl.Net fail a build based on changing metrics?

I would like CruiseControl.Net to fail a build when some code metrics change in a 'wrong' direction, i.e. code coverage decreases or Gendarme defect count increases. The Gendarme metrics are already tracked in report.xml file (because they are…
skolima
  • 31,963
  • 27
  • 115
  • 151
1
vote
3 answers

What does number of lines of code tell you about your application?

Recently, we were asked to find the lines of code in our application by our managers. I have actually been pondering since then; what does this metric signify ? Is it to measure the average lines of code the developer has written over the time…
Egalitarian
  • 2,168
  • 7
  • 24
  • 33
1
vote
2 answers

Determining the length of sections of code

Is there a tool that parses a Ruby script (MRI/YARV) and gives statistics of how many lines each module/class/method definition is?
sawa
  • 165,429
  • 45
  • 277
  • 381
1
vote
2 answers

Can Checkstyle return lines of code for a project

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,…
Ally
  • 1,476
  • 3
  • 19
  • 30