# Buggy code
def attr_attributes_transform(node):
    """Given that the ClassNode has an attr decorator,
    rewrite class attributes as instance attributes
    """
    for cdefbodynode in node.body:
        if not isinstance(cdefbodynode, astroid.Assign):
            continue
        for target in cdefbodynode.targets:
            node.locals[target.name] = [astroid.Attribute(target.name)]


# Traceback (AttributeError)
...
************* Module qutebrowser.mainwindow.prompt
R:146, 4: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/__main__.py", line 7, in <module>
pylint.run_pylint()
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/lint.py", line 1326, in __init__
linter.check(args)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/lint.py", line 747, in check
self._do_check(files_or_modules)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/lint.py", line 880, in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/lint.py", line 959, in check_astroid_module
walker.walk(ast_node)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/utils.py", line 994, in walk
self.walk(child)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/utils.py", line 994, in walk
self.walk(child)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/utils.py", line 994, in walk
self.walk(child)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/utils.py", line 991, in walk
cb(astroid)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/pylint/pylint/checkers/typecheck.py", line 676, in visit_attribute
inferred = list(node.expr.infer())
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/astroid/astroid/decorators.py", line 82, in wrapped
generator = _func(node, context, **kwargs)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/astroid/astroid/inference.py", line 138, in infer_name
frame, stmts = self.lookup(self.name)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/astroid/astroid/node_classes.py", line 989, in lookup
return self.scope().scope_lookup(self, name)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/astroid/astroid/scoped_nodes.py", line 2012, in scope_lookup
return frame._scope_lookup(node, name, offset)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/astroid/astroid/scoped_nodes.py", line 160, in _scope_lookup
stmts = node._filter_stmts(self.locals[name], self, offset)
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/astroid/astroid/node_classes.py", line 1061, in _filter_stmts
stmt = node.statement()
File "/home/florian/proj/qutebrowser/git/.tox/pylint-master/src/astroid/astroid/node_classes.py", line 417, in statement
return self.parent.statement()
AttributeError: 'NoneType' object has no attribute 'statement'

# Fixed code
def attr_attributes_transform(node):
    """Given that the ClassNode has an attr decorator,
    rewrite class attributes as instance attributes
    """
    for cdefbodynode in node.body:
        if not isinstance(cdefbodynode, astroid.Assign):
            continue
        for target in cdefbodynode.targets:
            rhs_node = astroid.Unknown(
                lineno=cdefbodynode.lineno,
                col_offset=cdefbodynode.col_offset,
                parent=cdefbodynode,
            )
            node.locals[target.name] = [rhs_node]