Duplicated string literals make the process of refactoring complex and error-prone, as any change would need to be propagated on all occurrences.
The following are ignored:
Use constants to replace the duplicated string literals. Constants can be referenced from many places, but only need to be updated in a single place.
Public Class Foo
Private Name As String = "foobar" ' Noncompliant
Public ReadOnly Property DefaultName As String = "foobar" ' Noncompliant
Public Sub New(Optional Value As String = "foobar") ' Noncompliant
Dim Something = If(Value, "foobar") ' Noncompliant
End Sub
End Class
Public Class Foo
Private Const Foobar As String = "foobar"
Private Name As String = Foobar
Public ReadOnly Property DefaultName As String = Foobar
Public Sub New(Optional Value As String = Foobar)
Dim Something = If(Value, Foobar)
End Sub
End Class