cea-sec/miasm

View on GitHub
miasm/expression/simplifications_common.py

Summary

Maintainability
F
1 mo
Test Coverage

Function simp_cst_propagation has a Cognitive Complexity of 210 (exceeds 5 allowed). Consider refactoring.
Open

def simp_cst_propagation(e_s, expr):
    """This passe includes:
     - Constant folding
     - Common logical identities
     - Common binary identities
Severity: Minor
Found in miasm/expression/simplifications_common.py - About 4 days to fix

Cognitive Complexity

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

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

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

Further reading

File simplifications_common.py has 1535 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# ----------------------------- #
# Common simplifications passes #
# ----------------------------- #

from future.utils import viewitems
Severity: Major
Found in miasm/expression/simplifications_common.py - About 4 days to fix

    Consider simplifying this complex logical expression.
    Open

        if (expr.is_op("CC_U>=") and
              test_cc_eq_args(
                  expr,
                  "FLAG_SUB_CF"
              )):
    Severity: Critical
    Found in miasm/expression/simplifications_common.py - About 1 day to fix

      Function simp_slice has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_slice(e_s, expr):
          "Slice optimization"
      
          # slice(A, 0, a.size) => A
          if expr.start == 0 and expr.stop == expr.arg.size:
      Severity: Minor
      Found in miasm/expression/simplifications_common.py - About 7 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 simp_cc_conds has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_cc_conds(_, expr):
          """
          High level simplifications. Example:
          CC_U<(FLAG_SUB_CF(A, B) => A <u B
          """
      Severity: Minor
      Found in miasm/expression/simplifications_common.py - About 6 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 simp_add_multiple has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_add_multiple(_, expr):
          """
          X + X => 2 * X
          X + X * int1 => X * (1 + int1)
          X * int1 + (- X) => X * (int1 - 1)
      Severity: Minor
      Found in miasm/expression/simplifications_common.py - About 5 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 simp_cmp_bijective_op has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_cmp_bijective_op(expr_simp, expr):
          """
          A + B == A => A == 0
      
          X + A == X + B => A == B
      Severity: Minor
      Found in miasm/expression/simplifications_common.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 simp_cond has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_cond(_, expr):
          """
          Common simplifications on ExprCond.
          Eval exprcond src1/src2 with satifiable/unsatisfiable condition propagation
          """
      Severity: Minor
      Found in miasm/expression/simplifications_common.py - About 3 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 simp_compose has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_compose(e_s, expr):
          "Commons simplification on ExprCompose"
          args = merge_sliceto_slice(expr)
          out = []
          # compose of compose
      Severity: Minor
      Found in miasm/expression/simplifications_common.py - About 3 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 simp_smod_sext has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_smod_sext(expr_s, expr):
          """
          a.size == b.size
          smod(a.signExtend(X), b.signExtend(X)) => smod(a, b).signExtend(X)
          """
      Severity: Minor
      Found in miasm/expression/simplifications_common.py - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function simp_cond_factor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_cond_factor(e_s, expr):
          "Merge similar conditions"
          if not expr.op in ["+", "|", "^", "&", "*", '<<', '>>', 'a>>']:
              return expr
          if len(expr.args) < 2:
      Severity: Minor
      Found in miasm/expression/simplifications_common.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 simp_cmp_int has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_cmp_int(expr_simp, expr):
          """
          ({X, 0} == int) => X == int[:]
          X + int1 == int2 => X == int2-int1
          X ^ int1 == int2 => X == int1^int2
      Severity: Minor
      Found in miasm/expression/simplifications_common.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 simp_zeroext_and_cst_eq_cst has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_zeroext_and_cst_eq_cst(expr_s, expr):
          """
          A.zeroExt(X) & ... & int == int => A & ... & int[:A.size] == int[:A.size]
          """
          if not expr.is_op(TOK_EQUAL):
      Severity: Minor
      Found in miasm/expression/simplifications_common.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 simp_slice_of_op_ext has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_slice_of_op_ext(expr_s, expr):
          """
          (X.zeroExt() + {Z, } + ... + Int)[0:8] => X + ... + int[:]
          (X.zeroExt() | ... | Int)[0:8] => X | ... | int[:]
          ...
      Severity: Minor
      Found in miasm/expression/simplifications_common.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

      Consider simplifying this complex logical expression.
      Open

          if (not ((arg1.is_op() and arg1.op.startswith("zeroExt") and
                    arg2.is_op() and arg2.op.startswith("zeroExt")) or
                   (arg1.is_op() and arg1.op.startswith("signExt") and
                     arg2.is_op() and arg2.op.startswith("signExt")))):
              return expr
      Severity: Critical
      Found in miasm/expression/simplifications_common.py - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

            if expr.cond.is_op('-') and len(expr.cond.args) == 1:
                expr = ExprCond(expr.cond.args[0], expr.src1, expr.src2)
            # a?x:x
            elif expr.src1 == expr.src2:
                expr = expr.src1
        Severity: Critical
        Found in miasm/expression/simplifications_common.py - About 1 hr to fix

          Function simp_compose_and_mask has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def simp_compose_and_mask(_, expr):
              """
              {X 0 8, Y 8 32} & 0xFF => zeroExt(X)
              {X 0 8, Y 8 16, Z 16 32} & 0xFFFF => {X 0 8, Y 8 16, 0x0 16 32}
              {X 0 8, 0x123456 8 32} & 0xFFFFFF => {X 0 8, 0x1234 8 24, 0x0 24 32}
          Severity: Minor
          Found in miasm/expression/simplifications_common.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 simp_cmp_int_int has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def simp_cmp_int_int(_, expr):
              """
              IntA <s IntB => int
              IntA <u IntB => int
              IntA <=s IntB => int
          Severity: Minor
          Found in miasm/expression/simplifications_common.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 simp_sign_inf_zeroext has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def simp_sign_inf_zeroext(expr_s, expr):
              """
              [!] Ensure before: X.zeroExt(X.size) => X
          
              X.zeroExt() <s 0 => 0
          Severity: Minor
          Found in miasm/expression/simplifications_common.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 simp_cond_logic_ext has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def simp_cond_logic_ext(expr_s, expr):
              """(X.zeroExt() + ... + Int) ? A:B => X + ... + int[:] ? A:B"""
              cond = expr.cond
              if not cond.is_op():
                  return expr
          Severity: Minor
          Found in miasm/expression/simplifications_common.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 simp_cond_op_int has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def simp_cond_op_int(_, expr):
              "Extract conditions from operations"
          
          
              # x?a:b + x?c:d + e => x?(a+c+e:b+d+e)
          Severity: Minor
          Found in miasm/expression/simplifications_common.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 simp_cmp_int_arg has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def simp_cmp_int_arg(_, expr):
              """
              (0x10 <= R0) ? A:B
              =>
              (R0 < 0x10) ? B:A
          Severity: Minor
          Found in miasm/expression/simplifications_common.py - About 55 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function simp_test_signext_inf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def simp_test_signext_inf(expr_s, expr):
              """A.signExt() <s int => A <s int[:]"""
              if not (expr.is_op(TOK_INF_SIGNED) or expr.is_op(TOK_INF_EQUAL_SIGNED)):
                  return expr
              arg, cst = expr.args
          Severity: Minor
          Found in miasm/expression/simplifications_common.py - About 45 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

          Avoid deeply nested control flow statements.
          Open

                              if is_signed:
                                  out = -1
                              else:
                                  out = 0
                          else:
          Severity: Major
          Found in miasm/expression/simplifications_common.py - About 45 mins to fix

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

            def simp_bcdadd_cf(_, expr):
                """bcdadd(const, const) => decimal"""
                if not(expr.is_op('bcdadd_cf')):
                    return expr
                arg1 = expr.args[0]
            Severity: Minor
            Found in miasm/expression/simplifications_common.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 simp_test_zeroext_inf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def simp_test_zeroext_inf(expr_s, expr):
                """A.zeroExt() <u int => A <u int[:]"""
                if not (expr.is_op(TOK_INF_UNSIGNED) or expr.is_op(TOK_INF_EQUAL_UNSIGNED)):
                    return expr
                arg, cst = expr.args
            Severity: Minor
            Found in miasm/expression/simplifications_common.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 simp_bcdadd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def simp_bcdadd(_, expr):
                """bcdadd(const, const) => decimal"""
                if not(expr.is_op('bcdadd')):
                    return expr
                arg1 = expr.args[0]
            Severity: Minor
            Found in miasm/expression/simplifications_common.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

            Avoid too many return statements within this function.
            Open

                    return ExprCompose(*args)
            Severity: Major
            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return ExprOp('+', args[0], -args[1])
              Severity: Major
              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return args[-1]
                Severity: Major
                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return ExprCompose(*args)
                  Severity: Major
                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return args[0]
                    Severity: Major
                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                          return expr
                      Severity: Major
                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return args[0].args[0]
                        Severity: Major
                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return ExprInt(expr.size - (i + 1), args[0].size)
                          Severity: Major
                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return args[0].args[0]
                            Severity: Major
                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return ExprOp('&', *args)
                              Severity: Major
                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return ExprOp(op_name, *args)
                                Severity: Major
                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return args[0]
                                  Severity: Major
                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                        return expr
                                    Severity: Major
                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return ExprInt(0, expr.size)
                                      Severity: Major
                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return ret
                                        Severity: Major
                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                  return args[0]
                                          Severity: Major
                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                    return args[0]
                                            Severity: Major
                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                      return ExprCompose(*out)
                                              Severity: Major
                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                            return args[0]
                                                Severity: Major
                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                          return ExprOp('*', *(list(args[:-1]) + [ExprInt(-int(args[-1]), expr.size)]))
                                                  Severity: Major
                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return ExprCompose(*args)
                                                    Severity: Major
                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return ExprInt(i, args[0].size)
                                                      Severity: Major
                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return ExprInt(-int(args[0]), expr.size)
                                                        Severity: Major
                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                  return ExprCond(args[0].cond, int1, int2)
                                                          Severity: Major
                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                    return ExprInt(parity(int(args[0])), 1)
                                                            Severity: Major
                                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                          return ExprInt(args[0].size, args[0].size)
                                                              Severity: Major
                                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                        return ExprOp('+', *args)
                                                                Severity: Major
                                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                              return ExprInt(0, args[0].size)
                                                                  Severity: Major
                                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                return -ExprOp(op_name, *new_args)
                                                                    Severity: Major
                                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                          return ExprOp(TOK_INF_EQUAL_UNSIGNED, src, expr_s(arg2[:src.size]))
                                                                      Severity: Major
                                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                            return expr
                                                                        Severity: Major
                                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                              return ExprOp(src.op, *args)
                                                                          Severity: Major
                                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                        return tmp
                                                                            Severity: Major
                                                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return ExprOp(TOK_EQUAL, ExprOp(op, *args_b), ExprInt(0, args_b[0].size))
                                                                              Severity: Major
                                                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                                return ExprOp("smod", src1, src2).signExtend(expr.size)
                                                                                Severity: Major
                                                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                      return expr
                                                                                  Severity: Major
                                                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                        return expr
                                                                                    Severity: Major
                                                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                          return ExprCond(ExprOp(op, arg1, arg2), src1, src2)
                                                                                      Severity: Major
                                                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                return expr
                                                                                        Severity: Major
                                                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                  return expr
                                                                                          Severity: Major
                                                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                    return expr
                                                                                            Severity: Major
                                                                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                          return ExprCompose(*out).zeroExtend(expr.size)
                                                                                              Severity: Major
                                                                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                        return ExprOp(expr.arg.op, *args)
                                                                                                Severity: Major
                                                                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                      return expr
                                                                                                  Severity: Major
                                                                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                        return expr
                                                                                                    Severity: Major
                                                                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                              return ExprOp(TOK_EQUAL, ExprOp(op, *args_a), ExprInt(0, args_a[0].size))
                                                                                                      Severity: Major
                                                                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                return expr
                                                                                                        Severity: Major
                                                                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                  return expr
                                                                                                          Severity: Major
                                                                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

                                                                                                                    return ExprCond(cond, arg1, arg2)
                                                                                                            Severity: Major
                                                                                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

                                                                                                                  return expr
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

                                                                                                                    return expr
                                                                                                                Severity: Major
                                                                                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

                                                                                                                                  return arg[expr.start - shift:expr.stop - shift]
                                                                                                                  Severity: Major
                                                                                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

                                                                                                                            return ExprCond(arg, expr.src1, expr.src2)
                                                                                                                    Severity: Major
                                                                                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

                                                                                                                              return ExprInt(1, 1)
                                                                                                                      Severity: Major
                                                                                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

                                                                                                                                    return ExprOp(TOK_EQUAL, src, ExprInt(0, src.size))
                                                                                                                        Severity: Major
                                                                                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

                                                                                                                              return ExprInt(ret, 1)
                                                                                                                          Severity: Major
                                                                                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

                                                                                                                                    return ExprCond(ExprOp(TOK_EQUAL, arg2, arg1), src1, src2)
                                                                                                                            Severity: Major
                                                                                                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

                                                                                                                                  return ret
                                                                                                                              Severity: Major
                                                                                                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

                                                                                                                                    return expr
                                                                                                                                Severity: Major
                                                                                                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

                                                                                                                                      return expr
                                                                                                                                  Severity: Major
                                                                                                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                    Open

                                                                                                                                            return expr
                                                                                                                                    Severity: Major
                                                                                                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                      Open

                                                                                                                                          return ExprOp(TOK_EQUAL, arg_a, arg_b)
                                                                                                                                      Severity: Major
                                                                                                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                        Open

                                                                                                                                            return expr
                                                                                                                                        Severity: Major
                                                                                                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                          Open

                                                                                                                                              return ExprOp(TOK_EQUAL, src, ExprInt(int(arg2), src.size))
                                                                                                                                          Severity: Major
                                                                                                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                            Open

                                                                                                                                                return ExprOp('+', *out)
                                                                                                                                            Severity: Major
                                                                                                                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                              Open

                                                                                                                                                      return ExprCond(expr.arg.cond, src1, src2)
                                                                                                                                              Severity: Major
                                                                                                                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                Open

                                                                                                                                                        return ExprInt(1, 1)
                                                                                                                                                Severity: Major
                                                                                                                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                  Open

                                                                                                                                                          return ExprInt(0, expr.size)
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                    Open

                                                                                                                                                            return expr
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                      Open

                                                                                                                                                              return ExprMem(expr.arg.ptr, size=expr.stop)
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                        Open

                                                                                                                                                                        return arg[expr.start + shift:expr.stop + shift]
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                          Open

                                                                                                                                                                  return expr
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                            Open

                                                                                                                                                                    return ExprOp(TOK_INF_UNSIGNED, src, expr_s(arg2[:src.size]))
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                              Open

                                                                                                                                                                      return arg.zeroExtend(expr.stop)
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                Open

                                                                                                                                                                    return ExprCond(cond, expr.src1, expr.src2)
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                  Open

                                                                                                                                                                      return ExprCompose(*args)
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                    Open

                                                                                                                                                                            return ExprCond(arg, expr.src2, expr.src1)
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                      Open

                                                                                                                                                                          return ExprCond(cond, expr.src1, expr.src2)
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                        Open

                                                                                                                                                                                    return ExprCompose(*out).zeroExtend(expr.size)
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in miasm/expression/simplifications_common.py - About 30 mins to fix

                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                          Open

                                                                                                                                                                                      return expr
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in miasm/expression/simplifications_common.py - About 30 mins to fix

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

                                                                                                                                                                            def simp_ext_eq_ext(_, expr):
                                                                                                                                                                                """
                                                                                                                                                                                A.zeroExt(X) == B.zeroExt(X) => A == B
                                                                                                                                                                                A.signExt(X) == B.signExt(X) => A == B
                                                                                                                                                                                """
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.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 simp_cond_add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                            def simp_cond_add(expr_s, expr):
                                                                                                                                                                                """
                                                                                                                                                                                (a+b)?X:Y => (a == b)?Y:X
                                                                                                                                                                                (a^b)?X:Y => (a == b)?Y:X
                                                                                                                                                                                """
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.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 simp_cond_cc_flag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                            def simp_cond_cc_flag(expr_simp, expr):
                                                                                                                                                                                """
                                                                                                                                                                                ExprCond(CC_><(bit), X, Y) => ExprCond(bit, X, Y)
                                                                                                                                                                                ExprCond(CC_U>=(bit), X, Y) => ExprCond(bit, Y, X)
                                                                                                                                                                                """
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.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

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if op_b.is_op() and op_b.op in ["+", "^"]:
                                                                                                                                                                                    args = list(op_b.args)
                                                                                                                                                                                    if op_a in args:
                                                                                                                                                                                        args.remove(op_a)
                                                                                                                                                                                        if not args:
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 1 day to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1101..1111

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 131.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if op_a.is_op() and op_a.op in ["+", "^"]:
                                                                                                                                                                                    args = list(op_a.args)
                                                                                                                                                                                    if op_b in args:
                                                                                                                                                                                        args.remove(op_b)
                                                                                                                                                                                        if not args:
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 1 day to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1113..1123

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 131.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                            def simp_subwc_cf(_, expr):
                                                                                                                                                                                """SUBWC_CF(A, B, SUB_CF(C, D)) => SUB_CF({A, C}, {B, D})"""
                                                                                                                                                                                if not expr.is_op('FLAG_SUBWC_CF'):
                                                                                                                                                                                    return expr
                                                                                                                                                                                op3 = expr.args[2]
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 2 other locations - About 7 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1169..1180
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1183..1194

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 118.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                            def simp_subwc_of(_, expr):
                                                                                                                                                                                """SUBWC_OF(A, B, SUB_CF(C, D)) => SUB_OF({A, C}, {B, D})"""
                                                                                                                                                                                if not expr.is_op('FLAG_SUBWC_OF'):
                                                                                                                                                                                    return expr
                                                                                                                                                                                op3 = expr.args[2]
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 2 other locations - About 7 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1155..1166
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1183..1194

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 118.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                            def simp_sign_subwc_cf(_, expr):
                                                                                                                                                                                """SIGN_SUBWC(A, B, SUB_CF(C, D)) => SIGN_SUB({A, C}, {B, D})"""
                                                                                                                                                                                if not expr.is_op('FLAG_SIGN_SUBWC'):
                                                                                                                                                                                    return expr
                                                                                                                                                                                op3 = expr.args[2]
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 2 other locations - About 7 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1155..1166
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1169..1180

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 118.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        if op_name == '+' and args[j].is_op("-"):
                                                                                                                                                                                            if len(args[j].args) == 1 and args[i] == args[j].args[0]:
                                                                                                                                                                                                args[i] = ExprInt(0, args[i].size)
                                                                                                                                                                                                del args[j]
                                                                                                                                                                                                continue
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 7 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 203..207

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 114.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        if op_name == '+' and args[i].is_op("-"):
                                                                                                                                                                                            if len(args[i].args) == 1 and args[j] == args[i].args[0]:
                                                                                                                                                                                                args[i] = ExprInt(0, args[i].size)
                                                                                                                                                                                                del args[j]
                                                                                                                                                                                                continue
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 7 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 197..201

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 114.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                            def simp_double_zeroext(_, expr):
                                                                                                                                                                                """A.zeroExt(X).zeroExt(Y) => A.zeroExt(Y)"""
                                                                                                                                                                                if not (expr.is_op() and expr.op.startswith("zeroExt")):
                                                                                                                                                                                    return expr
                                                                                                                                                                                arg1 = expr.args[0]
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 6 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1206..1214

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 102.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                            def simp_double_signext(_, expr):
                                                                                                                                                                                """A.signExt(X).signExt(Y) => A.signExt(Y)"""
                                                                                                                                                                                if not (expr.is_op() and expr.op.startswith("signExt")):
                                                                                                                                                                                    return expr
                                                                                                                                                                                arg1 = expr.args[0]
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 6 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1196..1204

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 102.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                elif (expr.is_op("CC_S<=") and
                                                                                                                                                                                      len(expr.args) == 3 and
                                                                                                                                                                                      expr.args[0].is_op("FLAG_SIGN_SUB") and
                                                                                                                                                                                      expr.args[2].is_op("FLAG_EQ_CMP") and
                                                                                                                                                                                      expr.args[0].args == expr.args[2].args and
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 5 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 836..841

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 96.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        elif op_name == 'udiv':
                                                                                                                                                                                            if int(int2) == 0:
                                                                                                                                                                                                return expr
                                                                                                                                                                                            tmp1 = mod_size2uint[int1.size](int(int1))
                                                                                                                                                                                            tmp2 = mod_size2uint[int2.size](int(int2))
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 4 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 81..86

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 83.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        elif op_name == 'smod':
                                                                                                                                                                                            if int(int2) == 0:
                                                                                                                                                                                                return expr
                                                                                                                                                                                            tmp1 = mod_size2int[int1.size](int(int1))
                                                                                                                                                                                            tmp2 = mod_size2int[int2.size](int(int2))
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 4 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 93..98

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 83.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        elif op_name == 'umod':
                                                                                                                                                                                            if int(int2) == 0:
                                                                                                                                                                                                return expr
                                                                                                                                                                                            tmp1 = mod_size2uint[int1.size](int(int1))
                                                                                                                                                                                            tmp2 = mod_size2uint[int2.size](int(int2))
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 4 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 87..92

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 83.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        elif op_name == 'sdiv':
                                                                                                                                                                                            if int(int2) == 0:
                                                                                                                                                                                                return expr
                                                                                                                                                                                            tmp1 = mod_size2int[int1.size](int(int1))
                                                                                                                                                                                            tmp2 = mod_size2int[int2.size](int(int2))
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 4 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 99..104

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 83.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                for arg in arg1.args:
                                                                                                                                                                                    if arg.is_int():
                                                                                                                                                                                        continue
                                                                                                                                                                                    if (arg.is_op() and
                                                                                                                                                                                        arg.op.startswith("zeroExt")):
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1540..1548

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 64.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                for arg in cond.args:
                                                                                                                                                                                    if arg.is_int():
                                                                                                                                                                                        continue
                                                                                                                                                                                    if (arg.is_op() and
                                                                                                                                                                                        arg.op.startswith("zeroExt")):
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1335..1343

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 64.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                    for arg in expr.args:
                                                                                                                                                                                        if arg.is_cond():
                                                                                                                                                                                            args1.append(arg.src1)
                                                                                                                                                                                            args2.append(arg.src2)
                                                                                                                                                                                        else:
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 416..422

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 57.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                for arg in expr.args:
                                                                                                                                                                                    if arg.is_cond():
                                                                                                                                                                                        args1.append(arg.src1)
                                                                                                                                                                                        args2.append(arg.src2)
                                                                                                                                                                                    else:
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 617..623

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 57.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        if op_name == '|' and args[i] == args[j]:
                                                                                                                                                                                            del args[j]
                                                                                                                                                                                            continue
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 213..215

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 43.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        if op_name == '&' and args[i] == args[j]:
                                                                                                                                                                                            del args[j]
                                                                                                                                                                                            continue
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 209..211

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 43.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                elif (expr.is_op("CC_NE") and
                                                                                                                                                                                      test_cc_eq_args(
                                                                                                                                                                                          expr,
                                                                                                                                                                                          "FLAG_EQ_CMP"
                                                                                                                                                                                      )):
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 6 other locations - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 733..741
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 757..765
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 823..833
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 836..845
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 850..859
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 906..915

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                elif (expr.is_op("CC_S>=") and
                                                                                                                                                                                      test_cc_eq_args(
                                                                                                                                                                                          expr,
                                                                                                                                                                                          "FLAG_SIGN_SUB",
                                                                                                                                                                                          "FLAG_SUB_OF"
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 6 other locations - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 733..741
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 757..765
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 787..795
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 823..833
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 836..845
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 906..915

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                elif (expr.is_op("CC_U>") and
                                                                                                                                                                                      test_cc_eq_args(
                                                                                                                                                                                          expr,
                                                                                                                                                                                          "FLAG_SUB_CF",
                                                                                                                                                                                          "FLAG_EQ_CMP",
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 6 other locations - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 733..741
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 757..765
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 787..795
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 823..833
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 836..845
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 850..859

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                elif (expr.is_op("CC_POS") and
                                                                                                                                                                                      test_cc_eq_args(
                                                                                                                                                                                          expr,
                                                                                                                                                                                          "FLAG_SIGN_SUB"
                                                                                                                                                                                      )):
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 6 other locations - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 733..741
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 787..795
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 823..833
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 836..845
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 850..859
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 906..915

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if (expr.is_op("CC_U>=") and
                                                                                                                                                                                      test_cc_eq_args(
                                                                                                                                                                                          expr,
                                                                                                                                                                                          "FLAG_SUB_CF"
                                                                                                                                                                                      )):
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 6 other locations - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 757..765
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 787..795
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 823..833
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 836..845
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 850..859
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 906..915

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                elif (expr.is_op("CC_S>") and
                                                                                                                                                                                      test_cc_eq_args(
                                                                                                                                                                                          expr,
                                                                                                                                                                                          "FLAG_SIGN_SUB",
                                                                                                                                                                                          "FLAG_SUB_OF",
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 6 other locations - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 733..741
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 757..765
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 787..795
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 836..845
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 850..859
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 906..915

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                elif (expr.is_op("CC_S>") and
                                                                                                                                                                                      len(expr.args) == 3 and
                                                                                                                                                                                      expr.args[0].is_op("FLAG_SIGN_SUB") and
                                                                                                                                                                                      expr.args[2].is_op("FLAG_EQ_CMP") and
                                                                                                                                                                                      expr.args[0].args == expr.args[2].args and
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 6 other locations - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 733..741
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 757..765
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 787..795
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 823..833
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 850..859
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 906..915

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        if expr_s.expr_simp(src1.signExtend(arg1.size)) == arg1:
                                                                                                                                                                                            # Case: int, b.signext()
                                                                                                                                                                                            return ExprOp("smod", src1, src2).signExtend(expr.size)
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1840..1842

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                        if expr_s.expr_simp(src2.signExtend(arg2.size)) == arg2:
                                                                                                                                                                                            # Case: a.signext(), int
                                                                                                                                                                                            return ExprOp("smod", src1, src2).signExtend(expr.size)
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 1 hr to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1849..1851

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 41.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if not args_b:
                                                                                                                                                                                    return ExprOp(TOK_EQUAL, ExprOp(op, *args_a), ExprInt(0, args_a[0].size))
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 50 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1144..1145

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 36.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if not args_a:
                                                                                                                                                                                    return ExprOp(TOK_EQUAL, ExprOp(op, *args_b), ExprInt(0, args_b[0].size))
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 50 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1147..1148

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 36.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                    if (j >= 10):
                                                                                                                                                                                        carry = 1
                                                                                                                                                                                        j -= 10
                                                                                                                                                                                        j &= 0xF
                                                                                                                                                                                    else:
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 45 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1787..1792

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 35.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                    if (j >= 10):
                                                                                                                                                                                        carry = 1
                                                                                                                                                                                        j -= 10
                                                                                                                                                                                        j &= 0xF
                                                                                                                                                                                    else:
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 45 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1812..1817

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 35.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if op_name == '-' and len(args) > 1 and args[-1].is_int(0):
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 45 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 145..145

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 35.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if op_name == "*" and len(args) > 1 and args[-1].is_int(1):
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 45 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 140..140

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 35.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if not (expr.op.startswith("zeroExt") or expr.op.startswith("signExt")):
                                                                                                                                                                                    return expr
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 30 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1448..1449

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 32.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                         (arg1.is_op() and arg1.op.startswith("signExt") and
                                                                                                                                                                                           arg2.is_op() and arg2.op.startswith("signExt")))):
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 30 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1256..1257

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 32.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if not (expr.op.startswith("zeroExt") or expr.op.startswith("signExt")):
                                                                                                                                                                                    return expr
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 30 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1430..1431

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 32.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                if (not ((arg1.is_op() and arg1.op.startswith("zeroExt") and
                                                                                                                                                                                          arg2.is_op() and arg2.op.startswith("zeroExt")) or
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in miasm/expression/simplifications_common.py and 1 other location - About 30 mins to fix
                                                                                                                                                                            miasm/expression/simplifications_common.py on lines 1258..1259

                                                                                                                                                                            Duplicated Code

                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                            Tuning

                                                                                                                                                                            This issue has a mass of 32.

                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                            Refactorings

                                                                                                                                                                            Further Reading

                                                                                                                                                                            There are no issues that match your filters.

                                                                                                                                                                            Category
                                                                                                                                                                            Status