Skip to content

Commit 34cf7bd

Browse files
authored
refactor: Fix lint collapsible-else-if (PLR5501) (#172)
* chore: Remove unnecessary ignore lint enumerate-for-loop (SIM113) * refactor: Fix lint collapsible-else-if (PLR5501)
1 parent e0487ae commit 34cf7bd

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

mahjong/hand_calculating/scores.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ def calculate_scores(han: int, fu: int, config: HandConfig, is_yakuman: bool = F
114114
if (han == 4 and fu == 30) or (han == 3 and fu == 60):
115115
yaku_level = "kiriage mangan"
116116
is_kiriage = True
117-
else: # kiriage not supported
118-
if rounded > 2000:
119-
yaku_level = "mangan"
117+
elif rounded > 2000: # kiriage not supported
118+
yaku_level = "mangan"
120119

121120
# mangan
122121
if rounded > 2000 or is_kiriage:

mahjong/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,8 @@ def find_isolated_tile_indices(hand_34: Sequence[int]) -> list[int]:
262262
if hand_34[x - 1] == 0:
263263
isolated_indices.append(x)
264264
# 2-8 tiles: check both neighbors
265-
else:
266-
if hand_34[x - 1] == 0 and hand_34[x + 1] == 0:
267-
isolated_indices.append(x)
265+
elif hand_34[x - 1] == 0 and hand_34[x + 1] == 0:
266+
isolated_indices.append(x)
268267

269268
# honor tiles (27-33) - no neighbor check needed
270269
isolated_indices.extend(x for x in range(27, 34) if hand_34[x] == 0)

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ ignore = [
8686
# Will be fixed later
8787
"COM812",
8888
"PLW1641",
89-
"SIM114",
90-
"PLR5501",
9189
"SIM102",
9290
"SIM108",
9391
"PLW2901",

0 commit comments

Comments
 (0)