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

**URL:** <https://community.sonarsource.com/t/sonarlint-vs-code-pycharm-python-fail-to-identify-variable-used-in-combination-of-f-string-and-raw-string/21831>\
**Category:** SonarQube Cloud\
**Tags:** python, sonarqube-ide\
**Created:** [March 19, 2020, 11:07am UTC](https://community.sonarsource.com/t/sonarlint-vs-code-pycharm-python-fail-to-identify-variable-used-in-combination-of-f-string-and-raw-string/21831 "2020-03-19T11:07:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![XD-DENG](https://avatars.discourse-cdn.com/v4/letter/x/65b543/32.png) [@XD-DENG](https://community.sonarsource.com/u/XD-DENG)\
**Post date:** [March 19, 2020, 11:07am UTC](https://community.sonarsource.com/t/sonarlint-vs-code-pycharm-python-fail-to-identify-variable-used-in-combination-of-f-string-and-raw-string/21831/1 "2020-03-19T11:07:41Z")

</div>

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

![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/2/20136b9a99ca12e31e69f1d2d40a5a904abc2828.png)

F-string used together with raw string is supported in Python 3.6+ ([https://www.python.org/dev/peps/pep-0498/#raw-f-strings](https://www.python.org/dev/peps/pep-0498/#raw-f-strings)), 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.

---

<div class="post-metadata">

**Author:** ![Nicolas\_Harraudeau](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nicolas_harraudeau/32/255_2.png) [@Nicolas\_Harraudeau](https://community.sonarsource.com/u/Nicolas_Harraudeau)\
**Post date:** [March 23, 2020, 11:13am UTC](https://community.sonarsource.com/t/sonarlint-vs-code-pycharm-python-fail-to-identify-variable-used-in-combination-of-f-string-and-raw-string/21831/2 "2020-03-23T11:13:26Z")

</div>

Hi @XD-DENG,

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](https://jira.sonarsource.com/browse/SONARPY-628) to include this issue.

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

---

<div class="post-metadata">

**Author:** ![Nicolas\_Harraudeau](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nicolas_harraudeau/32/255_2.png) [@Nicolas\_Harraudeau](https://community.sonarsource.com/u/Nicolas_Harraudeau)\
**Post date:** [March 30, 2020, 3:53pm UTC](https://community.sonarsource.com/t/sonarlint-vs-code-pycharm-python-fail-to-identify-variable-used-in-combination-of-f-string-and-raw-string/21831/3 "2020-03-30T15:53:00Z")

</div>

Hi @XD-DENG,

This issue has been fixed in the last release of our python analyzer. If you use SonarLint in connected mode with [SonarCloud](https://sonarcloud.io/), it will download this last version and the false positive will disappear.

Thank you again for reporting this issue.
