rspec/rules/S5332/vbnet/rule.adoc
Fred Tingaud 51369b610e
Make sure that includes are always surrounded by empty lines (#2270)
When an include is not surrounded by empty lines, its content is inlined
on the same line as the adjacent content. That can lead to broken tags
and other display issues.
This PR fixes all such includes and introduces a validation step that
forbids introducing the same problem again.
2023-06-22 10:38:01 +02:00

54 lines
1.2 KiB
Plaintext

include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
[source,vbnet]
----
Dim UrlHttp As String = "http://example.com" ' Noncompliant
Dim UrlFtp As String = "ftp://anonymous@example.com" ' Noncompliant
Dim UrlTelnet As String = "telnet://anonymous@example.com" ' Noncompliant
----
[source,vbnet]
----
Using Smtp As New SmtpClient("host", 25) ' Noncompliant, EnableSsl Is Not Set
End Using
Using Telnet As New MyTelnet.Client("host", port) ' Noncompliant, rule raises Security Hotspot On any member containing "Telnet"
End Using
----
== Compliant Solution
[source,vbnet]
----
Dim UrlHttps As String = "https://example.com"
Dim UrlSftp As String = "sftp://anonymous@example.com"
Dim UrlSsh As String = "ssh://anonymous@example.com"
----
[source,vbnet]
----
Using Smtp As New SmtpClient("host", 25) With {.EnableSsl = True}
End Using
Using Ssh As New MySsh.Client("host", port)
End Using
----
include::../exceptions.adoc[]
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
endif::env-github,rspecator-view[]