Python-specific rules: - [x] `SIM101` ("Multiple isinstance-calls which can be merged into a single call by using a tuple as a second argument") - [x] `SIM105` ("Use 'contextlib.suppress(...)' instead of try-except-pass") - [x] `SIM107` ("Don't use `return` in try/except and finally ") - [x] `SIM108` ("Use the ternary operator if it's reasonable ") - [x] `SIM109` ("Use a tuple to compare a value against multiple values") - [x] `SIM110` ("Use [any(...)](https://docs.python.org/3/library/functions.html#any) ") - [x] `SIM111` ("Use [all(...)](https://docs.python.org/3/library/functions.html#all)") - [x] `SIM113` ("Use enumerate instead of manually incrementing a counter") - [x] `SIM114` ("Combine conditions via a logical or to prevent duplicating code") - [x] `SIM115` ("Use context handler for opening files") - [x] `SIM116` ("Use a dictionary instead of many if/else equality checks") - [x] `SIM117` ("Merge with-statements that use the same scope") Simplifying Comparisons: - [x] `SIM201` ("Use 'a != b' instead of 'not a == b'") - [x] `SIM202` ("Use 'a == b' instead of 'not a != b'") - [x] `SIM203` ("Use 'a not in b' instead of 'not (a in b)'") - [x] `SIM208` ("Use 'a' instead of 'not (not a)'") - [x] `SIM210` ("Use 'bool(a)' instead of 'True if a else False'") - [x] `SIM211` ("Use 'not a' instead of 'False if a else True'") - [x] `SIM212` ("Use 'a if a else b' instead of 'b if not a else a'") - [x] `SIM220` ("Use 'False' instead of 'a and not a'") - [x] `SIM221` ("Use 'True' instead of 'a or not a'") - [x] `SIM222` ("Use 'True' instead of '... or True'") - [x] `SIM223` ("Use 'False' instead of '... and False'") - [x] `SIM300` ("Use 'age == 42' instead of '42 == age'") Simplifying usage of dictionaries: - [x] `SIM401` ("Use 'a_dict.get(key, "default_value")' instead of an if-block") - [x] `SIM118` ("Use 'key in dict' instead of 'key in dict.keys()'") General Code Style: - [x] `SIM102` ("Use a single if-statement instead of nested if-statements") - [x] `SIM103` ("Return the boolean condition directly") - [x] `SIM112` ("Use CAPITAL environment variables")
Python-specific rules:
SIM101("Multiple isinstance-calls which can be merged into a single call by using a tuple as a second argument")SIM105("Use 'contextlib.suppress(...)' instead of try-except-pass")SIM107("Don't usereturnin try/except and finally ")SIM108("Use the ternary operator if it's reasonable ")SIM109("Use a tuple to compare a value against multiple values")SIM110("Use any(...) ")SIM111("Use all(...)")SIM113("Use enumerate instead of manually incrementing a counter")SIM114("Combine conditions via a logical or to prevent duplicating code")SIM115("Use context handler for opening files")SIM116("Use a dictionary instead of many if/else equality checks")SIM117("Merge with-statements that use the same scope")Simplifying Comparisons:
SIM201("Use 'a != b' instead of 'not a == b'")SIM202("Use 'a == b' instead of 'not a != b'")SIM203("Use 'a not in b' instead of 'not (a in b)'")SIM208("Use 'a' instead of 'not (not a)'")SIM210("Use 'bool(a)' instead of 'True if a else False'")SIM211("Use 'not a' instead of 'False if a else True'")SIM212("Use 'a if a else b' instead of 'b if not a else a'")SIM220("Use 'False' instead of 'a and not a'")SIM221("Use 'True' instead of 'a or not a'")SIM222("Use 'True' instead of '... or True'")SIM223("Use 'False' instead of '... and False'")SIM300("Use 'age == 42' instead of '42 == age'")Simplifying usage of dictionaries:
SIM401("Use 'a_dict.get(key, "default_value")' instead of an if-block")SIM118("Use 'key in dict' instead of 'key in dict.keys()'")General Code Style:
SIM102("Use a single if-statement instead of nested if-statements")SIM103("Return the boolean condition directly")SIM112("Use CAPITAL environment variables")