All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.go.rules.go.S131.html Maven / Gradle / Ivy

There is a newer version: 1.24.0.3049
Show newest version

Why is this an issue?

The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken.

Noncompliant code example

switch tag { // Noncompliant - default case is missing
case 0, 1, 2, 3:
	foo()
case 4, 5, 6, 7:
	bar()
}

Compliant solution

switch tag {
case 0, 1, 2, 3:
	foo()
case 4, 5, 6, 7:
	bar()
default:
	qix()
}

Resources





© 2015 - 2025 Weber Informatics LLC | Privacy Policy