Skip to content

Commit fc05712

Browse files
committed
Make pyrefly non-exhaustive-match an error
- Configure pyrefly to treat non-exhaustive-match as an error instead of a warning so it fails the build. - Add wildcard case branches to match statements to make them exhaustive.
1 parent 4f31d6d commit fc05712

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ search_path = [
361361
".",
362362
"src",
363363
]
364+
errors.non-exhaustive-match = "error"
364365

365366
[tool.pyright]
366367
enableTypeIgnoreComments = false

src/mock_vws/_flask_server/target_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def to_target_rater(self) -> TargetTrackingRater:
4545
return HardcodedTargetTrackingRater(rating=5)
4646
case self.RANDOM:
4747
return RandomTargetTrackingRater()
48-
49-
raise ValueError # pragma: no cover
48+
case _: # pragma: no cover
49+
raise ValueError
5050

5151

5252
@beartype

src/mock_vws/_flask_server/vwq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def to_image_matcher(self) -> ImageMatcher:
4545
return ExactMatcher()
4646
case self.STRUCTURAL_SIMILARITY:
4747
return StructuralSimilarityMatcher()
48-
49-
raise ValueError # pragma: no cover
48+
case _: # pragma: no cover
49+
raise ValueError
5050

5151

5252
@beartype

src/mock_vws/_flask_server/vws.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def to_image_matcher(self) -> ImageMatcher:
5959
return ExactMatcher()
6060
case self.STRUCTURAL_SIMILARITY:
6161
return StructuralSimilarityMatcher()
62-
63-
raise ValueError # pragma: no cover
62+
case _: # pragma: no cover
63+
raise ValueError
6464

6565

6666
@beartype

0 commit comments

Comments
 (0)