Sonar wrongly flags code as SQL spacing bugs

How is this flagging? Exception is not a SQL statement. Isn’t whitespace optional in SQL queries? Is this a configuration issue?

Hey there. Thanks for the report. It looks like we fixed some FNs in this rule recently, maybe it had some impact ((FN S2857: No issue is raised when in file scoped namespace · Issue #5981 · SonarSource/sonar-dotnet · GitHub and FN S2857: No issue is raised if the malformed SQL query is formatted with the help of constant interpolated strings · Issue #5942 · SonarSource/sonar-dotnet · GitHub)).

I’ve moved your post to the section on reporting false-positives. Please read this post:

And update your thread with a snippet of code, rather than a screenshot. That way we can flag it for the appropriate team.

1 Like

Hi Colin,

Thank you for your prompt response. After the FNs were fixed, we verified that the SQL errors/flags are no longer showing anymore.