A pattern holds a run of spaces that is hard to count

tx0/python:regex-repeated-spacesstrictwarningstyle

What it finds

Several spaces in a row are hard to count when reading a pattern; {3} says how many. Often \s+ or + was meant, since the text being matched rarely has a fixed number of spaces. Patterns in verbose mode, where spaces are ignored, are not read.

From the rule's source, regex_repeated_spaces.rs.

Example from the rule's tests
import re a = re.compile("name:   value")tx0 reports: this pattern has 3 spaces in a rowb = re.compile("name: value")c = re.compile("name:   value", re.VERBOSE)d = re.compile("(?x) name:   value")
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:regex-repeated-spaces" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

# tx0: ignore[tx0/python:regex-repeated-spaces] reason="..."

tx0 explain tx0/python:regex-repeated-spaces shows the same in the terminal. Found a false positive? Report it.