File arch.py
has 3761 lines of code (exceeds 250 allowed). Consider refactoring. Open
#-*- coding:utf-8 -*-
from __future__ import print_function
from builtins import range
import re
Function gen_modrm_form
has a Cognitive Complexity of 201 (exceeds 5 allowed). Consider refactoring. Open
def gen_modrm_form():
global db_afs_64, sib_64_s08_ebp
ebp = 5
sib_s08_ebp = [{f_isad: True} for i in range(0x100)]
- 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 expr2modrm
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
def expr2modrm(expr, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
dct_expr = {f_isad : False}
if mm or xmm or bnd:
if mm and expr.size != 64:
- 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 gen_cand
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def gen_cand(self, v_cand, admode):
if not admode in modrm2byte:
# XXX TODO: 64bit
return
if not v_cand:
- 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 parse_mem
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def parse_mem(expr, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
dct_expr = {}
opmode = parent.v_opmode()
if is_mem_segm(expr) and expr.ptr.args[0].is_int():
return None, None, False
- 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 asm_ast_to_expr
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def asm_ast_to_expr(self, value, loc_db, size_hint=None, fixed_size=None):
if size_hint is None:
size_hint = self.parent.mode
if fixed_size is None:
fixed_size = set()
- 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 gen_prefix
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def gen_prefix(self):
v = b""
rex = 0x40
if self.g1.value is None:
self.g1.value = 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 flen
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def flen(cls, mode, v):
if admode_prefix((mode, v['opmode'], v['admode'])) == 16:
if v['mod'] == 0b00:
if v['rm'] == 0b110:
return 16
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
def arg2str(expr, index=None, loc_db=None):
if expr.is_id() or expr.is_int():
o = str(expr)
elif expr.is_loc():
if loc_db is not None:
- 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 encode
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
if not isinstance(self.expr, ExprInt):
return
arg0_expr = self.parent.args[0].expr
self.parent.rex_w.value = 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 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,
- 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 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 = []
- 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 divert
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def divert(self, i, candidates):
out = []
for candidate in candidates:
cls, name, bases, dct, fields = candidate
fopmode = opmode_prefix(
- 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 divert
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def divert(self, i, candidates):
out = []
for candidate in candidates:
cls, name, bases, dct, fields = candidate
fopmode = opmode_prefix(
- 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
mn_x86
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class mn_x86(cls_mn):
name = "x86"
prefix_op_size = False
prefix_ad_size = False
regs = regs_module
Function exprfindmod
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def exprfindmod(e, o=None):
if o is None:
o = {}
if isinstance(e, ExprInt):
return e
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
def arg2html(expr, index=None, loc_db=None):
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
- 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 encode
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
if not isinstance(self.expr, ExprId):
return False
if self.expr in gpregs64.expr and not hasattr(self.parent, 'stk'):
self.parent.rex_w.value = 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 fromstring
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fromstring(self, text, loc_db, parser_result=None):
if not hasattr(self.parent, 'sx') and hasattr(self.parent, "w8"):
self.parent.w8.value = 1
if parser_result:
result, start, stop = parser_result[self.parser]
- 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 divert
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def divert(self, i, candidates):
out = []
done = False
for cls, name, bases, dct, fields in candidates:
ndct = dict(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 encode
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
if not isinstance(self.expr, ExprInt):
return False
v = int(self.expr)
opmode = self.parent.v_opmode()
- 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 encode
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
self.value = 0
p = self.parent
expr = self.expr
osize = p.v_opmode()
- 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 decode
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def decode(self, v):
v = v & self.lmask
p = self.parent
opmode = p.v_opmode()
if not hasattr(p, 'sx') and (hasattr(p, 'w8') and p.w8.value == 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 add_pre_dis_info
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add_pre_dis_info(self, pre_dis_info=None):
if pre_dis_info is None:
return True
if hasattr(self, "prefixed") and self.prefixed.default == b"\x66":
pre_dis_info['opmode'] = 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 fromstring
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fromstring(self, text, loc_db, parser_result=None):
if parser_result:
e, start, stop = parser_result[self.parser]
if e is None:
return None, None
- 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 to_string
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_string(self, loc_db=None):
o = super(instruction_x86, self).to_string(loc_db)
if self.additional_info.g1.value & 1:
o = "LOCK %s" % o
if self.additional_info.g1.value & 2:
- 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 v_opmode_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def v_opmode_info(size, opmode, rex_w, stk):
if size in [16, 32]:
if opmode:
return invmode[size]
else:
- 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 to_html
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_html(self, loc_db=None):
o = super(instruction_x86, self).to_html(loc_db)
if self.additional_info.g1.value & 1:
text = utils.set_html_text_color("LOCK", utils.COLOR_MNEMO)
o = "%s %s" % (text, o)
- 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
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)):
Function encode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
expr = self.expr
if isinstance(expr, ExprInt):
return
if isinstance(expr, ExprMem) and expr.size != self.msize:
- 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 parse_mem
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def parse_mem(expr, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
Function expr2modrm
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def expr2modrm(expr, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
Function modrm2expr
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def modrm2expr(modrm, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
Avoid deeply nested control flow statements. Open
for rex_b in range(2):
for rex_x in range(2):
sib_rez[rex_x][rex_b][index][f_imm] = f_s08
sib_rez[rex_x][rex_b][index][b + 8 * rex_b] = 1
Avoid deeply nested control flow statements. Open
if int(disp) != int(value):
continue
else:
Avoid deeply nested control flow statements. Open
for rex_b in range(2):
for rex_x in range(2):
sib_rez[rex_x][rex_b][index][f_imm] = f_u32
elif sib_rez == sib_64_s08_ebp:
Avoid deeply nested control flow statements. Open
for rex_b in range(2):
for rex_x in range(2):
sib_rez[rex_x][rex_b][index][b + 8 * rex_b] = 1
sib_rez[rex_x][rex_b][index][f_imm] = f_u32
elif sib_rez == sib_u64:
Avoid deeply nested control flow statements. Open
for rex_b in range(2):
for rex_x in range(2):
sib_rez[rex_x][rex_b][index][f_imm] = f_s08
sib_rez[rex_x][rex_b][index][ebp + 8 * rex_b] = 1
Avoid deeply nested control flow statements. Open
for rex_x in range(2):
tmp = i + 8 * rex_x
if i == 0b100 and rex_x == 0:
continue
if not tmp in sib_rez[rex_x][rex_b][index]:
Function fromstring
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fromstring(self, text, loc_db, parser_result=None):
if parser_result:
expr, start, stop = parser_result[self.parser]
else:
try:
- 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
Avoid deeply nested control flow statements. Open
if int(disp) != sign_ext(int(value), admode, disp.size):
continue
else:
Avoid deeply nested control flow statements. Open
for rex_b in range(2):
for rex_x in range(2):
sib_rez[rex_x][rex_b][index][b + 8 * rex_b] = 1
elif sib_rez == sib_64_s08_ebp:
Avoid deeply nested control flow statements. Open
for rex_b in range(2):
for rex_x in range(2):
sib_rez[rex_x][rex_b][index][f_imm] = f_u32
sib_rez[rex_x][rex_b][index][ebp + 8 * rex_b] = 1
elif sib_rez == sib_u64:
Function opmode_prefix
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def opmode_prefix(mode):
size, opmode, admode = mode
if size in [16, 32]:
if opmode:
return invmode[size]
- 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
Consider simplifying this complex logical expression. Open
if expr.is_id() or expr.is_int():
o = str(expr)
elif expr.is_loc():
if loc_db is not None:
o = loc_db.pretty_str(expr.loc_key)
Consider simplifying this complex logical expression. Open
if 'mod' in dct and dct['mod'] == 0b00 and \
'rm' in dct and dct['rm'] == 0b110:
nfields[i] = bs(
l=16, cls=(x86_16_ne,), fname=self.args['fname'])
ndct[self.args['fname']] = True
Consider simplifying this complex logical expression. Open
if 'mod' in dct and dct['mod'] == 0b00 and \
'rm' in dct and dct['rm'] == 0b101:
nfields[i] = bs(
l=32, cls=(x86_32_ne,), fname=self.args['fname'])
ndct[self.args['fname']] = True
Function gen_modes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def gen_modes(cls, subcls, name, bases, dct, fields):
Function encode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
if isinstance(self.expr, ExprInt):
return
p = self.parent
if p.w8.value is None:
- 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 fromstring
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fromstring(self, text, loc_db, parser_result=None):
if parser_result:
e, start, stop = parser_result[self.parser]
if e is None:
return None, None
- 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 encode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
if isinstance(self.expr, ExprInt):
return
p = self.parent
if p.w8.value is None:
- 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 encode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def encode(self):
if not hasattr(self.parent, "mseg"):
return
m = self.parent.mseg.expr
if not (isinstance(m, ExprOp) and m.op == 'segm'):
- 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 flen
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def flen(cls, mode, v):
if 'w8' not in v or v['w8'] == 1:
if 'se' in v and v['se'] == 1:
return 8
else:
- 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 v_admode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def v_admode(self):
size, opmode, admode = self.mode, self.opmode, self.admode
if size in [16, 32]:
if admode:
return invmode[size]
- 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 v_admode_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def v_admode_info(size, admode):
if size in [16, 32]:
if admode:
return invmode[size]
else:
- 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
Avoid too many return
statements within this function. Open
return ExprOp(value.op, *args)
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return v
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return None, None
Avoid too many return
statements within this function. Open
return 64
Avoid too many return
statements within this function. Open
return [dct_expr], None, True
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return parse_mem(expr, parent, w8, sx, xmm, mm, bnd)
Avoid too many return
statements within this function. Open
return ExprOp('segm', segm, ptr)
Avoid too many return
statements within this function. Open
return 32
Avoid too many return
statements within this function. Open
return self.name in ['CALL']
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return out, segm, True
Avoid too many return
statements within this function. Open
return None, None
Avoid too many return
statements within this function. Open
return 32
Avoid too many return
statements within this function. Open
return ExprInt(value.value, size_hint)
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return ExprLoc(loc_key, size_hint)
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return [dct_expr], None, True
Avoid too many return
statements within this function. Open
return start, stop
Avoid too many return
statements within this function. Open
return [dct_expr], None, True
Avoid too many return
statements within this function. Open
return v['rm'] == 0b100
Avoid too many return
statements within this function. Open
return ExprMem(ptr, value.size)
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return 32
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return 32
Avoid too many return
statements within this function. Open
return [dct_expr], None, True
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return 32
Avoid too many return
statements within this function. Open
return 8
Avoid too many return
statements within this function. Open
return None, None, False
Avoid too many return
statements within this function. Open
return [dct_expr], None, True
Avoid too many return
statements within this function. Open
return self.name in ['CALL', 'HLT', 'IRET', 'IRETD', 'IRETQ', 'ICEBP', 'UD2']
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return [dct_expr], None, True
Avoid too many return
statements within this function. Open
return parse_mem(expr, parent, w8, sx, xmm, mm)
Avoid too many return
statements within this function. Open
return None, None
Avoid too many return
statements within this function. Open
return 8
Avoid too many return
statements within this function. Open
return None, None
Avoid too many return
statements within this function. Open
return None, None
Avoid too many return
statements within this function. Open
return start, stop
Avoid too many return
statements within this function. Open
return None, None
Avoid too many return
statements within this function. Open
return start, stop
Function flen
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def flen(cls, mode, v):
if 'w8' not in v or v['w8'] == 1:
if 'se' in v and v['se'] == 1:
return 8
else:
- 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_cls_instance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_cls_instance(cls, cc, mode, infos=None):
for opmode in [0, 1]:
for admode in [0, 1]:
c = cc()
c.init_class()
- 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 decode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode(self, v):
if self.parent.mode == 64:
if self.parent.admode == 1:
l = 32
else:
- 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 post_dis
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def post_dis(self):
if self.g2.value:
for a in self.args:
if not isinstance(a.expr, ExprMem):
continue
- 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"