Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool to calculate Cyclomatic Complexity for C code [closed]

I want a tool to analyse my code quality and after a bit of googling I think I understand that Cyclomatic Complexity could be something to start with here. I have tried to get several tools working but without success (found out that most are developed for Java). My requirements are:

  • Should work on C code
  • Should work on Ubuntu (12.04)
  • Should be free
  • (Optional) Plugin for eclipse

I would be grateful for any help

like image 388
Olppah Avatar asked Mar 19 '14 07:03

Olppah


People also ask

How is Cyclomatic Complexity calculated in C?

3) Cyclomatic complexity V(G) = P +1 V (G) = 2 + 1 = 3 Where P is predicate nodes (node 1 and node 2) are predicate nodes because from these nodes only the decision of which path is to be followed is taken. Thus Cyclomatic complexity is 3 for given code.

Which methods are used to measure Cyclomatic Complexity?

Cyclomatic complexity of a code section is the quantitative measure of the number of linearly independent paths in it. It is a software metric used to indicate the complexity of a program. It is computed using the Control Flow Graph of the program.

How many methods are available to calculate Cyclomatic Complexity of a program?

Three methods of evaluating the cyclomatic complexity of the graph.


1 Answers

There is Eclipse metriculator plugin.

There is also cccc - an open source program to analyze code.

like image 132
BЈовић Avatar answered Oct 13 '22 11:10

BЈовић