Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule proposal: require raw strings for regex patterns #11167

Open
andersk opened this issue Apr 26, 2024 · 0 comments
Open

Rule proposal: require raw strings for regex patterns #11167

andersk opened this issue Apr 26, 2024 · 0 comments
Labels
rule Implementing or modifying a lint rule

Comments

@andersk
Copy link
Contributor

andersk commented Apr 26, 2024

We could have a rule that enforces the re documentation’s recommendation of rewriting re.compile("pattern") to re.compile(r"pattern"), and similar for the first argument of re.search, re.match, re.fullmatch, re.split, re.findall, re.finditer, re.sub, re.subn.

Prior art: flake8-literal LIT103 with the literal-re-pattern-raw option set to always.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

2 participants