Skip to content

Instantly share code, notes, and snippets.

@WonderBeat
Created July 25, 2013 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WonderBeat/6078981 to your computer and use it in GitHub Desktop.
Save WonderBeat/6078981 to your computer and use it in GitHub Desktop.
Cyclomatic complexyty by 2.10 chackstyle
public class Main {
/**
* 7
**/
public static int method_got7(int a) {
switch(a) {
case 1: return 2;
case 2: return 3;
case 3: return 4;
case 4: return 5;
case 5: return 1;
case 6: return 3;
}
return 3;
}
/**
* 4
**/
public static int method_got4(int a) {
switch(a) {
case 1:
case 2:
case 3: return 1;
default: return 3;
}
}
/**
* 4
**/
public static int methodA_got4(int a) {
if (a == 1 || a == 2 || a == 3) {
return 5;
} else {
return 6;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment