
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
72 lines
1.3 KiB
Plaintext
72 lines
1.3 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Using the ``++With++`` statement for a series of calls to the same object makes the code more readable.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
With the default value of 6:
|
|
|
|
[source,vbnet]
|
|
----
|
|
Module Module1
|
|
Dim product = New With {.Name = "paperclips", .RetailPrice = 1.2, .WholesalePrice = 0.6, .A = 0, .B = 0, .C = 0}
|
|
|
|
Sub Main()
|
|
product.Name = "" ' Noncompliant
|
|
product.RetailPrice = 0
|
|
product.WholesalePrice = 0
|
|
product.A = 0
|
|
product.B = 0
|
|
product.C = 0
|
|
End Sub
|
|
End Module
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,vbnet]
|
|
----
|
|
Module Module1
|
|
Dim product = New With {.Name = "paperclips", .RetailPrice = 1.2, .WholesalePrice = 0.6, .A = 0, .B = 0, .C = 0}
|
|
|
|
Sub Main()
|
|
With product
|
|
.Name = ""
|
|
.RetailPrice = 0
|
|
.WholesalePrice = 0
|
|
.A = 0
|
|
.B = 0
|
|
.C = 0
|
|
End With
|
|
End Sub
|
|
End Module
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Wrap this and the following n statements that use "xxx" in a "With" statement.
|
|
|
|
|
|
=== Parameters
|
|
|
|
.minimumSeriesLength
|
|
****
|
|
|
|
----
|
|
6
|
|
----
|
|
|
|
Minimum length a series must have to trigger an issue.
|
|
****
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|