rope.contrib.finderrors

Finding bad name and attribute accesses

find_errors function can be used to find possible bad name and attribute accesses. As an example:

errors = find_errors(project, project.get_resource('mod.py'))
for error in errors:
    print('%s: %s' % (error.lineno, error.error))

prints possible errors for mod.py file.

TODO:

  • use task handles

  • reporting names at most once

  • attributes of extension modules that don’t appear in extension_modules project config can be ignored

  • not calling PyScope.get_inner_scope_for_line() if it is a bottleneck; needs profiling

  • not reporting occurrences where rope cannot infer the object

  • rope saves multiple objects for some of the names in its objectdb use all of them not to give false positives

  • … ;-)

Classes

Error

Functions

find_errors(project, resource)

Find possible bad name and attribute accesses

Module Contents

rope.contrib.finderrors.find_errors(project, resource)

Find possible bad name and attribute accesses

It returns a list of Error.

class rope.contrib.finderrors.Error(lineno, error)
lineno
error