Skip to content

Commit

Permalink
Add comment test for FURB110 (#10804)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Apr 6, 2024
1 parent 7fb012d commit ee4bff3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/ruff_linter/resources/test/fixtures/refurb/FURB110.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@
y
)
)

# FURB110
z = (
x if
# If true, use x.
x
# Otherwise, use y.
else
y
)
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,32 @@ FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator
27 27 | # Test for y.
28 28 | y
29 29 | )

FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
32 | # FURB110
33 | z = (
34 | x if
| _____^
35 | | # If true, use x.
36 | | x
37 | | # Otherwise, use y.
38 | | else
39 | | y
| |_____^ FURB110
40 | )
|
= help: Replace with `or` operator

Safe fix
31 31 |
32 32 | # FURB110
33 33 | z = (
34 |- x if
35 |- # If true, use x.
36 |- x
37 |- # Otherwise, use y.
38 |- else
39 |- y
34 |+ x or y
40 35 | )

0 comments on commit ee4bff3

Please sign in to comment.