I am using StyleCop on my C# files and it gives the warning :
SA1108 : CSharp.Readability : A comment may not be placed within the bracketed statement
for the following block of code :
// checking if the person is born or not.
if (AgeUtilities.IsPersonBorn(person.BirthDate) == false)
{
Console.WriteLine("Error....The user is not yet born.");
}
// checking if the person's age is possible or not.
else if (AgeUtilities.IsPersonLongAgePossible(age, EXPECTEDAGELIMIT) == false)
{
Console.WriteLine("This age is not possible in Today's world.");
}
What is the significance of this warning?
StyleCop tells you that you should replace/reorganise your comment above the else-statement inside the brackets, like
// checking if the person is born or not
// if not: check if the person's age is possible or not
if (AgeUtilities.IsPersonBorn(person.BirthDate) == false)
{
Console.WriteLine("Error....The user is not yet born.");
}
else if (AgeUtilities.IsPersonLongAgePossible(age, EXPECTEDAGELIMIT) == false)
{
Console.WriteLine("This age is not possible in Today's world.");
}
Have a look here and there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With