# eric7.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

None

### 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.
__visitFunctionDefinition | Private method defining a visitor for AST FunctionDef and AsyncFunctionDef nodes.
checkFile | Public method to run File type checks, that don't operate on the AST.
generic_visit | Public method to drive the node visitor.
visit | Public method to inspected an AST node.
visit_AsyncFunctionDef | Public method defining a visitor for AST AsyncFunctionDef 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.

### Static Methods

None

#### SecurityNodeVisitor (Constructor)

SecurityNodeVisitor(checker, secCheckers, filename, fileData)

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
fileData (str)
  contents 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

Return:
  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.__visitFunctionDefinition

__visitFunctionDefinition(node)

Private method defining a visitor for AST FunctionDef and AsyncFunctionDef 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, ast.AsyncFunctionDef)
  reference to the node being inspected

#### SecurityNodeVisitor.checkFile

checkFile()

Public method to run File type checks, that don't operate on the AST.

#### 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_AsyncFunctionDef

visit_AsyncFunctionDef(node)

Public method defining a visitor for AST AsyncFunctionDef nodes.

node (ast.AsyncFunctionDef)
  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.

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

Up