code-metrics

Code metrics

I'm just curious about what kind of code metrics people are using and opinions/experience on the most effective use of code metrics. All of our code, regardless of language, uses the following: Cyclomatic Code Complexity Lines of Code Coupling (has different meanings for OO languages than in procedural and templating languages) The ...

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 some automated tools which can hook into the build and check for poor coding practices. W...

Eclipse metrics plugin suggestion.

I'm looking for a tool to give me some code metrics (total LOCs, LOC/Class, # of external references/class, etc...). Does anyone know a good eclipse plugin that could provide me some some code metrics? ...

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 code coverage % for unit tests (and why)?".) People tend to measure everything. They need co...

Free C# metrics calculation library (DLL)

Hi, 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 CK metrics and display it to you in various forms, but what I would need is one that ...

Analyzing code structure using CodeDom??

Hi, I recently wrote a post here on Stackoverflow asking for some C# libraries that calculate metrics, mainly CC...unfortunately with no success. So I'm going to write it myself. I did a search on the web of what could be the best approach, but before starting I'd like to ask you on how you'd do it. I'm currently between two kind of ap...

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 presented on web dashboard graphs), the code coverage is only reported on build status page (an...

NDepend metrics on assemblies

Do you try to keep the Distance from main sequence low for every assembly? What about assemblies that contains only Business Objects definitions? Is it possible to keep them away from Zone of Pain? Types in such assemblies are usually used by other assemblies and are rather concrete. How to handle such situation? ...

How to extract a single function from a source file

Hi, I'm working on a small academic research about extremely long and complicated functions in the Linux kernel. I'm trying to figure out if there is a good reason to write 600 or 800 lines-long functions. For that purpose, I would like to find a tool that can extract a function from a .c file, so I can run some automated tests on the ...

Have you written very long functions? If so, why?

Hi, I am writing an academic project about extremely long functions in the Linux kernel. For that purpose, I am looking for examples for real-life functions that are extremely long (few hundreds of lines of code), that you don't consider bad programming (i.e., they won't benefit from decomposition or usage of a dispatch table). Have y...

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 any metric in this case. Thanks, Ajit. ...

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 me every time that pixel image was served up? Am i able to do something like: <img src...

Available Code Metric Systems?

Besides Cyclomatic Complexity what other code metric systems exist? ...

Is there a library out there to analyze VB.Net code complexity from my C# code?

Given VB.Net code in a string, is there a library (or a command line tool) out there that could calculate Cyclomatic Complextiy and LOC? This has to be done within my C# code. Thanks. ...

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 are only instantiated once. I'm sure there is a ton of other interesting things to be foun...

Test Impact on code change

Are there any tools (for C/C++) available to visualize the modules affected or the test cases to be executed when a block of code in changed. Example, If i modify few lines in a method of a class, I should be able to get metrics on number of calling methods, affected modules. Also If i have a traceability from Code-TestCase, can this...

need halstead metric calculation code?

i need code to calculate halstead metric for c source code? ...

Compiling historical information (esp. SLOCs) about a project

I am looking for a tool that will help me to compile a history of certain code metrics for a given project. The project is stored inside a mercurial repository and has about a hundred revisions. I am looking for something that: checks out each revision computes the metrics and stores them somewhere with an identifier of the revision d...

SourceMonitor xml dump to database

Hi, 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 SourceMonitor. ...

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. At least they are helpful when it comes to finding areas of code that need some refactoring...