From 52ac6c6f97e778b4716ea28959940b97148e7ae0 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 13 Oct 2021 14:44:16 +0200 Subject: Emit E221-E224 for walrus op --- pycodestyle.py | 2 +- testsuite/python38.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pycodestyle.py b/pycodestyle.py index 16167df..e4954dc 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -152,7 +152,7 @@ COMPARE_NEGATIVE_REGEX = re.compile(r'\b(?%&^]+)(\s*)') +OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:(?:[-+*/|!<=>%&^]+|:=))(\s*)') LAMBDA_REGEX = re.compile(r'\blambda\b') HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)\b') diff --git a/testsuite/python38.py b/testsuite/python38.py index 1374192..8bf0d4d 100644 --- a/testsuite/python38.py +++ b/testsuite/python38.py @@ -42,3 +42,14 @@ import typing as t all_the_things: t.List[str] = [] import logging +#: E221:1:5 E222:1:9 E221:3:6 +if x := 1: + pass +if (x := 2): + pass +#: E223:1:5 E224:1:8 +if x := 2: + pass +#: E221:1:6 E221:1:19 +if (x := 1) == (y := 2): + pass -- cgit v1.2.1