rspec/rules/S3358/vbnet/rule.adoc

22 lines
450 B
Plaintext
Raw Normal View History

2020-06-30 12:48:39 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
Public Function GetTitle(ByVal p As Person) As String
Return If(p.Gender = Gender.MALE, "Mr. ", If(p.IsMarried, "Mrs. ", "Miss ")) ' Noncompliant
End Function
----
== Compliant Solution
----
Public Function GetTitle(ByVal p As Person) As String
If p.Gender = Gender.MALE Then
Return "Mr. "
End If
Return If(p.IsMarried, "Mrs. ", "Miss ")
End Function
----