Showing 1,373 of 3,020 total issues
Function compare_exprs
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def compare_exprs(expr1, expr2):
"""Compare 2 expressions for canonization
@expr1: Expr
@expr2: Expr
0 => ==
- Read upRead up
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 arg2html
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def arg2html(expr, index=None, loc_db=None):
wb = False
if expr.is_id() or expr.is_int() or expr.is_loc():
return color_expr_html(expr, loc_db)
if isinstance(expr, ExprOp) and expr.op in expr2shift_dct:
- Read upRead up
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 vm_load_pe_and_dependencies
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def vm_load_pe_and_dependencies(vm, fname, name2module, runtime_lib,
lib_path_base, **kwargs):
"""Load a binary and all its dependencies. Returns a dictionary containing
the association between binaries names and it's pe object
- Read upRead up
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 value
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def value(self, mode):
todo = [(0, 0, [(x, self.fields_order[x]) for x in self.to_decode[::-1]])]
result = []
done = []
- Read upRead up
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
LocationDB
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class LocationDB(object):
"""
LocationDB is a "database" of information associated to location.
An entry in a LocationDB is uniquely identified with a LocKey.
moduint
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class moduint(object):
def __init__(self, arg):
self.arg = int(arg) % self.__class__.limit
assert(self.arg >= 0 and self.arg < self.__class__.limit)
File regs.py
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
from builtins import range
from miasm.expression.expression import ExprId
from miasm.core.cpu import reg_info
Function from_ExprOp
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def from_ExprOp(self, expr):
args = list(map(self.from_expr, expr.args))
res = args[0]
if len(args) > 1:
- Read upRead up
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 intra_block_flow_symb
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def intra_block_flow_symb(lifter, _, flow_graph, irblock, in_nodes, out_nodes):
symbols_init = lifter.arch.regs.regs_init.copy()
sb = SymbolicExecutionEngine(lifter, symbols_init)
sb.eval_updt_irblock(irblock)
print('*' * 40)
- Read upRead up
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 visit
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def visit(self, expr, *args, **kwargs):
if expr.is_int() or expr.is_id() or expr.is_loc():
pass
elif expr.is_assign():
ret = self.visit(expr.dst, *args, **kwargs)
- Read upRead up
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 arg2str
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def arg2str(expr, index=None, loc_db=None):
wb = False
if expr.is_id() or expr.is_int():
return str(expr)
elif expr.is_loc():
- Read upRead up
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 src_gen_phi_node_srcs
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def src_gen_phi_node_srcs(self, equivalence_graph):
for node in equivalence_graph.nodes():
if not node.is_op("Phi"):
continue
phi_successors = equivalence_graph.successors(node)
- Read upRead up
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 ldz
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def ldz(rn, rm):
"""LDZ - Count Leading Zeroes
Note: this implementation is readable, yet slow. Each bit are tested
individually, and the results are propagated to other bits.
- Read upRead up
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 32 (exceeds 5 allowed). Consider refactoring. Open
def get_ir(self, instr):
args = instr.args[:]
if instr.name[0:5] in [ 'ADDIS', 'ORIS', 'XORIS', 'ANDIS' ]:
args[2] = ExprInt(int(args[2]) << 16, 32)
if instr.name[0:3] == 'ADD':
- Read upRead up
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 modrm2expr
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def modrm2expr(modrm, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
o = []
if not modrm[f_isad]:
modrm_k = [key for key, value in viewitems(modrm) if value == 1]
if len(modrm_k) != 1:
- Read upRead up
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 gete
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def gete(self, raw, off):
if not off:
return None, off
if self.parent_head._wsize == 32:
mask_ptr = 0x80000000
- Read upRead up
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 gete
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def gete(self, raw, off):
if not off:
return None, off
ofend = off + \
- Read upRead up
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 vm_load_pe
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def vm_load_pe(vm, fdata, align_s=True, load_hdr=True, name="", winobjs=None, **kargs):
"""Load a PE in memory (@vm) from a data buffer @fdata
@vm: VmMngr instance
@fdata: data buffer to parse
@align_s: (optional) If False, keep gaps between section
- Read upRead up
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_objc
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def _get_objc(self, type_id, resolved=None, to_fix=None, lvl=0):
if resolved is None:
resolved = {}
if to_fix is None:
to_fix = []
- Read upRead up
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 sem.py
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
#-*- coding:utf-8 -*-
from miasm.expression.expression import *
from miasm.arch.msp430.regs import *
from miasm.arch.msp430.arch import mn_msp430