2020-12-21 15:38:52 +01:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,vbnet]
|
2020-12-21 15:38:52 +01:00
|
|
|
----
|
|
|
|
If BooleanMethod() = True Then ' Noncompliant
|
|
|
|
' ...
|
|
|
|
End If
|
|
|
|
If BooleanMethod() = False Then ' Noncompliant
|
|
|
|
' ...
|
|
|
|
End If
|
|
|
|
If BooleanMethod() OrElse False Then ' Noncompliant
|
|
|
|
' ...
|
|
|
|
End If
|
|
|
|
DoSomething(Not False) ' Noncompliant
|
|
|
|
DoSomething(BooleanMethod() = True) ' Noncompliant
|
|
|
|
|
|
|
|
Dim booleanVariable = If(BooleanMethod(), True, False) ' Noncompliant
|
|
|
|
booleanVariable = If(BooleanMethod(), True, exp) ' Noncompliant
|
|
|
|
booleanVariable = If(BooleanMethod(), False, exp) ' Noncompliant
|
|
|
|
booleanVariable = If(BooleanMethod(), exp, True) ' Noncompliant
|
|
|
|
booleanVariable = If(BooleanMethod(), exp, False) ' Noncompliant
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,vbnet]
|
2020-12-21 15:38:52 +01:00
|
|
|
----
|
|
|
|
If BooleanMethod() Then
|
|
|
|
' ...
|
|
|
|
End If
|
|
|
|
If Not BooleanMethod() Then
|
|
|
|
' ...
|
|
|
|
End If
|
|
|
|
If BooleanMethod() Then
|
|
|
|
' ...
|
|
|
|
End If
|
|
|
|
DoSomething(True)
|
|
|
|
DoSomething(BooleanMethod())
|
|
|
|
|
|
|
|
Dim booleanVariable = BooleanMethod()
|
|
|
|
booleanVariable = BooleanMethod() OrElse exp
|
|
|
|
booleanVariable = Not BooleanMethod() AndAlso exp
|
|
|
|
booleanVariable = Not BooleanMethod() OrElse exp
|
|
|
|
booleanVariable = BooleanMethod() AndAlso exp
|
|
|
|
----
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|