False positive on python:S3801

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

Hi @jonesalk,

Welcome to the community, and thank you for reporting this issue!
You are right; this is a False Positive. Currently, we do not handle the match statement properly.
To follow our progress, I have created this ticket to tackle this issue.

Cheers,

David