public void AccessPermissions(User user)
{
if (user.Age >= 18)
{
if (user.IsRegistred)
{
if (user.IsPowerfull)
{
AcessGrantLevel3();
}
else
{
AccessGrantLevel2();
}
}
else
{
AccessGrantLevel1();
}
}
else
{
AcceessDenied();
}
}
According to code metrics measurement this function is very bad and according to the clean code developemnt this function is bad for testing. What can I do to make Code Metrics and TDD happy? Is nested If statements always bad?