Skip to content

identical-switch-branches: exclude default #1546

@jalaziz

Description

@jalaziz

Is your feature request related to a problem? Please describe.

The identical-switch-branches rule is useful but a bit too strict.

When writing switch statements on enums from external libraries, it can be useful to handle known current values but also default a default value that matches a branch. This makes it clear what is explicitly mapped and what is a fallback value.

Describe the solution you'd like
I'd like an option to ignore default branches.

Describe alternatives you've considered
I have considered disabling the rule entirely or commenting out specific switch statements. Unfortunately, either option is undesirable as the check is still useful for other identical branch scenarios.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions