Skip to content

Commit efb7463

Browse files
Enable ruff PLW0120 rule (#11330)
Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent da47d5c commit efb7463

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ lint.ignore = [ # `ruff rule S101` for a description of that rule
1111
"NPY002", # Replace legacy `np.random.choice` call with `np.random.Generator` -- FIX ME
1212
"PGH003", # Use specific rule codes when ignoring type issues -- FIX ME
1313
"PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey
14-
"PLW0120", # `else` clause on loop without a `break` statement -- FIX ME
1514
"PLW060", # Using global for `{name}` but no assignment is done -- DO NOT FIX
1615
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
1716
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception

searches/fibonacci_search.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ def fibonacci_search(arr: list, val: int) -> int:
123123
elif val > item_k_1:
124124
offset += fibonacci(fibb_k - 1)
125125
fibb_k -= 2
126-
else:
127-
return -1
126+
return -1
128127

129128

130129
if __name__ == "__main__":

searches/ternary_search.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ def ite_ternary_search(array: list[int], target: int) -> int:
106106
else:
107107
left = one_third + 1
108108
right = two_third - 1
109-
else:
110-
return -1
109+
return -1
111110

112111

113112
def rec_ternary_search(left: int, right: int, array: list[int], target: int) -> int:

0 commit comments

Comments
 (0)