Skip to content

[Adjust Rule] SIM106: Error cases first only if it's not "NotImplementedError"  #14

@MartinThoma

Description

@MartinThoma

Desired change

  • Rule(s): SIM106
  • Adjustment: Make an exception for the NotImplementedError

Explanation

Throwing an exception for potentially forgotten implementation is better than potentially returning None or making the last one catch all.

Example

    if merge_method in ["take_right_shallow", "take_right_deep"]:
        ...
    elif merge_method == "take_left_shallow":
        ...
    elif merge_method == "take_left_deep":
        ...
    elif merge_method == "sum":
        ...
    else:
        raise NotImplementedError

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions