71 lines
1.2 KiB
Plaintext
71 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,vbnet]
|
|
----
|
|
Public Class Foo
|
|
|
|
Private Name As String = "foobar" ' Noncompliant
|
|
|
|
Public ReadOnly Property DefaultName As String = "foobar" ' Noncompliant
|
|
|
|
Public Sub New(Optional Value As String = "foobar") ' Noncompliant
|
|
|
|
Dim Something = If(Value, "foobar") ' Noncompliant
|
|
|
|
End Sub
|
|
|
|
End Class
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,vbnet]
|
|
----
|
|
Public Class Foo
|
|
|
|
Private Const Foobar As String = "foobar"
|
|
|
|
Private Name As String = Foobar
|
|
|
|
Public ReadOnly Property DefaultName As String = Foobar
|
|
|
|
Public Sub New(Optional Value As String = Foobar)
|
|
|
|
Dim Something = If(Value, Foobar)
|
|
|
|
End Sub
|
|
|
|
End Class
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
The following are ignored:
|
|
|
|
* literals with fewer than 5 characters
|
|
* literals matching one of the parameter names
|
|
* literals used in attributes
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::../parameters.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|