cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

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

    def update_engine_from_cpu(self):
        """Updates CPU values according to @cpu instance"""

        for symbol in self.symbols:
            if isinstance(symbol, m2_expr.ExprId):
Severity: Minor
Found in miasm/jitter/emulatedsymbexec.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_master has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_master(self, node):
        """
        Return the representative element of the equivalence class containing
        @node
        @node: ExprMem or ExprId
Severity: Minor
Found in miasm/analysis/data_flow.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_state_from_concrete_symb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_state_from_concrete_symb(self, symbexec, cpu=True, mem=False):
        if mem:
            # Values will be retrieved from the concrete execution if they are
            # not present
            symbexec.symbols.symbols_mem.base_to_memarray.clear()
Severity: Minor
Found in miasm/analysis/dse.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 reset_class has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def reset_class(self):
        for f in self.fields_order:
            if f.strbits and isbin(f.strbits):
                f.value = int(f.strbits, 2)
            elif 'default_val' in f.kargs:
Severity: Minor
Found in miasm/core/cpu.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 compute_immediate_dominators has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_immediate_dominators(self, head):
        """Compute the immediate dominators of the graph"""
        dominators = self.compute_dominators(head)
        idoms = {}

Severity: Minor
Found in miasm/core/graph.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 gen_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def gen_fields(cls, fields=None):
        """Generate the fields of this class (so that they can be accessed with
        self.<field_name>) from a @fields list, as described in the class doc.

        Useful in case of a type cyclic dependency. For example, the following
Severity: Minor
Found in miasm/core/types.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 branch2nodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def branch2nodes(branch, nodes=None):
    if nodes is None:
        nodes = []
    for k, v in viewitems(branch):
        if not isinstance(v, dict):
Severity: Minor
Found in miasm/core/cpu.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_flow_instr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_flow_instr(self):
        if not self.lines:
            return None
        for i in range(-1, -1 - self.lines[0].delayslot - 1, -1):
            if not 0 <= i < len(self.lines):
Severity: Minor
Found in miasm/core/asmblock.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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def load(self):

        # Library to load within Jit context
        libs_to_load = []

Severity: Minor
Found in miasm/jitter/jitcore_llvm.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

Avoid too many return statements within this function.
Open

                return "%s(%s)" % (func, self.from_expr(expr.args[0]))
Severity: Major
Found in miasm/ir/translators/C.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return '(((%s&%s) %s (%s&%s))&%s)' % (
    Severity: Major
    Found in miasm/ir/translators/C.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return "((%s)&%s)" % (
      Severity: Major
      Found in miasm/ir/translators/C.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return expr, 0
        Severity: Major
        Found in miasm/ir/symbexec.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return out
          Severity: Major
          Found in miasm/ir/translators/C.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return "%s_fp%d(%s)" % (
            Severity: Major
            Found in miasm/ir/translators/C.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return (((op1 ^ res) & (op1 ^ op2))).msb()
              Severity: Major
              Found in miasm/expression/simplifications_explicit.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return "%s(%s, %s)" % (expr.op,
                Severity: Major
                Found in miasm/ir/translators/C.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return out
                  Severity: Major
                  Found in miasm/ir/translators/C.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return out
                    Severity: Major
                    Found in miasm/ir/translators/C.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return (((op1 ^ op2) ^ res) ^ ((op1 ^ res) & (op1 ^ op2))).msb()
                      Severity: Major
                      Found in miasm/expression/simplifications_explicit.py - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language