Files

314 B

getattr(x, 'field', default) used for type-dispatch polymorphism is banned

17.5 Banned: getattr(x, 'field', default) for type dispatch

# BANNED:
tool_id = getattr(tc, "id", "") or ""
tool_name = getattr(tc.function, "name", "") or ""

# CORRECT:
tool_id = tc.id
tool_name = tc.function.name