Home ⌂Doc Index ◂Up ▴

eric6.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityNodeVisitor

Module implementing an AST node visitor for security checks.

Global Attributes

None

Classes

SecurityNodeVisitor Class implementing an AST node visitor for security checks.

Functions

None


SecurityNodeVisitor

Class implementing an AST node visitor for security checks.

Derived from

object

Class Attributes

None

Class Methods

None

Methods

SecurityNodeVisitor Constructor
__postVisit Private method to clean up after a node was visited.
__preVisit Private method to set up a context for the visit method.
__runChecks Private method to run all enabled checks for a given check type.
generic_visit Public method to drive the node visitor.
visit Public method to inspected an AST node.
visit_Bytes Public method defining a visitor for Bytes nodes.
visit_Call Public method defining a visitor for AST Call nodes.
visit_ClassDef Public method defining a visitor for AST ClassDef nodes.
visit_Constant Public method defining a visitor for Constant nodes.
visit_FunctionDef Public method defining a visitor for AST FunctionDef nodes.
visit_Import Public method defining a visitor for AST Import nodes.
visit_ImportFrom Public method defining a visitor for AST Import nodes.
visit_Str Public method defining a visitor for String nodes.

Static Methods

None

SecurityNodeVisitor (Constructor)

SecurityNodeVisitor(checker, secCheckers, filename)

Constructor

checker (SecurityChecker)
reference to the main security checker object
secCheckers (dict)
dictionary containing the available checker routines
filename (str)
name of the checked file

SecurityNodeVisitor.__postVisit

__postVisit(node)

Private method to clean up after a node was visited.

node (ast.AST)
AST node that was visited

SecurityNodeVisitor.__preVisit

__preVisit(node)

Private method to set up a context for the visit method.

node (ast.AST)
node to base the context on
Returns:
flag indicating to visit the node
Return Type:
bool

SecurityNodeVisitor.__runChecks

__runChecks(checkType)

Private method to run all enabled checks for a given check type.

checkType (str)
type of checks to be run

SecurityNodeVisitor.generic_visit

generic_visit(node)

Public method to drive the node visitor.

node (ast.AST)
node to be inspected

SecurityNodeVisitor.visit

visit(node)

Public method to inspected an AST node.

node (ast.AST)
AST node to be inspected

SecurityNodeVisitor.visit_Bytes

visit_Bytes(node)

Public method defining a visitor for Bytes nodes.

This adds relevant information about node to the context for use in tests which inspect strings.

node (ast.Bytes)
reference to the node being inspected

SecurityNodeVisitor.visit_Call

visit_Call(node)

Public method defining a visitor for AST Call nodes.

Add relevant information about the node to the context for use in tests which inspect function calls.

node (ast.Call)
reference to the node being inspected

SecurityNodeVisitor.visit_ClassDef

visit_ClassDef(node)

Public method defining a visitor for AST ClassDef nodes.

Add class name to current namespace for all descendants.

node (ast.ClassDef)
reference to the node being inspected

SecurityNodeVisitor.visit_Constant

visit_Constant(node)

Public method defining a visitor for Constant nodes.

This calls the appropriate method for the node type. It maintains compatibility with <3.6 and 3.8+

node (ast.Constant)
reference to the node being inspected

SecurityNodeVisitor.visit_FunctionDef

visit_FunctionDef(node)

Public method defining a visitor for AST FunctionDef nodes.

Add relevant information about the node to the context for use in tests which inspect function definitions. Add the function name to the current namespace for all descendants.

node (ast.FunctionDef)
reference to the node being inspected

SecurityNodeVisitor.visit_Import

visit_Import(node)

Public method defining a visitor for AST Import nodes.

node (ast.Import)
reference to the node being inspected

SecurityNodeVisitor.visit_ImportFrom

visit_ImportFrom(node)

Public method defining a visitor for AST Import nodes.

This adds relevant information about the node to the context for use in tests which inspect imports.

node (ast.ImportFrom)
reference to the node being inspected

SecurityNodeVisitor.visit_Str

visit_Str(node)

Public method defining a visitor for String nodes.

This adds relevant information about node to the context for use in tests which inspect strings.

node (ast.Str)
reference to the node being inspected
Up



Home ⌂Doc Index ◂Up ▴