rspec/rules/S2758/csharp/rule.adoc

41 lines
696 B
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,csharp]
----
public bool CanVote(Person person)
{
return person.GetAge() > 18 ? true : true; // Noncompliant; is this what was intended?
}
----
=== Compliant solution
[source,csharp]
----
public bool CanVote(Person person)
{
return person.GetAge() > 18 ? true : false;
// or even better:
// return person.GetAge() > 18;
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]