Skip to content

Commit

Permalink
Update rule message and VB.NET sample code (#1565)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsolt-kolbay-sonarsource committed Feb 9, 2023
1 parent 457586d commit 5c16542
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions rules/S2166/csharp/message.adoc
@@ -0,0 +1,4 @@
=== Message

Rename this class to remove "Exception" or correct its inheritance.

2 changes: 1 addition & 1 deletion rules/S2166/csharp/rule.adoc
Expand Up @@ -48,7 +48,7 @@ ifdef::env-github,rspecator-view[]
== Implementation Specification
(visible only on this page)

include::../message.adoc[]
include::message.adoc[]

'''
== Comments And Links
Expand Down
4 changes: 4 additions & 0 deletions rules/S2166/vbnet/message.adoc
@@ -0,0 +1,4 @@
=== Message

Rename this class to remove "Exception" or correct its inheritance.

6 changes: 3 additions & 3 deletions rules/S2166/vbnet/rule.adoc
Expand Up @@ -12,7 +12,7 @@ Public Class FruitException ' Noncompliant - this has nothing to do with Excepti
End Class
Public Class CarException ' Noncompliant - does not derive from any Exception-based class
Public Sub New(ByVal message As String, ByVal inner As Exception)
Public Sub New(message As String, inner As Exception)
' ...
End Sub
End Class
Expand All @@ -30,7 +30,7 @@ Public Class FruitSport ' Compliant - class name does not end with 'Exception'
End Class
Public Class CarException Inherits Exception ' Compliant - correctly extends System.Exception
Public Sub New(ByVal message As String, ByVal inner As Exception)
Public Sub New(message As String, inner As Exception)
MyBase.New(message, inner)
' ...
End Sub
Expand All @@ -44,7 +44,7 @@ ifdef::env-github,rspecator-view[]
== Implementation Specification
(visible only on this page)

include::../message.adoc[]
include::message.adoc[]

'''
== Comments And Links
Expand Down

0 comments on commit 5c16542

Please sign in to comment.