bandit/bandit
Lucas Fisher 43f27afe3c Make func, class name definitions fully qualified
Qualified names were often not fully qualified within
their defined namespace. For example, modA.modB.ClassC.methD
would be named modB.methD at best because we were not tracking
the namespace as we traversed the AST nor were we determining
the full qualified name of the module py file we are scanning.

We improve this by making a eduated guess as the fully qualified
name of a module based on the module path. See
bandit.core.utils.get_module_qualname_by_path. We traverse
the path from right to left. If the directory has a __init__.py
we assume it is a parent module. Tests were added in
tests_util.py.

Since bandit could be used to scan files not in their final install
location we also warn that the file is not in an install path
and we may not get the proper fully qualified name.

We also track the namespace as we traverse the AST. We use
the module's FQ name as above as the module's base namespace.
We add a Class node visitor which updates that namespace
upon entering and leaving a Class definition. We do the same
for Func nodes to deal with nested functions. Utility functions
were added for managing namespace path that are similar to
os.path.{join,split}

Change-Id: I90c156eefb4801d7f75f6801343c2700b5421722
2015-02-11 12:36:45 -08:00
..
core Make func, class name definitions fully qualified 2015-02-11 12:36:45 -08:00
plugins Add unaliased mod name to import_aliases; Fix tests 2015-01-29 10:38:05 -08:00
__init__.py Enabling PEP8 tests in tox and re-working source to comply 2014-10-23 14:34:05 +01:00
bandit.py Enabling PEP8 tests in tox and re-working source to comply 2014-10-23 14:34:05 +01:00