top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

C: Cyclomatic complexity ?

+1 vote
247 views
C: Cyclomatic complexity ?
posted Aug 14, 2014 by Harshita

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Checks cyclomatic complexity of methods against a specified limit. The complexity is measured by the number of if, while, do, for, ?:, catch, switch, case statements, and operators && and || (plus one) in the body of a constructor, method, static initializer, or instance initializer. It is a measure of the minimum number of possible paths through the source and therefore the number of required tests. Generally 1-4 is considered good, 5-7 ok, 8-10 consider re-factoring, and 11+ re-factor now !
So, assuming we’re targetting only 100% of code coverage, reducing the cyclomatic complexity of the code can help reducing the number of test cases. That’s a good benefit, but does it help dealing with this (not so) sneaky bug?
There is Eclipse metriculator plugin.
There is also cccc - an open source program to analyze code.

answer Aug 15, 2014 by Amit Kumar Pandey
...