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

Rule S1123: Add VB.NET #1428

Merged
merged 2 commits into from
Nov 29, 2022
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
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[]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared between C# & VB -> moved to shared file


== 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[]
martin-strecker-sonarsource marked this conversation as resolved.
Show resolved Hide resolved