regex-flag-alias
What it does
Section titled “What it does”Reports re.A, re.I, re.L, re.M, re.S, re.U and re.X, the short names of re.ASCII, re.IGNORECASE, re.LOCALE, re.MULTILINE, re.DOTALL, re.UNICODE and re.VERBOSE.
Why it matters
Section titled “Why it matters”The one-letter names are hard to tell apart and to look up (re.S is DOTALL, re.M is MULTILINE). The long names say what the flag does.
To fix, write the long name.
Example
Section titled “Example”...
...x = re.compile("a", re.I)Configuration
Section titled “Configuration”python: lint: rules: regex-flag-alias: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line regex-flag-alias in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | FURB167 |
full |