I have a class:
public class Branches {
public double justOneIf(int a) {
double result;
if (a > 0) { result = 1.0d;
} else { result = -1.0d;
}
return result;
}
public String switches(int x) {
String result;
switch (x) {
case 0: { result = "zero";
break;
}
case 1: { result = "one";
break;
}
case 2: { result = "two";
break;
}
default: { result = "kill all humans";
}
}
return result;
}
public int deepIf(int x) {
int y;
if (x == 0) { y = 1;
} else {
if (x > 0) { y = 2;
} else { y = 3;
}
}
return y;
}
}
In OpenClover (version 4.4.1) report I got metrics for this class:
Code metricsBranches:6
...
Why just six branches here? How does clover count it?
What metrics are shown for individual methods?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.