Rule idea: unncessary-compiled-regular-expression
#14691
Labels
rule
Implementing or modifying a lint rule
unncessary-compiled-regular-expression
#14691
The discussion in #14680 inspired a related pattern that's less tricky to detect.
can be simplified to
For the
re
functionssplit
,match
,finditer
,search
,subn
,sub
,fullmatch
, the syntax is equivalent (see https://github.com/python/cpython/blob/3.13/Lib/re/__init__.py). The rule is purely stylistic. As a nice bonus, ifPATTERN
is a literal non-meta-character pattern it will be picked up by RUF055 after the fix.Examples:
The text was updated successfully, but these errors were encountered: