# Python:S5655 incorrectly applying to Enum on startup of VS Code

**URL:** <https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620>\
**Category:** VS Code\
**Tags:** python, vscode, sonarqube, sonarqube-ide\
**Created:** [December 4, 2024, 10:05pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620 "2024-12-04T22:05:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbvirt](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jbvirt/32/56129_2.png) [@jbvirt](https://community.sonarsource.com/u/jbvirt)\
**Post date:** [December 4, 2024, 10:05pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/1 "2024-12-04T22:05:00Z")

</div>

Please provide

- Operating system:
  - Windows - VS Code

- SonarLint plugin version:
  - SonarQube for IDE v4.13.0

- Programming language you’re coding in:
  - Python

- Is connected mode used:
  - No and SonarServer

And a thorough description of the problem / question:

I have the following code:

```python
from http import HTTPStatus

def response(message: str, status_code: HTTPStatus):
    #This is a test.
    pass

response("Blah", HTTPStatus.OK)

```

When launching VS Code, the SonarQube plugin says that my call to `response` with `HTTPStatus.OK` is a violation of [RSPEC-5655](https://rules.sonarsource.com/python/RSPEC-5655/). This doesn’t make sense as I am literally passing in an `HTTPStatus` equivalent object.

If I change `status_code` to be of type `int`, then the warning goes away. Then if I change it back the warning flashes for a second before going away in that file. It stays gone until I restart VS Code.

This seems like a bug in SonarQube’s rule parsing.

---

<div class="post-metadata">

**Author:** ![sophio.japharidze](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sophio.japharidze/32/34536_2.png) [@sophio.japharidze](https://community.sonarsource.com/u/sophio.japharidze)\
**Post date:** [December 5, 2024, 3:26pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/4 "2024-12-05T15:26:15Z")

</div>

Hi there!

Thanks for reporting this behavior. I think it has two parts—one about a False Positive report from the rule and another about issues coming and suddenly disappearing.

For the latter, we have just released SonarQube for VSCode (formerly SonarLint) v4.13.1. Could you please update and let us know if your issue persists?

All the best,  
Sophio

---

<div class="post-metadata">

**Author:** ![jbvirt](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jbvirt/32/56129_2.png) [@jbvirt](https://community.sonarsource.com/u/jbvirt)\
**Post date:** [December 5, 2024, 6:56pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/5 "2024-12-05T18:56:34Z")

</div>

The issue now does reappear, so yes, the only remaining issue is the false positive.  
Thank you.

---

<div class="post-metadata">

**Author:** ![sophio.japharidze](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sophio.japharidze/32/34536_2.png) [@sophio.japharidze](https://community.sonarsource.com/u/sophio.japharidze)\
**Post date:** [December 6, 2024, 7:40am UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/6 "2024-12-06T07:40:27Z")

</div>

Great!

Could you please share a screenshot where you see the false positive? I will flag this for the relevant team in the meantime.

All the best,  
Sophio

---

<div class="post-metadata">

**Author:** ![jbvirt](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jbvirt/32/56129_2.png) [@jbvirt](https://community.sonarsource.com/u/jbvirt)\
**Post date:** [December 6, 2024, 11:13pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/9 "2024-12-06T23:13:18Z")

</div>

Here is an example of the warning appearing in my project.  
It does NOT seem to appear in a standalone project where I attempt to replicate the issue, which is odd.

 ![Screenshot 2024-12-06 151121](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/2/a/2a6571c3a0adc27202bdf17000adb7bf559ced3e.png)

---

<div class="post-metadata">

**Author:** ![jbvirt](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jbvirt/32/56129_2.png) [@jbvirt](https://community.sonarsource.com/u/jbvirt)\
**Post date:** [December 6, 2024, 11:35pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/10 "2024-12-06T23:35:04Z")

</div>

I was able to replicate it.  
Ensuring that the rule `Python:S5655` is **enabled** , I create a new file with the original code in VS Code and change the type `HTTPStatus` to a `str` in `__response`. This (correctly) causes an error to appear.

Then revert the type back to `HTTPStatus`. The error appears and persists through restarts.

---

<div class="post-metadata">

**Author:** ![maksim.grebeniuk](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@maksim.grebeniuk](https://community.sonarsource.com/u/maksim.grebeniuk)\
**Post date:** [December 9, 2024, 9:54am UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/11 "2024-12-09T09:54:22Z")

</div>

Hello @jbvirt,

Thank you one more time for reporting this false positive.  
I have created the [SONARPY-2421](https://sonarsource.atlassian.net/jira/software/c/projects/SONARPY/issues/SONARPY-2421) ticket to fix the issue.

Thanks,  
Maksim Grebeniuk

---

<div class="post-metadata">

**Author:** ![kera-c](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/kera-c/32/72061_2.png) [@kera-c](https://community.sonarsource.com/u/kera-c)\
**Post date:** [September 1, 2025, 4:20pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/13 "2025-09-01T16:20:41Z")

</div>

Was this issue ever fixed?

I am seeing the same behaviour of this false positive being reported in IntelliJ when using HTTPStatus Enums, and can replicate the error using the example code shown above:

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/9/2/92618e2337445e037e5db7f3d4c03a5e050d7c5c.png)

---

<div class="post-metadata">

**Author:** ![sebastian.zumbrunn](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sebastian.zumbrunn/32/64172_2.png) [@sebastian.zumbrunn](https://community.sonarsource.com/u/sebastian.zumbrunn)\
**Post date:** [September 10, 2025, 8:53am UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/15 "2025-09-10T08:53:25Z")

</div>

Hi @kera-c,

Thanks for reaching out.

This issue was fixed very recently. However, the fix hasn’t made its way to all the products yet. SonarQube for IDE for Intellij unfortunately hasn’t gotten updated yet. As such, the next release should include the fix.

Best,  
Sebastian Zumbrunn

---

<div class="post-metadata">

**Author:** ![Kartik\_Shastrakar](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/kartik_shastrakar/32/73153_2.png) [@Kartik\_Shastrakar](https://community.sonarsource.com/u/Kartik_Shastrakar)\
**Post date:** [October 24, 2025, 7:08pm UTC](https://community.sonarsource.com/t/python-s5655-incorrectly-applying-to-enum-on-startup-of-vs-code/131620/18 "2025-10-24T19:08:47Z")

</div>

It’s give so many false positives when compare with the other tools also after correction.
