rspec/rules/S2758/csharp/rule.adoc

30 lines
542 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;
}
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]