SonarLint - VS Code & PyCharm - Python: Fail to identify variable used in combination of f-string and raw-string

  • SonarLint for VS Code 1.15.0, used together with Python 3.7.4 in VS Code 1.41.1
  • SonarLint for PyCharm,, with PyCharm 2019.2.6 Professional Edition


F-string used together with raw string is supported in Python 3.6+ (, but I notice that variable used in a combination of f-string and raw string is categorized as unused by SonarLint, and a warning is raised which is a false positive to me.

This issue only arise when I use f-string combined with raw-string. If I’m purely using f-string, I don’t observe this issue.


Welcome to the community and thank you for reporting this bug.
It is indeed a false positive.

There is a similar issue on another rule. I updated the corresponding ticket to include this issue.

We should fix this soon but I can’t give a date yet.


This issue has been fixed in the last release of our python analyzer. If you use SonarLint in connected mode with SonarCloud, it will download this last version and the false positive will disappear.

Thank you again for reporting this issue.

1 Like