The python scanner incorrectly flags function with exhaustive structural pattern matching as
python:S3801 “Refactor this function to use “return” consistently.”
I.e.
def foo(val: int) -> str:
match val:
case 1:
return "fizz"
case 2:
return "buzz"
case other:
raise ValueError(f"Illegal value: {other}")
Adding a dummy return None
in the end, will have other checkers (IntelliJ Idea) complain about unreachable code, so currently only option is to #NOSONAR
the entire function