I have a block of code that I am having an issue reducing the cyclomatic complexity of. Because of the multiple conditions that have to match, I am not sure the best way to break it down further. Complicating matters is that in 2 of the cases a new object is created, but not in the third (it calls out to another method). This is the pseudocode:
if (!cond3 && !cond1 && cond2 && cond4) {
// actions to perform
calculateValues();
return result;
} else if (!cond1 && cond2 && cond3) {
// actions to perform
Object result = new Result();
return result;
} else if (!cond4 && cond3 && cond1 && cond5) {
// actions to perform
Object result = new Result();
return result;
} else {
// throw error because inputs are invalid
}