Small bug in code preview highlighting for C# (verbatim strings)

9 views
Skip to first unread message

Ol...@live.co.uk

unread,
Feb 23, 2017, 9:59:27 AM2/23/17
to SonarQube
Hello!

My team and I have recently started trying out SonarQube for nightly static analysis of our codebase. So far we're enjoying using it and finding a few bugs/smells along the way.

This message is just to flag up a small bug I spotted in the code highlighting feature when viewing bugs/smells in context for C# code.

Strings are correctly highlighted, including taking escaped quotes into account, which is great. But it doesn't seem to take into account C#'s verbatim strings!
So the following kind of situation

    var myString = @"\";
    DoSomething();
    ....

results in the lines following the verbatim backslash being highlighted as if part of a string, since the backslash has been interpreted as signalling an escaped quote (which would be correct if not for the string being marked verbatim).

This appears to be a wholly superficial (and therefore minor) problem, as the tool is quite happy to report code smells and bugs occurring in what is apparently (according to the highlighter) just a string.

We are using version 6.0.

Amaury Leve

unread,
Feb 27, 2017, 11:28:53 AM2/27/17
to Ol...@live.co.uk, SonarQube
Hi Olyis,

Could you let me know which version of SonarC# you have on your SonarQube server? I can't reproduce with SonarC# 5.7 on SonarQube 6.0.

I have only been able to reproduce on earlier versions (SonarC# 5.3).

Cheers,
Amaury


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/0699cbe0-ffaf-4899-b7a6-3312eb99059b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Amaury LEVE | SonarSource
Software Developer
Reply all
Reply to author
Forward
0 new messages