cea-sec/miasm

View on GitHub

Showing 1,373 of 3,019 total issues

Function ast_eval_int has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def ast_eval_int(self, ast):
        """Eval a C ast object integer

        @ast: parsed pycparser.c_ast object
        """
Severity: Minor
Found in miasm/core/ctypesmngr.py - About 2 hrs 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 __new__ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def __new__(mcs, name, bases, dct):
        if name == "cls_mn" or name.startswith('mn_'):
            return type.__new__(mcs, name, bases, dct)
        alias = dct.get('alias', False)

Severity: Minor
Found in miasm/core/cpu.py - About 2 hrs 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 guess_mnemo has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def guess_mnemo(cls, bs, attrib, pre_dis_info, offset):
        candidates = []

        candidates = set()

Severity: Minor
Found in miasm/core/cpu.py - About 2 hrs 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

File ctype_propagation.py has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import print_function
import ida_kernwin
import idc
import ida_funcs

Severity: Minor
Found in example/ida/ctype_propagation.py - About 2 hrs to fix

    Jitter has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Jitter(object):
    
        "Main class for JIT handling"
    
        C_Gen = CGen
    Severity: Minor
    Found in miasm/jitter/jitload.py - About 2 hrs to fix

      cls_mn has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class cls_mn(with_metaclass(metamn, object)):
          args_symb = []
          instruction = instruction
          # Block's offset alignment
          alignment = 1
      Severity: Minor
      Found in miasm/core/cpu.py - About 2 hrs to fix

        Function possible_values has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def possible_values(expr):
            """Return possible values for expression @expr, associated with their
            condition constraint as a ConstrainedValues instance
            @expr: Expr instance
            """
        Severity: Minor
        Found in miasm/expression/expression_helper.py - About 2 hrs 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 encode has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def encode(self):
                e = self.expr
                if e in self.reg_info.expr:
                    self.parent.a_s.value = 0
                    self.value = self.reg_info.expr.index(e)
        Severity: Minor
        Found in miasm/arch/msp430/arch.py - About 2 hrs 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 _shift_rotate_tpl has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def _shift_rotate_tpl(ir, instr, dst, shift_operation, setflags=False, is_not=False, onlyCarry=False):
            """
            Template to generate a shift/rotate
            A temporary basic block is generated to handle 0-shift
            @dst: destination
        Severity: Minor
        Found in miasm/arch/arm/sem.py - About 2 hrs 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_ir has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_ir(self, instr):
                args = instr.args[:]
                args = [arg.replace_expr(float_replace) for arg in args]
                args = fix_mem_args_size(instr, *args)
                my_ss = None
        Severity: Minor
        Found in miasm/arch/x86/sem.py - About 2 hrs 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 _shift_tpl has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def _shift_tpl(op, ir, instr, a, b, c=None, op_inv=None, left=False,
                       custom_of=None):
            """Template to generate a shifter with operation @op
            A temporary basic block is generated to handle 0-shift
            @op: operation to execute
        Severity: Minor
        Found in miasm/arch/x86/sem.py - About 2 hrs 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 pre_dis has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def pre_dis(cls, v, mode, offset):
                offset_o = offset
                pre_dis_info = {'opmode': 0,
                                'admode': 0,
                                'g1': 0,
        Severity: Minor
        Found in miasm/arch/x86/arch.py - About 2 hrs 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 inter_block_flow_link has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def inter_block_flow_link(lifter, ircfg, flow_graph, irb_in_nodes, irb_out_nodes, todo, link_exec_to_data):
            lbl, current_nodes, exec_nodes = todo
            current_nodes = dict(current_nodes)
        
            # link current nodes to block in_nodes
        Severity: Minor
        Found in miasm/analysis/data_analysis.py - About 2 hrs 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_new_lib has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def gen_new_lib(self, target_pe, filter_import=lambda peobj, ad: True, **kwargs):
                """Gen a new DirImport description
                @target_pe: PE instance
                @filter_import: (boolean f(pe, address)) restrict addresses to keep
                """
        Severity: Minor
        Found in miasm/jitter/loader/pe.py - About 2 hrs 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 _check_state has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_state(self):
                """Check the current state against the concrete one"""
                errors = [] # List of DriftInfo
        
                for symbol in self.symb.modified_expr:
        Severity: Minor
        Found in miasm/analysis/dse.py - About 2 hrs 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 intersection has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def intersection(self, other):
                """
                Return the intersection of intervals
                @other: interval instance
                """
        Severity: Minor
        Found in miasm/core/interval.py - About 2 hrs 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 set_empty_dst_to_next has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_empty_dst_to_next(self, block, ir_blocks):
                for index, irblock in enumerate(ir_blocks):
                    if irblock.dst is not None:
                        continue
                    next_loc_key = block.get_next()
        Severity: Minor
        Found in miasm/ir/ir.py - About 2 hrs 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_fmt_args has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_fmt_args(fmt, cur_arg, get_str, get_arg_n):
            idx = 0
            fmt = get_str(fmt)
            chars_format = '%cdfsuxX'
            char_percent = '%'
        Severity: Minor
        Found in miasm/os_dep/common.py - About 2 hrs 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 mmap has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def mmap(self, addr, len_, prot, flags, fd, off, vmmngr):
                """Stub for 'mmap' syscall
        
                'mmap2' must be implemented by calling this function with off * 4096
                """
        Severity: Minor
        Found in miasm/os_dep/linux/environment.py - About 2 hrs 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 filter_asm_candidates has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def filter_asm_candidates(cls, instr, candidates):
        
                cand_same_mode = []
                cand_diff_mode = []
                out = []
        Severity: Minor
        Found in miasm/arch/x86/arch.py - About 2 hrs 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