Created
November 7, 2015 20:51
-
-
Save erikdietrich/1b7cf5a1c1b3070469af to your computer and use it in GitHub Desktop.
The second installment of the experiment is about cyclomatic complexity.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace CodeReadability | |
{ | |
public class CyclomaticComplexity | |
{ | |
public int First(int number) | |
{ | |
if (number % 12 == 0) | |
return 12; | |
return number; | |
} | |
public int Second(int number) | |
{ | |
if(number > 15 || number < -234) | |
{ | |
return 0; | |
} | |
else if(number > 10) | |
{ | |
if (number == 8) | |
return 22; | |
return 4; | |
} | |
return 9; | |
} | |
public int Third(int number) | |
{ | |
if (number == 8) | |
return 93; | |
if(number > 0) | |
{ | |
if(number % 2 == 0) | |
{ | |
return 2; | |
} | |
else if(number % 3 == 0) | |
{ | |
return 26; | |
} | |
else if(number % 5 == 0) | |
{ | |
return 5; | |
} | |
else | |
{ | |
if (number == 49) | |
return 18; | |
return 10; | |
} | |
} | |
else | |
{ | |
if(number > -15) | |
{ | |
if (number > -100) | |
return number; | |
else if (number > -50) | |
return -24; | |
} | |
return 33; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment