rspec/rules/S1192/vbnet/rule.adoc

67 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-01-21 04:09:13 +00:00
include::../description.adoc[]
== Noncompliant Code Example
----
Public Class Foo
2021-01-23 04:07:47 +00:00
Private Name As String = "foobar" ' Noncompliant
2021-01-21 04:09:13 +00:00
Public ReadOnly Property DefaultName As String = "foobar" ' Noncompliant
2021-01-23 04:07:47 +00:00
Public Sub New(Optional Value As String = "foobar") ' Noncompliant
2021-01-21 04:09:13 +00:00
2021-01-23 04:07:47 +00:00
Dim Something = If(Value, "foobar") ' Noncompliant
2021-01-21 04:09:13 +00:00
End Sub
End Class
----
== Compliant Solution
----
Public Class Foo
Private Const Foobar As String = "foobar"
2021-01-23 04:07:47 +00:00
Private Name As String = Foobar
2021-01-21 04:09:13 +00:00
Public ReadOnly Property DefaultName As String = Foobar
2021-01-23 04:07:47 +00:00
Public Sub New(Optional Value As String = Foobar)
2021-01-21 04:09:13 +00:00
2021-01-23 04:07:47 +00:00
Dim Something = If(Value, Foobar)
2021-01-21 04:09:13 +00:00
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[]