
## Review A dedicated reviewer checked the rule description successfully for: - [ ] logical errors and incorrect information - [ ] information gaps and missing content - [ ] text style and tone - [ ] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
81 lines
1.9 KiB
Plaintext
81 lines
1.9 KiB
Plaintext
include::../description.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,vbnet,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
<Serializable>
|
|
Public Class Foo
|
|
<OnSerializing>
|
|
Public Sub OnSerializing(ByVal context As StreamingContext) ' Noncompliant: should be private
|
|
End Sub
|
|
|
|
<OnSerialized>
|
|
Private Function OnSerialized(ByVal context As StreamingContext) As Integer ' Noncompliant: should return void
|
|
End Function
|
|
|
|
<OnDeserializing>
|
|
Private Sub OnDeserializing() ' Noncompliant: should have a single parameter of type StreamingContext
|
|
End Sub
|
|
|
|
<OnSerializing>
|
|
Public Sub OnSerializing2(Of T)(ByVal context As StreamingContext) ' Noncompliant: should have no type parameters
|
|
End Sub
|
|
|
|
<OnDeserialized>
|
|
Private Sub OnDeserialized(ByVal context As StreamingContext, ByVal str As String) ' Noncompliant: should have a single parameter of type StreamingContext
|
|
End Sub
|
|
End Class
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,vbnet,diff-id=1,diff-type=compliant]
|
|
----
|
|
<Serializable>
|
|
Public Class Foo
|
|
<OnSerializing>
|
|
Private Sub OnSerializing(ByVal context As StreamingContext)
|
|
End Sub
|
|
|
|
<OnSerialized>
|
|
Private Sub OnSerialized(ByVal context As StreamingContext)
|
|
End Sub
|
|
|
|
<OnDeserializing>
|
|
Private Sub OnDeserializing(ByVal context As StreamingContext)
|
|
End Sub
|
|
|
|
<OnDeserialized>
|
|
Private Sub OnDeserialized(ByVal context As StreamingContext)
|
|
End Sub
|
|
End Class
|
|
----
|
|
|
|
include::../resources.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Make this method [non-public | non-shared | a 'Sub' not a 'Function' | have no type parameters | have a single parameter of type 'StreamingContext'].
|
|
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|