Skip to content

Commit 9ae8653

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
1 parent 75b2067 commit 9ae8653

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

wemake_python_styleguide/violations/consistency.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,8 +2468,8 @@ class SimplifiableIfMatchViolation(ASTViolation):
24682468
Single-case ``match`` statements can be simplified to ``if`` statements.
24692469
24702470
Reasoning:
2471-
Using ``match`` for a single case is unnecessarily complex compared to a
2472-
simple ``if`` condition. The intent is clear, and using ``if`` reduces
2471+
Using ``match`` for a single case is unnecessarily complex compared to a
2472+
simple ``if`` condition. The intent is clear, and using ``if`` reduces
24732473
nesting and cognitive load.
24742474
24752475
Solution:

wemake_python_styleguide/visitors/ast/conditions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,18 @@ def visit_Match(self, node: ast.Match) -> None:
208208

209209
def _check_simplifiable_match(self, node: ast.Match) -> None:
210210
cases = node.cases
211-
211+
212212
# Check for single-case matches with no guard
213213
if len(cases) == 1:
214214
case = cases[0]
215215
# Check if there's no guard condition
216216
if case.guard is None:
217217
# Check if the pattern is simple (literal, constant, enum, etc.)
218218
if pattern_matching.is_simple_pattern(case.pattern):
219-
self.add_violation(consistency.SimplifiableIfMatchViolation(node))
220-
219+
self.add_violation(
220+
consistency.SimplifiableIfMatchViolation(node)
221+
)
222+
221223
# Check for two-case matches with wildcard (existing logic)
222224
elif len(cases) == 2:
223225
first, second = cases

0 commit comments

Comments
 (0)