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

Scala Source Code metrics : Cyclomatic or McCabe complexity, Halstead Complexity, Data Abstraction Coupling

I am looking for a command line tool which calculates the source code metrics for scala language. I have seen some tools which generated metrics on the basis of loc(lines of code)& comments and I don't need this metrics(cloc,sbt-stats). I want a…
shiva
  • 730
  • 8
  • 25
2
votes
1 answer

Clarifying the manual count of Cyclomatic Complexity

Let's assume that we have a code like this: switch(y) { case 1: case 2: case 3: function(); break; case 4: case 5: case 6: function_2(); break; } Can we get the CC value as 6+1 here? Why a value of 1 is added? If the CC value is…
Spark
  • 47
  • 5
2
votes
0 answers

Include HTML, JavaScript, and CSS files in Visual Studio's Code Metrics Analysis

I would like to include HTML, CSS, and JavaScript files within the analysis of Code Metrics to get the number of lines for these files within my solution. Is this possible? Thank you.
Chris K.
  • 153
  • 2
  • 12
2
votes
0 answers

Does VS2013 use VS2015 Code Metrics Powertool?

I installed the download for the Code Metrics Powertool for VS2013 and installed it. Metrics.exe was created in ...\12.0\Team Tools\Static Analysis Tools\FXCop. I downloaded and installed the Code Metrics Powertool for VS2015 and installed it. The…
2
votes
3 answers

How to show the number of lines of selected files evolving in git history

I'd like to get the number of lines for a given set of files evolving in the history of a git repository. To get it for the current working copy I can call wc -l $FILES, but how to get it with timestamp for each commit to generate a graph of growing…
Jakob
  • 3,570
  • 3
  • 36
  • 49
2
votes
2 answers

C# :Cyclomatic Complexity of a method with FxCop sdk

I need to calculate the cyclomatic complexity of C# methods and need to define the rule according to the CC value, in the FXcop 12.0. I've found that the tools like Code Metrics provide functionality to calculate the CC values, but I don't know how…
2
votes
7 answers

What metrics should we use to judge code quality?

I'm currently working on a large project, where many developers worked over time and the code was terrible. After many refactorings we now arrived a point, where the code is ok. Now I'm thinking what "ok" means - probably for everyone something…
ollifant
  • 8,576
  • 10
  • 35
  • 45
2
votes
1 answer

how to find most used classes in Visual Studio solution

Who knows how to find the most used classes (written/implemented, not referenced) in a Visual Studio solution? The solution contains a lot of projects. By 'most used' I mean the largest number of member invocations. Thank you.
Pavel Yermalovich
  • 1,970
  • 1
  • 15
  • 19
2
votes
3 answers

Average Cyclomatic Complexity of multiple files

I ran a static code analysis on a couple of projects and got the Cyclomatic Complexity for every file in those projects from the report that was generated. Now I want to calculate the average Cyclomatic Complexity for the whole project. How would I…
2
votes
1 answer

How is SLOC counted by Delphi IDE?

You see pretty often here people saying that they have a x million of lines of code project. How is this measured? Is this number, the number shown under 'Information' menu? The manual says that only the compilable lines are counted (so, without…
Gabriel
  • 20,797
  • 27
  • 159
  • 293
2
votes
4 answers

Counting assertions

I've been getting requests lately from management to create reports of the number of assertions run by the tests for our software. They want this so they can tell if people are writing tests or not. My inclination is to just tell them "no you can't…
ZombieDev
  • 959
  • 1
  • 10
  • 25
2
votes
2 answers

Expanding a single C pre-processor directive

I need to expand a single preprocessor directive, for example: Having a source file and two headers, I want to expand only one define from one specific header, leaving all other include and define intact. The main idea is that, given code similar to…
Cristiano Araujo
  • 1,632
  • 2
  • 21
  • 32
2
votes
1 answer

Tools to improve C++ MFC code

We have a number of large C++ MFC project that we manage. Unfortunately, the code quality in them not very good and there are no unit tests. I am therefore looking for tools that can help us to analyze and improve the code. I am looking for tools…
magol
  • 6,135
  • 17
  • 65
  • 120
2
votes
1 answer

Get used languages statistic from TFS

I'm new on TFS SDK, and I demand is there a possible way to get a statistic of used langages on a project hosted on TFS 2012 "Programmatically" ? like on github :
Nizar Grindi
  • 135
  • 5
2
votes
1 answer

SourceMonitor xml dump to database

Is there a library or a tool that could parse the xml dump of SourceMonitor and save it in database? SourceMonitor is a great tool, but I'd like to have better visualization and statistics-over-time of our code, which you really can't get with…
Morri
  • 571
  • 5
  • 20