diff --git a/analyzers/its/sources/ManuallyAddedNoncompliantIssues.CS/IntentionalFindings/S4635.cs b/analyzers/its/sources/ManuallyAddedNoncompliantIssues.CS/IntentionalFindings/S4635.cs index aaa374ccfe1..e92f3af55bb 100644 --- a/analyzers/its/sources/ManuallyAddedNoncompliantIssues.CS/IntentionalFindings/S4635.cs +++ b/analyzers/its/sources/ManuallyAddedNoncompliantIssues.CS/IntentionalFindings/S4635.cs @@ -13,6 +13,6 @@ namespace IntentionalFindings public static class S4635 { public static int TestMethod() => - "Test".Substring(1).IndexOf('t', StringComparison.InvariantCulture); // Noncompliant (S4635) {{Replace 'IndexOf' with the overload that accepts an offset parameter.}} + "Test".Substring(1).IndexOf('t', StringComparison.InvariantCulture); // Noncompliant (S4635) {{Replace 'IndexOf' with the overload that accepts a startIndex parameter.}} } } diff --git a/analyzers/src/SonarAnalyzer.CSharp/Rules/StringOffsetMethods.cs b/analyzers/src/SonarAnalyzer.CSharp/Rules/StringOffsetMethods.cs index 703b185e00d..ece033bc6ad 100644 --- a/analyzers/src/SonarAnalyzer.CSharp/Rules/StringOffsetMethods.cs +++ b/analyzers/src/SonarAnalyzer.CSharp/Rules/StringOffsetMethods.cs @@ -24,7 +24,7 @@ namespace SonarAnalyzer.Rules.CSharp public sealed class StringOffsetMethods : SonarDiagnosticAnalyzer { internal const string DiagnosticId = "S4635"; - private const string MessageFormat = "Replace '{0}' with the overload that accepts an offset parameter."; + private const string MessageFormat = "Replace '{0}' with the overload that accepts a startIndex parameter."; private static readonly DiagnosticDescriptor rule = DescriptorFactory.Create(DiagnosticId, MessageFormat); diff --git a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.CSharp11.cs b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.CSharp11.cs index 1693feb92f3..279129d619a 100644 --- a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.CSharp11.cs +++ b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.CSharp11.cs @@ -6,7 +6,7 @@ public class StringOffsetMethods { public StringOffsetMethods() { - """Test""".Substring(1).IndexOf('t'); // Noncompliant {{Replace 'IndexOf' with the overload that accepts an offset parameter.}} + """Test""".Substring(1).IndexOf('t'); // Noncompliant {{Replace 'IndexOf' with the overload that accepts a startIndex parameter.}} } } } diff --git a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.cs b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.cs index ecc050799f6..000cbc2553e 100644 --- a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.cs +++ b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/StringOffsetMethods.cs @@ -6,7 +6,7 @@ public class StringOffsetMethods { public StringOffsetMethods() { - "Test".Substring(1).IndexOf('t'); // Noncompliant {{Replace 'IndexOf' with the overload that accepts an offset parameter.}} + "Test".Substring(1).IndexOf('t'); // Noncompliant {{Replace 'IndexOf' with the overload that accepts a startIndex parameter.}} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } @@ -34,7 +34,7 @@ public void StringOffsetMethodsCases(string x) "Test".IndexOfAny(new[] { 't' }); "Test".IndexOfAny(new[] { 't' }, 2); "Test".IndexOfAny(new[] { 't' }, 1, 2); - "Test".Substring(1).IndexOfAny(new[] { 't' }); // Noncompliant {{Replace 'IndexOfAny' with the overload that accepts an offset parameter.}} + "Test".Substring(1).IndexOfAny(new[] { 't' }); // Noncompliant {{Replace 'IndexOfAny' with the overload that accepts a startIndex parameter.}} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "Test".LastIndexOf('t'); @@ -42,7 +42,7 @@ public void StringOffsetMethodsCases(string x) "Test".LastIndexOf("t"); "Test".LastIndexOf("t", 1); "Test".LastIndexOf("t", 1, 3); - "Test".Substring(1).LastIndexOf('t'); // Noncompliant {{Replace 'LastIndexOf' with the overload that accepts an offset parameter.}} + "Test".Substring(1).LastIndexOf('t'); // Noncompliant {{Replace 'LastIndexOf' with the overload that accepts a startIndex parameter.}} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "Test".Substring(1).LastIndexOf("t"); // Noncompliant @@ -50,7 +50,7 @@ public void StringOffsetMethodsCases(string x) "Test".LastIndexOfAny(new[] { 't' }); "Test".LastIndexOfAny(new[] { 't' }, 1); "Test".LastIndexOfAny(new[] { 't' }, 1, 3); - "Test".Substring(1).LastIndexOfAny(new[] { 't' }); // Noncompliant {{Replace 'LastIndexOfAny' with the overload that accepts an offset parameter.}} + "Test".Substring(1).LastIndexOfAny(new[] { 't' }); // Noncompliant {{Replace 'LastIndexOfAny' with the overload that accepts a startIndex parameter.}} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ x.Substring(1).IndexOf('t'); // Noncompliant