SonarLint not working for some Python or Rust codes in VSCode

SonarLint could detect code smell or maintainability for some Python or Javascript codes in couple of my Git repositories. But in other Git repo where I had different Python files there they have code smell (below) and bugs, but SonarLint said “No problem has been detected in this workspace” in the “Problem” tab in the Terminal section. The “Output” tab is also empty. Would someone let me know why Sonarlint did not detect the code smell?

Env Info:
SonarLint 14.5.0, VSCode (1.96.2), MacOS (Apple M1 Max)

Python code that has code smell:

def calculate_discount(price, discount):
    if discount == 0:
        return price
    elif discount == 10:
        return price * 0.9
    elif discount == 20:
        return price * 0.8
    elif discount == 30:
        return price * 0.7
    elif discount == 40:
        return price * 0.6
    elif discount == 50:
        return price * 0.5
    else:
        return price

def if variable_a == 1:
   if variable_b == 3:
      do_something()
      
def main():
    price = 100
    discount = 20
    final_price = calculate_discount(price, discount)
    print("Final price:", final_price)
    print("Final price:", final_price)
    print("Final price:", final_price)

main()

Hi there @phoang ! :wave:

I assume you meant SonarLint version 4.15.0? You can always check the logs by going to OUTPUT > SonarQube for IDE tab (see here). The snippet that you provided has a parsing error on line 17, and I think once you fix that you should be able to see the issues coming.

If that does not help, please share the logs with us and we will try to help investigate.

All the best,
Sophio