# FP sonarlint(python:S1481)

**URL:** <https://community.sonarsource.com/t/fp-sonarlint-python-s1481/114653>\
**Category:** Report False-positive / False-negative...\
**Tags:** python, sonarqube-ide\
**Created:** [May 2, 2024, 7:41pm UTC](https://community.sonarsource.com/t/fp-sonarlint-python-s1481/114653 "2024-05-02T19:41:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_Nord](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mathias_nord/32/57181_2.png) [@Mathias\_Nord](https://community.sonarsource.com/u/Mathias_Nord)\
**Post date:** [May 2, 2024, 7:41pm UTC](https://community.sonarsource.com/t/fp-sonarlint-python-s1481/114653/1 "2024-05-02T19:41:36Z")

</div>

- What language is this for? Python 3.10
- Which rule? S1481
- Why do you believe it’s a false-positive/false-negative? Variable reported as unused is used
- Are you using
  - SonarLint 4.5.1 - which IDE/version?  
Visual Studio Code  
Version: 1.88.1  
Commit: e170252f762678dec6ca2cc69aba1570769a5d39  
Date: 2024-04-10T17:34:12.840Z  
Electron: 28.2.8  
ElectronBuildId: 27744544  
Chromium: 120.0.6099.291  
Node.js: 18.18.2  
V8: 12.0.267.19-electron.0  
OS: Linux x64 6.5.0-28-generic
    - in connected mode with SonarQube or SonarCloud? No

- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)

```auto
def add_to_dict(values: dict):
    values |= dict(b=2) # Remove the unused local variable "values".sonarlint(python:S1481)

if __name__ == ' __main__':
    d = dict(a=1)
    print("Before:", d)
    add_to_dict(d)
    print("After:", d)

```

---

<div class="post-metadata">

**Author:** ![ghislain.piot](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@ghislain.piot](https://community.sonarsource.com/u/ghislain.piot)\
**Post date:** [May 3, 2024, 8:23am UTC](https://community.sonarsource.com/t/fp-sonarlint-python-s1481/114653/5 "2024-05-03T08:23:03Z")

</div>

Hello,

I have successfully reproduced the issue and created [SONARPY-1814](https://sonarsource.atlassian.net/browse/SONARPY-1814) to address it.

Have a nice day,  
Ghislain
