Yes typically, it is easier to count cyclomatic as +1 for each "testing statement" (if, loops)

May be the rational is that #or: is basically the same thing as #ifFalse: and #and: is similar to #ifTrue: ?

In FAST for pharo, there is an algorithm that computes cyclomatic also, it uses the same ideas (#or: and #and: add 1 to cyclomatic)

nicolas


On 12/11/2017 18:11, Stéphane Ducasse wrote:
Normally cyclo is 
the number of paths
so 

1 for the true (the main flow)
+ on for the true and the or: the alternative flow.

Stef

On 12 Nov 2017, at 18:06, Alidra Abdelghani <alidrandco@yahoo.fr> wrote:

Hi,

I have just noticed that when calculating the cyclomatic complexity of a method, Moose adds 1 for each boolean operator in the code.
For instance, the cyclomatique complexity of 

SomeClass>>aMethod 
^true or:false 

equals 2

This is funny because I found such a thing anywhere else. 

In addition, In the method RBVisitorForFAMIXMetrics>>computeCyclomaticNumber: there is a comment that says : 

"The score is basically the number of decision points in a routine + 1. Decision points are taken to be conditionals and loops.”

but then in the code, there is another strange comment :"-- HERE STARTS THE OLD ERRORFUL IMPL --"
and some lines further :

cyclo := self cyclomaticNumber + 1 + booleanOperators.

So my question is : Why booleanOperators is used to calculate cyclomatique complexity. Wouldn’t it be simpler to do cyclo := self cyclomaticNumber + 1?

Thanks in advance
_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev

--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Julie Jonas 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France



_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev

-- 
Nicolas Anquetil
RMod team -- Inria Lille