code-metrics

Badge Concept Applied To Codebase Statistics

Stackoverflow is the first time I've seen this badges concept. It's oddly motivating, and that's pretty cool. Has anybody seen it applied to source control change sets? I envision a data mining system that monitors a source repo and maybe a continuous integration system and flags significant deltas in various code centric metrics. Th...

How do you count your Lines of Code?

We want to invite a third party for reviewing our code and they want to know a ball park figure of number of lines of code we have in all our applications! Depending on the coding style of each of developer and depending on the language chosen there can be significant difference by measuring the LOC. I am really interested in knowing, h...

What is the fascination with code metrics?

I've seen a number of 'code metrics' related questions on SO lately, and have to wonder what the fascination is? Here are some recent examples: what code metrics convince you that provided code is crappy when if ever is number of lines of code a useful metric writing quality tests In my mind, no metric can substitute for a code revie...

What is the best way to reduce cyclomatic complexity when validating data?

Right now I'm working on a web application that receives a significant amount of data from a database that has a potential to return null results. When going through the cyclomatic complexity for the application a number of functions are weighing in between 10 - 30. For the most part the majority of the functions with the high numbers ha...

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 and another is 100KLOC, written in the same language, by teams of roughly the same competenc...

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 different. Do you think it's possible to specify "ok"? What is important? NDepend metrics? Te...

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 there is a way to use the VS code metrics engine from the command line. ...

As our favorite imperative languages gain functional constructs, should loops be considered a code smell?

In allusion to Dare Obasanjo's impressions on Map, Reduce, Filter (Functional Programming in C# 3.0: How Map/Reduce/Filter can Rock your World) "With these three building blocks, you could replace the majority of the procedural for loops in your application with a single line of code. C# 3.0 doesn't just stop there." Should we increasin...

How might I determine the number of lines of code in a C++ project?

Is there a quick way, in Visual Studio, to know how many lines of code exist in a project? ...

How many lines of code should a function/procedure/method have?

I've recently been given the unenviable task of reviewing poor code written by another developer and documenting the bad practices. (This is all for the purposes of getting out of paying for the developer's work rather than any altruistic reason, of course!) The reviewed code has several procedures that are many lines of code - the long...

How do you define 'unwanted code'?

How would you define "unwanted code"? Edit: IMHO, Any code member with 0 active calling members (checked recursively) is unwanted code. (functions, methods, properties, variables are members) ...

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

Hi, 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 suggest a linux based (preferably free) tool to do this? ...

What is (or should be) the cyclomatic complexity of a virtual function call?

Cyclomatic Complexity provides a rough metric for how hard to understand a given function is, or how much potential for containing bugs it has. In the implementations I've read about, usually all of the basic control flow constructs (if, case, while, for, etc.) increase the complexity of a function by 1. It appears to me given that cyclo...

C# How to exclude generated code from VS2008 code metrics?

See title. I've been digging around but i found no solution. DebuggerHidden and DebuggerNonUserCode seem to fail. ...

Do you find cyclomatic complexity a useful measure?

I've been playing around with measuring the cyclomatic complexity of a big code base. Cyclomatic complexity is the number of linearly independent paths through a program's source code and there are lots of free tools for your language of choice. The results are interesting but not surprising. That is, the parts I know to be the hairi...

Tips on a tool to measure code quality?

I'm looking for a tool that can provide code quality metrics. For instance it could report very long functions (spaghetti code) very complex classes (which could contain do-it-all code) ... While we're on the (subjective:-) subject of code quality, what other code metrics would you suggest? I'm targetting C#/.NET code, but I'm sure...

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 everything in .NET we broke our application into a main executable and several supporting DLL fil...

How to get the maintainability index?

Hello, I need help... How can I create the maintainability index with cql? Does the NDepend calculate this number? Thanks! Alejandra ...

How do I show how many lines of code my project contains in Visual Studio?

How can I show the code metrics window in Visual Studio 2008 Professional SP1? I'm looking to see how many total lines of code my project is for school and I can't find it. The help file said to go to View->Other Windows->Code Metrics, but this option is not available to me. I also tried right-clicking the project in the Solution Expl...

Use of LOC to determine project size

How many lines of code (LOC) does it take to be considered a large project? How about for just one person writing it? I know this metric is questionable, but there is a significant difference, for a single developer, between 1k and 10k LOC. I typically use space for readability, especially for SQL statements, and I try to reduce the amo...