cea-sec/miasm

View on GitHub
miasm/arch/arm/sem.py

Summary

Maintainability
F
1 wk
Test Coverage

File sem.py has 1788 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from builtins import range
from future.utils import viewitems, viewvalues

from miasm.expression.expression import *
from miasm.expression.simplifications import expr_simp
Severity: Major
Found in miasm/arch/arm/sem.py - About 4 days to fix

    Function st_ld_r has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def st_ld_r(ir, instr, a, a2, b, store=False, size=32, s_ext=False, z_ext=False):
        e = []
        wb = False
        postinc = False
        b = b.ptr
    Severity: Minor
    Found in miasm/arch/arm/sem.py - About 4 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 do_it_block has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_it_block(self, loc, index, block, assignments, gen_pc_updt):
            instr = block.lines[index]
            it_hints, it_cond = self.parse_itt(instr)
            cond_num = cond_dct_inv[it_cond.name]
            cond_eq = tab_cond[cond_num]
    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 st_ld_m has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False):
        e = []
        wb = False
        dst = None
        if isinstance(a, ExprOp) and a.op == 'wback':
    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 _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 add_asmblock_to_ircfg has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_asmblock_to_ircfg(self, block, ircfg, gen_pc_updt=False):
            """
            Add a native block to the current IR
            @block: native assembly block
            @gen_pc_updt: insert PC update effects between instructions
    Severity: Minor
    Found in miasm/arch/arm/sem.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 st_ld_r has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def st_ld_r(ir, instr, a, a2, b, store=False, size=32, s_ext=False, z_ext=False):
    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

        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 _shift_rotate_tpl has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _shift_rotate_tpl(ir, instr, dst, shift_operation, setflags=False, is_not=False, onlyCarry=False):
          Severity: Major
          Found in miasm/arch/arm/sem.py - About 50 mins to fix

            Function st_ld_m has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False):
            Severity: Major
            Found in miasm/arch/arm/sem.py - About 50 mins to fix

              Function smlabt has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def smlabt(ir, instr, a, b, c, d):
              Severity: Minor
              Found in miasm/arch/arm/sem.py - About 45 mins to fix

                Function mls has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def mls(ir, instr, a, b, c, d):
                Severity: Minor
                Found in miasm/arch/arm/sem.py - About 45 mins to fix

                  Function umlal has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def umlal(ir, instr, a, b, c, d):
                  Severity: Minor
                  Found in miasm/arch/arm/sem.py - About 45 mins to fix

                    Function smlal has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def smlal(ir, instr, a, b, c, d):
                    Severity: Minor
                    Found in miasm/arch/arm/sem.py - About 45 mins to fix

                      Function smlatt has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def smlatt(ir, instr, a, b, c, d):
                      Severity: Minor
                      Found in miasm/arch/arm/sem.py - About 45 mins to fix

                        Function smlabb has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def smlabb(ir, instr, a, b, c, d):
                        Severity: Minor
                        Found in miasm/arch/arm/sem.py - About 45 mins to fix

                          Function smlatb has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def smlatb(ir, instr, a, b, c, d):
                          Severity: Minor
                          Found in miasm/arch/arm/sem.py - About 45 mins to fix

                            Function umull has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def umull(ir, instr, a, b, c, d):
                            Severity: Minor
                            Found in miasm/arch/arm/sem.py - About 45 mins to fix

                              Function ubfx has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def ubfx(ir, instr, a, b, c, d):
                              Severity: Minor
                              Found in miasm/arch/arm/sem.py - About 45 mins to fix

                                Function mla has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                def mla(ir, instr, a, b, c, d):
                                Severity: Minor
                                Found in miasm/arch/arm/sem.py - About 45 mins to fix

                                  Function mlas has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  def mlas(ir, instr, a, b, c, d):
                                  Severity: Minor
                                  Found in miasm/arch/arm/sem.py - About 45 mins to fix

                                    Function smull has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    def smull(ir, instr, a, b, c, d):
                                    Severity: Minor
                                    Found in miasm/arch/arm/sem.py - About 45 mins to fix

                                      Function orrs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      def orrs(ir, instr, a, b, c=None):
                                      Severity: Minor
                                      Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                        Function bfc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        def bfc(ir, instr, a, b, c):
                                        Severity: Minor
                                        Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                          Function pkhtb has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          def pkhtb(ir, instr, arg1, arg2, arg3):
                                          Severity: Minor
                                          Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                            Function lsrs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            def lsrs(ir, instr, a, b, c=None):
                                            Severity: Minor
                                            Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                              Function smulw has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                              def smulw(ir, instr, a, b, c):
                                              Severity: Minor
                                              Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                Function sel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                def sel(ir, instr, a, b, c):
                                                Severity: Minor
                                                Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                  Function sbcs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                  def sbcs(ir, instr, a, b, c=None):
                                                  Severity: Minor
                                                  Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                    Function orr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                    def orr(ir, instr, a, b, c=None):
                                                    Severity: Minor
                                                    Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                      Function rsb has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                      Open

                                                      def rsb(ir, instr, a, b, c=None):
                                                      Severity: Minor
                                                      Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                        Function l_strd has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                        def l_strd(ir, instr, a, b, c=None):
                                                        Severity: Minor
                                                        Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                          Function uxtab has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                          def uxtab(ir, instr, a, b, c):
                                                          Severity: Minor
                                                          Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                            Function asrs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                            Open

                                                            def asrs(ir, instr, a, b, c=None):
                                                            Severity: Minor
                                                            Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                              Function smul has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                              Open

                                                              def smul(ir, instr, a, b, c):
                                                              Severity: Minor
                                                              Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                Function sbc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                def sbc(ir, instr, a, b, c=None):
                                                                Severity: Minor
                                                                Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                  Function l_cmp has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                  Open

                                                                  def l_cmp(ir, instr, a, b, c=None):
                                                                  Severity: Minor
                                                                  Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                    Function asr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                    Open

                                                                    def asr(ir, instr, a, b, c=None):
                                                                    Severity: Minor
                                                                    Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                      Function lsl has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                      Open

                                                                      def lsl(ir, instr, a, b, c=None):
                                                                      Severity: Minor
                                                                      Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                        Function adc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                        Open

                                                                        def adc(ir, instr, a, b, c=None):
                                                                        Severity: Minor
                                                                        Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                          Function eor has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                          Open

                                                                          def eor(ir, instr, a, b, c=None):
                                                                          Severity: Minor
                                                                          Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                            Function eors has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                            Open

                                                                            def eors(ir, instr, a, b, c=None):
                                                                            Severity: Minor
                                                                            Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                              Function rscs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                              Open

                                                                              def rscs(ir, instr, a, b, c=None):
                                                                              Severity: Minor
                                                                              Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                Function bics has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                Open

                                                                                def bics(ir, instr, a, b, c=None):
                                                                                Severity: Minor
                                                                                Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                  Function do_it_block has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                  Open

                                                                                      def do_it_block(self, loc, index, block, assignments, gen_pc_updt):
                                                                                  Severity: Minor
                                                                                  Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                    Function sdiv has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                    Open

                                                                                    def sdiv(ir, instr, a, b, c=None):
                                                                                    Severity: Minor
                                                                                    Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                      Function ldrd has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                      Open

                                                                                      def ldrd(ir, instr, a, b, c=None):
                                                                                      Severity: Minor
                                                                                      Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                        Function muls has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                        Open

                                                                                        def muls(ir, instr, a, b, c=None):
                                                                                        Severity: Minor
                                                                                        Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                          Function uxtah has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                          Open

                                                                                          def uxtah(ir, instr, a, b, c):
                                                                                          Severity: Minor
                                                                                          Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                            Function sub has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                            Open

                                                                                            def sub(ir, instr, a, b, c=None):
                                                                                            Severity: Minor
                                                                                            Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                              Function bic has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                              Open

                                                                                              def bic(ir, instr, a, b, c=None):
                                                                                              Severity: Minor
                                                                                              Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                Function pkhbt has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                Open

                                                                                                def pkhbt(ir, instr, arg1, arg2, arg3):
                                                                                                Severity: Minor
                                                                                                Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                  Function add_condition_expr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                  def add_condition_expr(ir, instr, cond, instr_ir, extra_ir):
                                                                                                  Severity: Minor
                                                                                                  Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                    Function add has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                    def add(ir, instr, a, b, c=None):
                                                                                                    Severity: Minor
                                                                                                    Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                      Function rsbs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                      def rsbs(ir, instr, a, b, c=None):
                                                                                                      Severity: Minor
                                                                                                      Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                        Function rsc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                        def rsc(ir, instr, a, b, c=None):
                                                                                                        Severity: Minor
                                                                                                        Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                          Function cmn has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                          Open

                                                                                                          def cmn(ir, instr, a, b, c=None):
                                                                                                          Severity: Minor
                                                                                                          Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                            Function lsr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                            Open

                                                                                                            def lsr(ir, instr, a, b, c=None):
                                                                                                            Severity: Minor
                                                                                                            Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                              Function subs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                              Open

                                                                                                              def subs(ir, instr, a, b, c=None):
                                                                                                              Severity: Minor
                                                                                                              Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                Function teq has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                Open

                                                                                                                def teq(ir, instr, a, b, c=None):
                                                                                                                Severity: Minor
                                                                                                                Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                  Function udiv has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                  Open

                                                                                                                  def udiv(ir, instr, a, b, c=None):
                                                                                                                  Severity: Minor
                                                                                                                  Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                    Function lsls has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                    Open

                                                                                                                    def lsls(ir, instr, a, b, c=None):
                                                                                                                    Severity: Minor
                                                                                                                    Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                      Function l_and has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                      Open

                                                                                                                      def l_and(ir, instr, a, b, c=None):
                                                                                                                      Severity: Minor
                                                                                                                      Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                        Function orn has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                        Open

                                                                                                                        def orn(ir, instr, a, b, c=None):
                                                                                                                        Severity: Minor
                                                                                                                        Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                          Function mul has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                          Open

                                                                                                                          def mul(ir, instr, a, b, c=None):
                                                                                                                          Severity: Minor
                                                                                                                          Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                            Function uadd8 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                            Open

                                                                                                                            def uadd8(ir, instr, a, b, c):
                                                                                                                            Severity: Minor
                                                                                                                            Found in miasm/arch/arm/sem.py - About 35 mins to fix

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

                                                                                                                                  def mod_pc(self, instr, instr_ir, extra_ir):
                                                                                                                                      # fix PC (+4 for thumb)
                                                                                                                                      pc_fixed = {self.pc: ExprInt(instr.offset + 4, 32)}
                                                                                                                              
                                                                                                                                      for i, expr in enumerate(instr_ir):
                                                                                                                              Severity: Minor
                                                                                                                              Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                              Cognitive Complexity

                                                                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                              Further reading

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

                                                                                                                                  def mod_pc(self, instr, instr_ir, extra_ir):
                                                                                                                                      # fix PC (+8 for arm)
                                                                                                                                      pc_fixed = {self.pc: ExprInt(instr.offset + 8, 32)}
                                                                                                                              
                                                                                                                                      for i, expr in enumerate(instr_ir):
                                                                                                                              Severity: Minor
                                                                                                                              Found in miasm/arch/arm/sem.py - About 35 mins to fix

                                                                                                                              Cognitive Complexity

                                                                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                              Further reading

                                                                                                                              Function l_and has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                              Open

                                                                                                                              def l_and(ir, instr, a, b, c=None):
                                                                                                                                  setflags = (instr.name == 'ANDS') and a != PC
                                                                                                                                  if c is None:
                                                                                                                                      b, c = a, b
                                                                                                                                  if c.is_op():
                                                                                                                              Severity: Minor
                                                                                                                              Found in miasm/arch/arm/sem.py - About 25 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 add_condition_expr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                              Open

                                                                                                                              def add_condition_expr(ir, instr, cond, instr_ir, extra_ir):
                                                                                                                                  if cond == COND_AL:
                                                                                                                                      return instr_ir, extra_ir
                                                                                                                                  if not cond in tab_cond:
                                                                                                                                      raise ValueError('unknown condition %r' % cond)
                                                                                                                              Severity: Minor
                                                                                                                              Found in miasm/arch/arm/sem.py - About 25 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

                                                                                                                              There are no issues that match your filters.

                                                                                                                              Category
                                                                                                                              Status