Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve S2166: update message and sample code #1565

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rules/S2166/csharp/message.adoc
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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