Skip to content

Commit 008153c

Browse files
committed
WPS349 highlighting
1 parent d9a7991 commit 008153c

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Due to PEP-695, it's now allowed to use `[]` in the decorator only for `python3.
4040
def some_function(): ...
4141
```
4242

43+
- Improves `WPS349` highlighting,
44+
45+
4346
## 1.1.0
4447

4548
### Command line utility

tests/test_visitors/test_ast/test_subscripts/test_redundant_subscripts.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
'expression',
1313
[
1414
'0:7',
15-
'0:7:1',
1615
'None:7',
1716
'3:None',
1817
'3:None:2',

wemake_python_styleguide/visitors/ast/subscripts.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,19 @@ def _check_redundant_subscript(self, node: ast.Subscript) -> None:
7171
and not self._is_none(node.slice.step)
7272
)
7373

74-
if not (lower_ok and upper_ok and step_ok):
74+
if not lower_ok:
7575
self.add_violation(
76-
consistency.RedundantSubscriptViolation(
77-
node,
78-
),
76+
consistency.RedundantSubscriptViolation(node.slice.lower)
77+
)
78+
79+
if not upper_ok:
80+
self.add_violation(
81+
consistency.RedundantSubscriptViolation(node.slice.upper)
82+
)
83+
84+
if not step_ok:
85+
self.add_violation(
86+
consistency.RedundantSubscriptViolation(node.slice.step)
7987
)
8088

8189
def _check_slice_assignment(self, node: ast.Subscript) -> None:

0 commit comments

Comments
 (0)