rspec/rules/S2758/csharp/rule.adoc
2020-06-30 17:16:12 +02:00

22 lines
378 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
----
public bool CanVote(Person person)
{
return person.GetAge() > 18 ? true : true; // Noncompliant; is this what was intended?
}
----
== Compliant Solution
----
public bool CanVote(Person person)
{
return person.GetAge() > 18 ? true : false;
// or even better:
// return person.GetAge() > 18;
}
----