cyclomatic-complexity

Control flow graph & cyclometric complexity for folowing procedure

insertion_procedure (int a[], int p [], int N) { int i,j,k; for (i=0; i<=N; i++) p[i] = i; for (i=2; i<=N; i++) { k = p[i]; j = 1; while (a[p[j-1]] > a[k]) {p[j] = p[j-1]; j--} p[j] = k; } } I have to find cyclometric complexity for this code and then suggest some white box test cases...

C function only called once and cyclomatic complexity

Hi! I think this question is more about style: I have an algorithm that has a very high CC (and a lot of lines!). I want to reduce it, and it's easy since there are pieces of code that can be grouped. The problem is that doing things this way I would have a "big" function calling "small" functions which are only called once. In my opin...

Cyclomatic Complexity vs project health

I have done the code analysis for my project using VS2010. Here is my results, Maintainability Index - 75% Cyclomatic Complexity - 213 Depth of Inheritance - 7 Class Coupling - 98 Lines of Code - 747 can any body, please explain about my project health. is it doing good, bad or average? How can we interpret these results? ...

Annotations for enforcing cyclomatic complexity and LCOM constrains

Hello all, At work we are using several tools to capture several metrics (mostly cyclomatic complexity and LCOM). We use those to get warning flags and to guide pre-emptive refactoring efforts. It's been very beneficial in increasing code quality. However, the process is not tied to the build process. It is conducted separately. Moreo...

Measuring the complexity of SQL statements

The complexity of methods in most programming languages can be measured in cyclomatic complexity with static source code analyzers. Is there a similar metric for measuring the complexity of a SQL query? It is simple enough to measure the time it takes a query to return, but what if I just want to be able to quantify how complicated a qu...

Use Automapper for mapping big domain models to database objects

I would like to use Automapper to map my model objects to database objects. Let say database object is over 30 fields and I want map 10 out of 20 properties from my model. To make it more complex I need to map different properties when I update record than when I insert new record to database. The solution I'm using is to create 2 gener...

Why does list initialization with lambda causes high cyclomatic complexity?

Initialization of list with lambdas causes high IL cyclomatic complexity: why, and how remove this complexity? For example following code causes the static constructor of the class (which is actually compiler generated) to be very complex: 1 + the list count. static List<Predicate<string>> list = new List<Predicate<string>>() { s =>...