Versions:
- SonarQube: Community Edition - Version 9.9.3
- Scanner: 6.2.0.85879
Following code I get reported as issue csharpsquid:S1854:
int_Position = str_Option.IndexOfAny(new[]
{
':',
'='
});
if(int_Position == -1)
{
obj_Options.Add(str_Option.Substring(1),
String.Empty);
}
else
{
obj_Options.Add(str_Option.Substring(1, int_Position - 1),
str_Option.Substring(++int_Position));
}
The code obj_Options.Add(str_Option.Substring(1, int_Position - 1), str_Option.Substring(++int_Position));
takes the left length of the string by calculation and then right part after increment the position variable. May be another calculation is awaited here?