rspec/rules/S1172/vbnet/rule.adoc

70 lines
1.4 KiB
Plaintext

== Why is this an issue?
include::../description.adoc[]
This rule raises an issue when a `private` procedure of a `Class`, `Module` or `Structure` takes a parameter without using it.
=== Exceptions
This rule doesn't raise any issue in the following contexts:
* Procedures decorated with attributes.
* Empty procedures.
* Procedures which only throw `NotImplementedException`.
* Main methods.
* `virtual`, `override` procedures.
* Interface implementations.
* Event handlers.
== How to fix it
include::../how-to-fix-it.adoc[]
=== Code examples
==== Noncompliant code example
[source,vbnet,diff-id=1,diff-type=noncompliant]
----
Private Sub DoSomething(ByVal a As Integer, ByVal b as Integer) ' "b" is unused
Compute(a)
End Sub
Private Function DoSomething2(ByVal a As Integer, ByVal b As Integer) As Integer ' "a" is unused
Compute(b)
Return b
End Function
----
==== Compliant solution
[source,vbnet,diff-id=1,diff-type=compliant]
----
Private Sub DoSomething(ByVal a As Integer)
Compute(a)
End Sub
Private Function DoSomething2(ByVal b As Integer) As Integer
Compute(b)
Return b
End Function
----
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[]