File size: 9,711 Bytes
4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 35d4b41 4bc63c7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | {
"version": 1,
"entries": [
{
"id": "mutable-default",
"family": "refactoring",
"shape": "mutable-default",
"source": "Effective Python item 17",
"effect": "the default is no longer built once at definition time",
"lock": "calling the function twice returns an independent empty value",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"mutable-default"
]
},
{
"id": "magic-literal",
"family": "refactoring",
"shape": "magic-literal",
"source": "Refactoring, chapter 7",
"effect": "the value is named once at module level",
"lock": "the module exposes the constant and the body refers to it",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"DYNAMIC_REACH"
],
"min_assurance": 2,
"frames": [
"magic-literal"
]
},
{
"id": "guard-clause",
"family": "refactoring",
"shape": "guard-clause",
"source": "Refactoring, guard clause",
"effect": "the body is no longer wrapped in one condition",
"lock": "the function still returns the same value for the same input",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"guard-clause"
]
},
{
"id": "dead-import",
"family": "refactoring",
"shape": "dead-import",
"source": "static property of the syntax tree",
"effect": "the name is no longer bound and the module still imports",
"lock": "the module imports cleanly and the name is gone",
"refusals": [
"NO_SHAPE",
"GENERATED_TARGET",
"AMBIGUOUS_TARGET"
],
"min_assurance": 1,
"frames": [
"dead-import"
]
},
{
"id": "loop-comprehension",
"family": "python_idiom",
"shape": "loop-comprehension",
"source": "the idiom of the language",
"effect": "the list is built in one expression",
"lock": "the list is equal to the one the loop built",
"refusals": [
"NO_SHAPE",
"DYNAMIC_REACH",
"AMBIGUOUS_TARGET"
],
"min_assurance": 2,
"frames": [
"loop-comprehension"
]
},
{
"id": "concat-fstring",
"family": "python_idiom",
"shape": "concat-fstring",
"source": "the idiom of the language",
"effect": "the message is built by one formatted literal",
"lock": "the produced string is byte equal to the concatenation",
"refusals": [
"NO_SHAPE",
"NOT_ASCII_TARGET",
"AMBIGUOUS_TARGET"
],
"min_assurance": 2,
"frames": [
"concat-fstring"
]
},
{
"id": "add-assertion",
"family": "methodology",
"shape": "add-assertion",
"source": "design by contract",
"effect": "a caller passing the wrong type fails at the boundary",
"lock": "the function raises AssertionError on a wrong argument",
"refusals": [
"NO_SHAPE",
"ASSERTION_REMOVED",
"AMBIGUOUS_TARGET"
],
"min_assurance": 2,
"frames": [
"add-assertion"
]
},
{
"id": "unused-local",
"family": "dead_code",
"shape": "unused-local",
"source": "witness fixtures/lab/registry.py tally",
"effect": "a local value computed and never read",
"lock": "the body no longer assigns the dead name",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"unused-local"
]
},
{
"id": "unreachable-code",
"family": "dead_code",
"shape": "unreachable-code",
"source": "witness fixtures/lab/registry.py describe",
"effect": "the statements that can never run are gone",
"lock": "no statement survives after the return",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"unreachable-code"
]
},
{
"id": "empty-except",
"family": "error_handling",
"shape": "empty-except",
"source": "witness fixtures/lab/registry.py ignore_late",
"effect": "the exception is no longer swallowed",
"lock": "the handler body is no longer a bare pass",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"empty-except"
]
},
{
"id": "bare-except",
"family": "error_handling",
"shape": "bare-except",
"source": "witness fixtures/lab/registry.py quiet_read",
"effect": "the handler names what it catches",
"lock": "the except clause names an exception type",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"bare-except"
]
},
{
"id": "bool-prefix",
"family": "simplification",
"shape": "bool-prefix",
"source": "witness fixtures/lab/registry.py is_empty",
"effect": "the condition is returned instead of mapped onto a bool",
"lock": "the function returns the condition it was mapping",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"bool-prefix"
]
},
{
"id": "len-zero",
"family": "simplification",
"shape": "len-zero",
"source": "witness fixtures/lab/registry.py is_empty",
"effect": "emptiness is tested by truthiness, not by length",
"lock": "no comparison of a length with zero remains",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"len-zero"
]
},
{
"id": "bool-compare",
"family": "simplification",
"shape": "bool-compare",
"source": "witness fixtures/lab/registry.py flag_text",
"effect": "the value is tested, not compared to a bool literal",
"lock": "no comparison with a bool literal remains",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"bool-compare"
]
},
{
"id": "dict-get",
"family": "python_idiom",
"shape": "dict-get",
"source": "witness fixtures/lab/registry.py lookup",
"effect": "the default comes from the mapping, not from a caught KeyError",
"lock": "the mapping supplies the default without an exception",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"dict-get"
]
},
{
"id": "redundant-list",
"family": "python_idiom",
"shape": "redundant-list",
"source": "witness fixtures/lab/registry.py names_of",
"effect": "the comprehension is returned as it is",
"lock": "the comprehension is returned without a list call",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"redundant-list"
]
},
{
"id": "str-of-string",
"family": "python_idiom",
"shape": "str-of-string",
"source": "witness fixtures/lab/registry.py shout",
"effect": "the value is used without a conversion it does not need",
"lock": "the value is used without str around a string",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"str-of-string"
]
},
{
"id": "open-context",
"family": "python_idiom",
"shape": "open-context",
"source": "witness fixtures/lab/registry.py read_notes",
"effect": "the file is closed by the block that opened it",
"lock": "the file is opened inside a with block",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"open-context"
]
},
{
"id": "range-len",
"family": "python_idiom",
"shape": "range-len",
"source": "witness fixtures/lab/registry.py indexed",
"effect": "the loop walks the items and their positions together",
"lock": "the loop uses enumerate instead of range(len(...))",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"range-len"
]
},
{
"id": "dataclass-init",
"family": "python_idiom",
"shape": "dataclass-init",
"source": "witness fixtures/lab/registry.py Record",
"effect": "the constructor assignments are generated",
"lock": "the class carries the dataclass decorator",
"refusals": [
"NO_SHAPE",
"AMBIGUOUS_TARGET",
"NO_EDIT",
"ASSERTION_REMOVED"
],
"min_assurance": 2,
"frames": [
"dataclass-init"
]
}
]
}
|