New Python rules for Beautiful Soup

Hi Python Developers

The Python analyzer adds new rules for web scraping with Beautiful Soup and reduces false positives. Issues classified as main-code issues are no longer raised on test files.

New rules:

  • S8900: Deprecated Beautiful Soup methods should be replaced with their modern equivalents
  • S8903: HTML elements should be created with “new_tag()” instead of inserting raw HTML strings
  • S8904: BeautifulSoup elements should be checked for None before accessing
  • S8905: BeautifulSoup parser should be explicitly specified
  • S8906: CSS selectors should be used when selecting elements with multiple required classes

These checks are available for projects now in SonarQube Cloud and from SonarQube Server 2026.4.

We’d love your feedback: which frameworks or patterns should we prioritize next?

2 Likes