[PEP 695 - SonarQube for IDE] sonarqube(python:ParsingError)

Specs:

  • Operating system: Windows 11
  • SonarQube for VS Code plugin version: 4.35.1 (from github)
  • Programming language you’re coding in: Python
  • Connected mode used: SonarQube Server 9.9.9

Description of the problem / question:

Hello,

When trying to use the new syntax introduced by PEP 695, the plugin analysis fails on the file.

class MyClass[**P, T]:

    def __init__(
        self,
        my_function: Callable[P, T],
    ) -> None:
        pass
Parse error at line 1 column 13:

  -->  class MyClass[**P, T]:
    2:     def __init__(self, my_function: Callable[P, T]) -> None:
    3:         pass

This code is perfectly valid and works fine in python 3.12. Also, when performing the analysis on the server, it works fine.

Is this a known bug ?

Thank you in advance !

Hi @esi,

Thanks for reaching out.

This bug has been fixed in sonar-python 5.9, which was shipped with SonarQube Server 2025.5. However, in connected mode, SonarQube for IDE will use the analyzer version from the connected SonarQube instance, which doesn’t contain the fix yet.

To analyze this file in your IDE, you would have to upgrade to at least SonarQube Server 2025.5. Alternatively, if connected mode is not enabled, the file should parse correctly.

Best,
Sebastian Zumbrunn

Hi Sebastian,

Thank you for your answer, I haven’t tested upgrading the server as of now, but disconnecting from the server does solve my issue.

I wish you the best,
E. Six

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.