3
pk76
5y

SonarQube is obnoxious in it's moronic ideas that demonstrate lack of understanding of the languages it's analyzing.

In C# there exists a special kind of switch-case statement where the switch is on an object instance and the cases are types the instance could polymorphically be, along with a name to refer to that cast instance throughout the case. Pattern matching, basically.

SonarQube will bitch about short switch-case statements done in this way, saying if-else statements should be used instead. Which would absolutely be right if this was the basic switch-case statement.

This is a language with excellent OOP features. Why are your tests not aware of this?

I can't realistically ignore the pattern because that would also ignore actually cases where it's right. And ignoring the issue doesn't sit right with me. How does it look when a project ignores tons of issues instead of fixing them?

Comments
Add Comment