A character class of a regular expression has the range A-z, which also takes in six punctuation characters

tx0/python:regex-case-range-gapdefaultwarningbug

What it finds

[A-z] looks like "all letters", but the range runs from A to z in code points and takes in the six characters between Z and a: [, \, ], ^, _ and the backtick. [A-Za-z] is what was meant.

From the rule's source, regex_case_range_gap.rs.

Example from the rule's tests
import re a = re.compile(r"[A-z]+")tx0 reports: the range A-z also matchesb = re.compile(r"[A-Za-z]+")
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 in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/python:regex-case-range-gap" = "off"

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-case-range-gap] reason="..."

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