Skip to content

Commit

Permalink
Rule S1123: Add VB.NET (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-mikula-sonarsource authored and irina-batinic-sonarsource committed Dec 5, 2022
1 parent f18ff13 commit 95ab345
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 14 deletions.
9 changes: 9 additions & 0 deletions rules/S1123/comments-and-links.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
=== on 21 Jan 2015, 17:47:31 Nicolas Peru wrote:
\[~ann.campbell.2] I don't think this is a relevant for java as we already have \http://jira.sonarsource.com/browse/RSPEC-1123

=== on 22 Jan 2015, 07:41:48 Ann Campbell wrote:
\[~nicolas.peru] does RSPEC-1123 set an issue when @Deprecated/@deprecated does not include explanatory text?

=== on 11 May 2015, 09:20:36 Dinesh Bolkensteyn wrote:
LGTM

=== on 18 Jul 2013, 07:31:52 Dinesh Bolkensteyn wrote:
Implemented by \http://jira.codehaus.org/browse/SONARJAVA-214

10 changes: 0 additions & 10 deletions rules/S1123/csharp/comments-and-links.adoc

This file was deleted.

8 changes: 4 additions & 4 deletions rules/S1123/csharp/rule.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The ``++Obsolete++`` attribute can be applied with or without arguments, but marking something ``++Obsolete++`` without including advice as to why it's obsolete or on what to use instead will lead maintainers to waste time trying to figure those things out - every single time the warning is encountered.
include::../description-dotnet.adoc[]

== Noncompliant Code Example

Expand All @@ -8,7 +8,7 @@ public class Car
{
[Obsolete] // Noncompliant
public void CrankEngine(int turnsOfCrank)
public void CrankEngine(int turnsOfCrank)
{ ... }
}
----
Expand All @@ -21,7 +21,7 @@ public class Car
{
[Obsolete("Replaced by the automatic starter")]
public void CrankEngine(int turnsOfCrank)
public void CrankEngine(int turnsOfCrank)
{ ... }
}
----
Expand All @@ -38,5 +38,5 @@ include::message.adoc[]
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
1 change: 1 addition & 0 deletions rules/S1123/description-dotnet.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `Obsolete` attribute can be applied with or without a message argument. Marking something `Obsolete` without including advice on why it's obsolete or what to use instead will lead maintainers to waste time trying to figure those things out.
4 changes: 4 additions & 0 deletions rules/S1123/vbnet/message.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=== Message

Add an explanation.

3 changes: 3 additions & 0 deletions rules/S1123/vbnet/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title": "\"Obsolete\" attributes should include explanations"
}
44 changes: 44 additions & 0 deletions rules/S1123/vbnet/rule.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
include::../description-dotnet.adoc[]

== Noncompliant Code Example

[source,vbnet]
----
Public Class Car
<Obsolete> ' Noncompliant
Public Sub CrankEngine(Turns As Integer)
' ...
End Sub
End Class
----

== Compliant Solution

[source,vbnet]
----
Public Class Car
<Obsolete("Replaced by the automatic starter")>
Public Sub CrankEngine(Turns As Integer)
' ...
End Sub
End Class
----

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[]

0 comments on commit 95ab345

Please sign in to comment.