All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.py.rules.python.S6326.html Maven / Gradle / Ivy

There is a newer version: 4.23.0.17664
Show newest version

Why is this an issue?

Multiple spaces in a regular expression can make it hard to tell how many spaces should be matched. It’s more readable to use only one space and then indicate with a quantifier how many spaces are expected.

Noncompliant code example

r"Hello,   world!"

Compliant solution

r"Hello, {3}world!"

Exceptions

If the extended modifier re.X or re.VERBOSE is set, whitespaces are ignored. In this case no issue should be triggered, because the whitespaces may be intended to improve readability.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy