summaryrefslogtreecommitdiff
path: root/pycodestyle.py
diff options
context:
space:
mode:
Diffstat (limited to 'pycodestyle.py')
-rwxr-xr-xpycodestyle.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 0f2f078..7f00739 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -163,6 +163,7 @@ STARTSWITH_INDENT_STATEMENT_REGEX = re.compile(
)))
)
DUNDER_REGEX = re.compile(r'^__([^\s]+)__ = ')
+MATCH_CASE_REGEX = re.compile(r'^\s*\b(?:match|case)(\s*)(?=.*\:)')
_checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
@@ -493,6 +494,16 @@ def whitespace_around_keywords(logical_line):
elif len(after) > 1:
yield match.start(2), "E271 multiple spaces after keyword"
+ if sys.version_info >= (3, 10):
+ match = MATCH_CASE_REGEX.match(logical_line)
+ if match:
+ if match[1] == ' ':
+ return
+ if match[1] == '':
+ yield match.start(1), "E275 missing whitespace after keyword"
+ else:
+ yield match.start(1), "E271 multiple spaces after keyword"
+
@register_check
def missing_whitespace_after_import_keyword(logical_line):