Modify rule S2225: Add VB.NET (#1062)
This commit is contained in:
parent
1798aee443
commit
d97e324e11
3
rules/S2225/vbnet/metadata.json
Normal file
3
rules/S2225/vbnet/metadata.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"title": "\"ToString()\" method should not return Nothing"
|
||||||
|
}
|
36
rules/S2225/vbnet/rule.adoc
Normal file
36
rules/S2225/vbnet/rule.adoc
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Calling `ToString()` on an object should always return a string. Returning `Nothing` instead contravenes the method's implicit contract.
|
||||||
|
|
||||||
|
== Noncompliant Code Example
|
||||||
|
|
||||||
|
[source,vbnet]
|
||||||
|
----
|
||||||
|
Public Overrides Function ToString() As String
|
||||||
|
Return Nothing
|
||||||
|
End Function
|
||||||
|
----
|
||||||
|
|
||||||
|
== Compliant Solution
|
||||||
|
|
||||||
|
[source,vbnet]
|
||||||
|
----
|
||||||
|
Public Overrides Function ToString() As String
|
||||||
|
Return ""
|
||||||
|
End Function
|
||||||
|
----
|
||||||
|
|
||||||
|
include::../see.adoc[]
|
||||||
|
|
||||||
|
ifdef::env-github,rspecator-view[]
|
||||||
|
|
||||||
|
'''
|
||||||
|
== Implementation Specification
|
||||||
|
(visible only on this page)
|
||||||
|
|
||||||
|
include::../message.adoc[]
|
||||||
|
|
||||||
|
'''
|
||||||
|
== Comments And Links
|
||||||
|
(visible only on this page)
|
||||||
|
|
||||||
|
include::../comments-and-links.adoc[]
|
||||||
|
endif::env-github,rspecator-view[]
|
Loading…
x
Reference in New Issue
Block a user