rspec/rules/S107/vb6/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

52 lines
1.1 KiB
Plaintext

== Why is this an issue?
A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the procedure is doing too many things.
=== Noncompliant code example
With a maximum number of 3 parameters:
[source,vb6]
----
Public Sub Foo(ByVal p1 As Integer, ByVal p2 As Integer, ByVal p3 As Integer, ByVal p4 As Integer) ' Noncompliant
' ...
End Sub
Public Function Bar(ByVal p1 As Integer, ByVal p2 As Integer, ByVal p3 As Integer, ByVal p4 As Integer) ' Noncompliant
' ...
End Function
----
=== Compliant solution
[source,vb6]
----
Public Sub Foo(ByVal p1 As Integer, ByVal p2 As Integer, ByVal p3 As Integer)
' ...
End Sub
Public Function Bar(ByVal p1 As Integer, ByVal p2 As Integer, ByVal p3 As Integer)
' ...
End Function
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
[Function|Sub] has {0} parameters, which is greater than the {1} authorized.
include::../parameters.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]