diff --git a/analyzers/its/expected/Ember-MM/S2353-EmberAPI.json b/analyzers/its/expected/Ember-MM/S2353-EmberAPI.json deleted file mode 100644 index 8e27736caab..00000000000 --- a/analyzers/its/expected/Ember-MM/S2353-EmberAPI.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "Issues": [ - { - "Id": "S2353", - "Message": "Rename this property to \u0027Item\u0027.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/EmberAPI/clsAPIDVD.vb#L149", - "Location": "Line 149 Position 30-57" - }, - { - "Id": "S2353", - "Message": "Rename this property to \u0027Item\u0027.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/EmberAPI/clsAPIDVD.vb#L62", - "Location": "Line 62 Position 30-41" - }, - { - "Id": "S2353", - "Message": "Rename this property to \u0027Item\u0027.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/EmberAPI/clsAPIDVD.vb#L90", - "Location": "Line 90 Position 30-42" - } - ] -} \ No newline at end of file diff --git a/analyzers/rspec/vbnet/S2353.html b/analyzers/rspec/vbnet/S2353.html deleted file mode 100644 index 5985bdfe0dc..00000000000 --- a/analyzers/rspec/vbnet/S2353.html +++ /dev/null @@ -1,29 +0,0 @@ -

This rule is deprecated, and will eventually be removed.

-

Why is this an issue?

-

In most cases, indexed properties should be named Item for consistency. Exceptions are when there exists a name which is obviously better, for -example System.String.Chars(System.Int32).

-

Noncompliant code example

-
-Module Module1
-    Dim array = {"apple", "banana", "orange", "strawberry"}
-
-    ReadOnly Property Foo(ByVal index As Integer)  ' Noncompliant
-        Get
-            Return array(index)
-        End Get
-    End Property
-End Module
-
-

Compliant solution

-
-Module Module1
-    Dim array = {"apple", "banana", "orange", "strawberry"}
-
-    ReadOnly Property Item(ByVal index As Integer)
-        Get
-            Return array(index)
-        End Get
-    End Property
-End Module
-
- diff --git a/analyzers/rspec/vbnet/S2353.json b/analyzers/rspec/vbnet/S2353.json deleted file mode 100644 index c4cd5e88510..00000000000 --- a/analyzers/rspec/vbnet/S2353.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "title": "Indexed properties should be named \"Item\"", - "type": "CODE_SMELL", - "code": { - "impacts": { - "MAINTAINABILITY": "LOW" - }, - "attribute": "IDENTIFIABLE" - }, - "status": "deprecated", - "remediation": { - "func": "Constant\/Issue", - "constantCost": "5min" - }, - "tags": [], - "defaultSeverity": "Minor", - "ruleSpecification": "RSPEC-2353", - "sqKey": "S2353", - "scope": "Main", - "quickfix": "unknown" -} diff --git a/analyzers/src/SonarAnalyzer.VisualBasic/Rules/Naming/IndexedPropertyName.cs b/analyzers/src/SonarAnalyzer.VisualBasic/Rules/Naming/IndexedPropertyName.cs deleted file mode 100644 index acb19c03552..00000000000 --- a/analyzers/src/SonarAnalyzer.VisualBasic/Rules/Naming/IndexedPropertyName.cs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2024 SonarSource SA - * mailto: contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -namespace SonarAnalyzer.Rules.VisualBasic -{ - [DiagnosticAnalyzer(LanguageNames.VisualBasic)] - public sealed class IndexedPropertyName : SonarDiagnosticAnalyzer - { - internal const string DiagnosticId = "S2353"; - private const string MessageFormat = "Rename this property to 'Item'."; - - private static readonly DiagnosticDescriptor rule = - DescriptorFactory.Create(DiagnosticId, MessageFormat); - - public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(rule); - - protected override void Initialize(SonarAnalysisContext context) - { - context.RegisterNodeAction( - c => - { - var propertyDeclaration = (PropertyStatementSyntax)c.Node; - - if (propertyDeclaration.ParameterList != null && - propertyDeclaration.ParameterList.Parameters.Any() && - propertyDeclaration.Identifier.ValueText != "Item") - { - c.ReportIssue(Diagnostic.Create(rule, propertyDeclaration.Identifier.GetLocation())); - } - }, - SyntaxKind.PropertyStatement); - } - } -} diff --git a/analyzers/tests/SonarAnalyzer.Test/PackagingTests/RuleTypeMappingVB.cs b/analyzers/tests/SonarAnalyzer.Test/PackagingTests/RuleTypeMappingVB.cs index 243ef1339b4..517e1ffd363 100644 --- a/analyzers/tests/SonarAnalyzer.Test/PackagingTests/RuleTypeMappingVB.cs +++ b/analyzers/tests/SonarAnalyzer.Test/PackagingTests/RuleTypeMappingVB.cs @@ -2277,7 +2277,7 @@ internal static class RuleTypeMappingVB // ["S2350"], // ["S2351"], ["S2352"] = "CODE_SMELL", - ["S2353"] = "CODE_SMELL", + // ["S2353"], ["S2354"] = "CODE_SMELL", ["S2355"] = "CODE_SMELL", // ["S2356"], diff --git a/analyzers/tests/SonarAnalyzer.Test/Rules/IndexedPropertyNameTest.cs b/analyzers/tests/SonarAnalyzer.Test/Rules/IndexedPropertyNameTest.cs deleted file mode 100644 index dc96aece9cc..00000000000 --- a/analyzers/tests/SonarAnalyzer.Test/Rules/IndexedPropertyNameTest.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2024 SonarSource SA - * mailto: contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using SonarAnalyzer.Rules.VisualBasic; - -namespace SonarAnalyzer.Test.Rules -{ - [TestClass] - public class IndexedPropertyNameTest - { - [TestMethod] - public void IndexedPropertyName() => - new VerifierBuilder().AddPaths("IndexedPropertyName.vb").Verify(); - } -} diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/IndexedPropertyName.vb b/analyzers/tests/SonarAnalyzer.Test/TestCases/IndexedPropertyName.vb deleted file mode 100644 index 7878d60b1ef..00000000000 --- a/analyzers/tests/SonarAnalyzer.Test/TestCases/IndexedPropertyName.vb +++ /dev/null @@ -1,20 +0,0 @@ -Namespace Tests.Diagnostics - Module Module1 - Public Property FooFoo As Integer - Public Property FooFoo2() As Integer - - Dim array As String() - - ReadOnly Property foooo(ByVal index As Integer) ' Noncompliant - Get - Return array(index) - End Get - End Property - - ReadOnly Property Item(ByVal index As Integer) ' Compliant - Get - Return array(index) - End Get - End Property - End Module -End Namespace