Which rule?
csharpsquid:S3453 and csharpsquid:S1144
Why do you believe it’s a false-positive/false-negative?
I do indeed use this private constructor in a static list just with the new keyword instead of the full qualified class name.
Are you using
SonarQube Cloud?
Yes sonarcloud team services
SonarQube for IDE - which IDE/version?
10.22.0.81244 in connected mode with our sonarcloud
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)’
The file creating the issue is in the following github gist. I anonymized the file but the issue remains the same.
Unfortunately I cannot reproduce the issue. Can you confirm that I got everything correct?
I had to simplify the code snippet a bit, but that shouldn’t change much. Does this snippet raise S1144 for you?
internal class LogConverter
{
private LogConverter(string regex, string alertType)
{
AlertType = alertType;
}
public string AlertType { get; }
public static readonly LogConverter[] Converters =
[
new("^AGV route completed", "0xAAFF0001"),
new("^AGV route failed during execution", "0xAAFF0002"),
];
}
You are using SonarQube for IDE in IntelliJ’s Rider (I inferred that from the version you mentioned).
We did not touch S1144 in a while and the version you are using is recent. So it’s not quite obvious what could be different. Please double check that my reproduction attempt does in fact raise the issue for you and then I’ll try to investigate deeper.
I tried to reproduce it today with both the sample and the code that originally caused the issue. I am now unable to reproduce this issue myself in either the IDE or sonarcloud.io.
I’m not sure what happend or if I mis saw this but I think we can close this topic since there is no way to move forward and the issue seems resolved.