On a pattern like ^foo$\r?\n? S5996 will complain that the part after the $ cannot match because $ is the end of the line. But, since $ matches before line break characters, it can still be followed by them. So this is a false positive.
In cases where the MULTILINE flag is set, we should also accept patterns like ^foo$\r?\n?bar or, if the DOTALL flag is also set, even ^foo$.*.