Using SonarCloud, the following code now trips with vbnet:S5944:
Private Shared Function InvestigationLookup(ii As IncidentInvestigation, answer As String) As IncidentInvestigation
If String.IsNullOrEmpty(answer) Then
ii.AnswerAsInvestigationLookups = Nothing
Else
Dim ils As New List(Of InvestigationLookup)
' Issue flagged above line...
1 Like
Another case, would be:
Public Function Correspondence(ByVal id As Integer) As ActionResult
Dim c As New Correspondence With {
.Id = id
}
Return View(c)
Hi @RowlandShaw ,
Thank you for reporting this, I can confirm it as False Positive. We have similar issue already reported that you can track:
opened 08:15PM - 01 May 21 UTC
Area: VB.NET
Type: False Positive
### Description
Rule raises issue when namespace is the same as function name… .
Rule raises issue when return type is the same as function name.
Rule raises issue when declared type is same as function name
### Repro steps
```
Public Function Data() As Data.Container 'S5944 Do not make use of the implicit return value.
Dim D As Data.Container 'S5944 Do not make use of the implicit return value.
End Function
Public Function Data() As Data 'S5944 Do not make use of the implicit return value.
Dim D As Data 'S5944 Do not make use of the implicit return value.
End Function
```
* SonarLint 4.33.1
* Visual Studio version 2019
system
(system)
Closed
May 24, 2021, 4:45pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.