Inspectopedia
 
2024.3

'switch' statement without 'default' branch

Info
New
Last modified: 03 December 2024

Reports switch statements that do not contain default labels.

Adding the default label guarantees that all possible scenarios are covered, and it becomes easier to make assumptions about the current state of the program.

Note that by default, the inspection does not report switch statements if all cases for enums or sealed classes are covered. Use the Ignore exhaustive switch statements option if you want to change this behavior.