cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

Function reduce_op has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def reduce_op(self, node, lvl=0, **kwargs):
        """Generate access for ExprOp"""
        if not (node.expr.is_op("+") or is_op_segm(node.expr)) \
           or len(node.args) != 2:
            return None
Severity: Minor
Found in miasm/core/objc.py - About 1 hr 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 dot has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def dot(self):
        """Render dot graph with HTML"""

        td_attr = {'align': 'left'}
        nodes_attr = {'shape': 'Mrecord',
Severity: Minor
Found in miasm/core/graph.py - About 1 hr 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 factor_fields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def factor_fields(tree):
    if not isinstance(tree, dict):
        return tree
    if len(tree) != 1:
        return tree
Severity: Minor
Found in miasm/core/cpu.py - About 1 hr 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 access_simplifier has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def access_simplifier(expr):
    """Expression visitor to simplify a C access represented in Miasm

    @expr: Miasm expression representing the C access

Severity: Minor
Found in miasm/core/objc.py - About 1 hr 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 merge has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def merge(self, location_db):
        """Merge with another LocationDB @location_db

        WARNING: old reference to @location_db information (such as LocKeys)
        must be retrieved from the updated version of this instance. The
Severity: Minor
Found in miasm/core/locationdb.py - About 1 hr 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 cb_op_plusminus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def cb_op_plusminus(tokens):
    tokens = tokens[0]
    if len(tokens) == 3:
        # binary op
        assert isinstance(tokens[0], AstNode)
Severity: Minor
Found in miasm/core/cpu.py - About 1 hr 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 find_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def find_path(self, src, dst, cycles_count=0, done=None):
        """
        Searches for paths from @src to @dst
        @src: loc_key of basic block from which it should start
        @dst: loc_key of basic block where it should stop
Severity: Minor
Found in miasm/core/graph.py - About 1 hr 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 msr has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def msr(ir, instr, arg1, arg2, arg3, arg4, arg5, arg6):
Severity: Major
Found in miasm/arch/aarch64/sem.py - About 1 hr to fix

    Function mrs has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def mrs(ir, insr, arg1, arg2, arg3, arg4, arg5, arg6):
    Severity: Major
    Found in miasm/arch/aarch64/sem.py - About 1 hr to fix

      Function mcr has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def mcr(ir, insr, arg1, arg2, arg3, arg4, arg5, arg6):
      Severity: Major
      Found in miasm/arch/arm/sem.py - About 1 hr to fix

        Function mrc has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def mrc(ir, insr, arg1, arg2, arg3, arg4, arg5, arg6):
        Severity: Major
        Found in miasm/arch/arm/sem.py - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if expr.is_id() or expr.is_int() or expr.is_loc():
                      o = color_expr_html(expr, loc_db)
                  elif ((isinstance(expr, ExprOp) and expr.op == 'far' and
                         isinstance(expr.args[0], ExprMem)) or
                        isinstance(expr, ExprMem)):
          Severity: Major
          Found in miasm/arch/x86/arch.py - About 1 hr to fix

            Function __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, lifter_model_call, ircfg, mn):
            
                    self.lifter_model_call = lifter_model_call
                    self.ircfg = ircfg
                    self.mn = mn
            Severity: Minor
            Found in example/ida/depgraph.py - About 55 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 write has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def write(self, dst, src):
                    """
                    Update @dst with @src expression
                    @dst: ExprId or ExprMem instance
                    @src: Expression instance
            Severity: Minor
            Found in miasm/ir/symbexec.py - About 55 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 getby_offset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def getby_offset(self, offset):
                    """
                    Return the set of loc_keys of irblocks containing @offset
                    @offset: address
                    """
            Severity: Minor
            Found in miasm/ir/ir.py - About 55 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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def get(self, addr, size, addr_size):
                    """ Memory access at address @addr of size @size with
                    address size @addr_size.
                    @addr: an SMT2 expression, the address to read.
                    @size: int, size of the read in bits.
            Severity: Minor
            Found in miasm/ir/translators/smt2.py - About 55 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 kernel32_ReadFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def kernel32_ReadFile(jitter):
                ret_ad, args = jitter.func_args_stdcall(["hwnd", "lpbuffer",
                                                         "nnumberofbytestoread",
                                                         "lpnumberofbytesread",
                                                         "lpoverlapped"])
            Severity: Minor
            Found in miasm/os_dep/win_api_x86_32.py - About 55 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 from_ExprOp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def from_ExprOp(self, expr):
                    if expr.op in self.op_no_translate:
                        args = list(map(self.from_expr, expr.args))
                        if len(expr.args) == 1:
                            return "((%s %s) & 0x%x)" % (
            Severity: Minor
            Found in miasm/ir/translators/python.py - About 55 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 prepare_loader_arml has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def prepare_loader_arml(jitter, argv, envp, auxv, linux_env,
                                    hlt_address=0x13371acc):
                """Fill the environment with enough information to run a linux loader
            
                @jitter: Jitter instance
            Severity: Minor
            Found in miasm/os_dep/linux/environment.py - About 55 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 write has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def write(self, offset, expr):
                    """
                    Write @expr at @offset
                    @offset: integer (in bytes)
                    @expr: Expr instance value
            Severity: Minor
            Found in miasm/ir/symbexec.py - About 55 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