regex-flag-alias (FURB167)#
Derived from the refurb linter.
Fix is always available.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does#
Checks for the use of shorthand aliases for regular expression flags
(e.g., re.I
instead of re.IGNORECASE
).
Why is this bad?#
The regular expression module provides descriptive names for each flag, along with single-letter aliases. Prefer the descriptive names, as they are more readable and self-documenting.
Example#
Use instead: