Skip to main content
Software Engineering

Questions tagged [cyclomatic-complexity]

The tag has no summary.

Filter by
Sorted by
Tagged with
3 votes
2 answers
137 views

cyclomatic complexity, number of tests for full coverage?

Wikipedia says that following program has cyclomatic complexity of 3 Given that formula is V-E+2P, the answer is definitely 3 (9 - 8 + 2*1 = 3). Alternative definition says: Number of tests to cover ...
3 votes
4 answers
445 views

Reducing cyclomatic complexity of a state machine

I have a function (written in Python) that processes a loosely structured log file. The log file would have begin-end markers for different sections, with each section describing different things (e.g....
3 votes
1 answer
440 views

Why does this activity diagram not have the same amount of paths as the cyclomatic complexity number?

For the example shown below, in which I added the True and False values over the original document (so if something is wrong there, it's probably my fault), I understand there should be seven states ...
0 votes
3 answers
709 views

Reducing Cognitive Complexity of Single-Responsibility "Arrow-Code"

Prompted by Sonar, I am looking to reduce the complexity of a function (one that some might call arrow code). I am loosely familiar with some of the principles of reducing arrow code complexity (...
-1 votes
1 answer
196 views

Optimizing methods with multiple if checks on getter values

I have a method where I fetch user input, check if certain values exist, and based on that build my own custom input object that I would use to search in a database. The code for the search method is ...
2 votes
0 answers
154 views

A question about cyclomatic complexity

Assume the flow graph of a function is below (sorry I have forgotten the code of the function): And when I try to calculate the cyclomatic complexity: When I use the edge and node to calculate it, V(...
4 votes
2 answers
2k views

Summing cyclomatic complexity of function or files

Is the sum of the cyclomatic complexity of all section in a file the total cyclomatic complexity for this file? If it is, is the sum of a set of related files the total cyclomatic complexity for this ...
12 votes
2 answers
54k views

if and else or if and return?

I have a Java method with a void type of return that checks a condition. It do something in case of true and other thing in case of false, typical if / else structure, but is possible use only the if ...
Orici's user avatar
  • 237
3 votes
4 answers
1k views

Are short-circuiting paths considered for path coverage?

In a book Doron A. Peled, he states that " path coverage does not subsume multiple condition coverage because you can execute all the paths without exercising all the conditions. But I believe ...
1 vote
1 answer
1k views

How to compute cyclomatic complexity for empty whiles and if + breaks?

This is closely related to this question which asks about the complexity of the following: while (x > level) x = x – 1; x = 0 Using the graph method it has a Complexity = 2. Fred Swartz ...
3 votes
1 answer
1k views

Cyclomatic Complexity Question

I have a general question pertaining to Cyclomatic Complexity. Please have a look at the attached source code: private void downShift(int index) { // index of "child", which will be either index *...
0 votes
3 answers
1k views

Code pattern to have the least possible code complexity (Javascript)

I've been looking for the ideal coding patterns used to score well in a Cyclomatic Complexity. Of course, code will be subject to change according to what is being developed but regardless the ...
0 votes
2 answers
2k views

Relation between LOC and Cyclomatic Complexity

Is there something that ratio of the metrics LOC and Sum Cyclomatic Complexity in a project with many modules can talk about? Does it show the logical complexity of a module/project?
1 vote
1 answer
82 views

Can basis path technique (derived from cyclomatic complexity) be used on non-source code?

I know that McCabe basis path testing ensures that all linearly independent paths are tested, making sure that all code branches were covered in an effective manner. But nowadays, I doubt anybody ...
0 votes
1 answer
2k views

Calculating cyclomatic complexity/ mccab's number

if field is blank or in form print "enter again" else if no credit and debit < 1000 print "less amount" else print "accessed" end if end if I'm very confused in calculating the cyclomatic ...

15 30 50 per page
1
2 3

AltStyle によって変換されたページ (->オリジナル) /