{ "lang": "en", "name": "English", "noise": [ ",", ".", "!", "?", ";", ":", "\"", "'", "(", ")" ], "units": { "file": [ "file", "module", "script" ], "function": [ "function", "method", "def" ], "test": [ "test", "tests", "suite" ] }, "domains": [ "code", "tests", "docs" ], "frames": { "mutable-default": [ "mutable default", "default list", "shared default", "empty list default", "list as its default argument", "the default is shared", "default shared across calls", "default argument is a list" ], "magic-literal": [ "magic number", "unnamed constant", "hardcoded number", "name this number", "same number three times", "number written out", "bare number", "number without a name" ], "guard-clause": [ "guard clause", "early return", "nested if", "flatten the condition", "too much nesting", "deeply nested", "body inside one if", "flatten the nesting", "if inside if", "the condition wraps the whole body", "hard to read because it is nested" ], "dead-import": [ "unused import", "import never used", "dead import", "unnecessary import", "import that is never used", "linter complains about an import", "import at the top never used", "redundant import", "import the linter flags" ], "loop-comprehension": [ "list comprehension", "rewrite the loop", "for loop to comprehension", "turn the loop into a comprehension", "rewrite with a comprehension", "loop that should be a comprehension", "loop that builds a list", "loop that only appends" ], "concat-fstring": [ "f string", "string concatenation", "format the string", "plus operator on strings", "string built with plus", "formatted string literal", "interpolation" ], "add-assertion": [ "assert the type", "add a guard", "check the argument", "defensive assert", "assert isinstance", "type check", "validate the type", "guard the argument type", "verify the type before using it" ], "unused-local": [ "unused local variable", "value computed and never read", "assignment nobody uses", "dead local", "this variable is not used", "a count that is never read" ], "unreachable-code": [ "unreachable code", "code after the return", "line that never runs", "dead code after the raise", "inaccessible block", "this branch never executes" ], "empty-except": [ "empty except", "the except does nothing", "swallowed exception", "pass inside except", "silent failure", "try with an empty handler" ], "bare-except": [ "bare except", "except without a type", "catches any exception", "generic except", "except with no exception named", "catch everything" ], "bool-prefix": [ "if returning True or False", "redundant boolean", "return the bool directly", "if else giving True and False", "unnecessary boolean prefix", "pointless conversion to bool" ], "len-zero": [ "len equals zero", "len(x) == 0", "checking the length instead of emptiness", "compare len with zero", "empty check done with len", "length equal to zero" ], "bool-compare": [ "comparison to True", "x == True", "compared with True", "explicit boolean comparison", "equal to True", "comparing directly with a boolean" ], "dict-get": [ "KeyError for a default value", "try except for a missing key", "dict get with a default", "default value of the dictionary", "catching KeyError to default", "missing key in the mapping" ], "redundant-list": [ "list around a comprehension", "list of a comprehension", "unnecessary list call", "redundant list wrapper", "wrapping the comprehension in list", "useless list on a comprehension" ], "str-of-string": [ "str of a string", "str call on a string", "redundant str cast", "already a string", "double string conversion", "str applied twice" ], "open-context": [ "open without with", "file opened without a context manager", "file handle not closed", "manual open and close", "missing with block on a file", "file opened and never closed" ], "range-len": [ "range with len inside a for", "loop over range of len", "range(len(...))", "index based loop", "missing enumerate", "index computed from len" ], "dataclass-init": [ "class whose init only assigns arguments", "boilerplate constructor", "missing dataclass", "assigning the fields by hand", "constructor copying arguments into fields", "plain class with a repetitive __init__" ] }, "labels": { "state": "State", "level": "Level", "domain": "Domain", "not_understood": "I did not understand the request.", "out_of_domain": "This request is outside the catalog of this system.", "refused": "Refused", "clarify": "Which symbol do you mean?", "verified": "Verified", "unknown": "Unknown", "single_prover": "Single prover", "progress": "Working" }, "examples": [ { "text": "remove the mutable default in load_config", "frame": "mutable-default" }, { "text": "this number appears three times, name it", "frame": "magic-literal" }, { "text": "flatten this nested if into an early return", "frame": "guard-clause" }, { "text": "the json import is not used any more", "frame": "dead-import" }, { "text": "turn this for loop into a list comprehension", "frame": "loop-comprehension" }, { "text": "build this message with an f string", "frame": "concat-fstring" }, { "text": "assert that count is an int before using it", "frame": "add-assertion" }, { "text": "turn Record into a dataclass so the constructor goes away", "frame": "dataclass-init" } ] }