SonarLint for VS Code 4.2 - Detect more critical Python issues

Hello VS Code users,

With the new version of SonarLint, you’ll be able to detect 9 advanced issues that can cause your Python programs to crash. Those rules were already available in SonarQube and SonarCloud branch and pull request analysis; you can now benefit from those detections directly in the IDE, meaning that you’ll be able to remediate those problems before sending a pull request, and even before running your unit tests. Here is the list of rules:

  • S3518: Zero should not be a possible denominator
  • S6466: Accessing list elements should not trigger an IndexError
  • S2259: Attributes should not be accessed on “None” values
  • S2589: Boolean expressions should not be gratuitous
  • S6417: Collections should not be modified while they are iterated
  • S2583: Conditionally executed code should be reachable
  • S5633: Dictionary unpacking should only be done with “mapping” objects
  • S6464: Non-existent dictionary keys should not be accessed
  • S6465: Unpacking should be done with the same number of elements of the iterable.

To benefit from the Python advanced rules, you need to run SonarLint in connected mode with SonarCloud (it will be also available soon with the next SonarQube version).

We’ve also made some updates in the product and in the documentation to do a better job at explaining the benefits of using SonarLint in connected mode with SonarQube and SonarCloud: what functionality it enables and why it is a good idea to set it up especially if you are several developers contributing to a project. If you’re not familiar with connected mode you can find a concise explanation here.

You’ll find a lot more about this release (new rules including 17 new JavaScript rules for JSX, improvements, bug fixes) in the release notes.

Alexander

6 Likes