Two methods having the same implementation are suspicious. It might be that something else was intended. Or the duplication is intentional, which becomes a maintenance burden.
Private Const CODE As String = "bounteous" Private callCount As Integer = 0 Public Function GetCode() As String callCount = callCount + 1 Return CODE End Function Public Function GetName() As String ' Noncompliant: duplicates GetCode callCount = callCount + 1 Return CODE End Function
If the identical logic is intentional, the code should be refactored to avoid duplication. For example, by having both methods call the same method or by having one implementation invoke the other.
Private Const CODE As String = "bounteous" Private callCount As Integer = 0 Public Function GetCode() As String callCount = callCount + 1 Return CODE End Function Public Function GetName() As String ' Intent is clear Return GetCode() End Function
Empty methods, methods with only one line of code and methods with the same name (overload) are ignored.