Skip to content

Commit

Permalink
Add S4143 FP repro for #2674
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-zurn-sonarsource committed Nov 7, 2019
1 parent 5a212e4 commit 28a3602
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ void SameIndexOnList(List<int> list)
list[0] = 42; // Noncompliant
}

void ListAddFP(List<int> list)
{
// FP - List.Add method should not raise any issue when used with same elements
list.Add(42); // Secondary
list.Add(42); // Noncompliant
}

void SameIndexOnArray(CustomIndexerOneArg obj)
{
obj["foo"] = 42; // Compliant, not a collection or dictionary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ Namespace Tests.TestCases
list(0) = 1 ' Noncompliant
End Sub

Private Sub ListAddFP(ByVal list As List(Of String))
list.Add("MyText") ' Secondary
list.Add("MyText") ' Noncompliant
End Sub

Private Sub SameIndexSpacedOut(ByVal names() As String)
names("a") = "a" ' Secondary
names("b") = "b"
Expand Down

0 comments on commit 28a3602

Please sign in to comment.