python-security/pyt

View on GitHub

Showing 120 of 158 total issues

Avoid deeply nested control flow statements.
Open

                    if variable in earlier_node.left_hand_side:
                        def_use[earlier_node].append(node)
    return def_use
Severity: Major
Found in pyt/analysis/definition_chains.py - About 45 mins to fix

    Function append_if_local_or_in_imports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def append_if_local_or_in_imports(self, definition):
            """Add definition to list.
    
            Handles local definitions and adds to project_definitions.
            """
    Severity: Minor
    Found in pyt/core/module_definitions.py - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, label, left_hand_side, right_hand_side_variables, *, line_number, path):
    Severity: Minor
    Found in pyt/core/node_types.py - About 45 mins to fix

      Function generate_ast has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def generate_ast(path):
          """Generate an Abstract Syntax Tree using the ast module.
      
              Args:
                  path(str): The path to the file e.g. example/foo/bar.py
      Severity: Minor
      Found in pyt/core/ast_helper.py - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in pyt/core/node_types.py - About 45 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Minor
        Found in pyt/cfg/expr_visitor.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if file.endswith('.py') and file not in excluded_list:
                                  fullpath = os.path.join(root, file)
                                  included_files.append(fullpath)
                                  log.debug('Discovered file: %s', fullpath)
                          if not recursive:
          Severity: Major
          Found in pyt/__main__.py - About 45 mins to fix

            Function find_vulnerabilities has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def find_vulnerabilities(
            Severity: Minor
            Found in pyt/vulnerabilities/vulnerabilities.py - About 35 mins to fix

              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in pyt/vulnerabilities/trigger_definitions_parser.py - About 35 mins to fix

                Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(
                Severity: Minor
                Found in pyt/vulnerabilities/vulnerability_helper.py - About 35 mins to fix

                  Function save_def_args_in_temp has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def save_def_args_in_temp(
                  Severity: Minor
                  Found in pyt/cfg/expr_visitor.py - About 35 mins to fix

                    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self, label, ast_node, *, line_number=None, path):
                    Severity: Minor
                    Found in pyt/core/node_types.py - About 35 mins to fix

                      Function identify_triggers has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def identify_triggers(
                      Severity: Minor
                      Found in pyt/vulnerabilities/vulnerabilities.py - About 35 mins to fix

                        Function from_directory_import has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def from_directory_import(
                        Severity: Minor
                        Found in pyt/cfg/stmt_visitor.py - About 35 mins to fix

                          Function _get_inner_most_function_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def _get_inner_most_function_call(call_node):
                              # Loop to inner most function call
                              # e.g. return scrypt.inner in `foo = scrypt.outer(scrypt.inner(image_name))`
                              old_call_node = None
                              while call_node != old_call_node:
                          Severity: Minor
                          Found in pyt/cfg/stmt_visitor_helper.py - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function get_func_cfg_with_tainted_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def get_func_cfg_with_tainted_args(self, definition):
                                  """Build a function cfg and return it, with all arguments tainted."""
                                  log.debug("Getting CFG for %s", definition.name)
                                  func_cfg = make_cfg(
                                      definition.node,
                          Severity: Minor
                          Found in pyt/web_frameworks/framework_adaptor.py - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function report has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def report(
                              vulnerabilities,
                              fileobj,
                              print_sanitised,
                          ):
                          Severity: Minor
                          Found in pyt/formatters/screen.py - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function __str__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def __str__(self):
                                  module = 'NoModuleName'
                                  if self.module_name:
                                      module = self.module_name
                          
                          
                          Severity: Minor
                          Found in pyt/core/module_definitions.py - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function update_assignments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def update_assignments(
                              assignment_list,
                              assignment_nodes,
                              source,
                              lattice
                          Severity: Minor
                          Found in pyt/vulnerabilities/vulnerabilities.py - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function get_directory_modules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def get_directory_modules(directory):
                              """Return a list containing tuples of
                              e.g. ('__init__', 'example/import_test_project/__init__.py')
                              """
                              if _local_modules and os.path.dirname(_local_modules[0][1]) == directory:
                          Severity: Minor
                          Found in pyt/core/project_handler.py - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Severity
                          Category
                          Status
                          Source
                          Language