cea-sec/miasm

View on GitHub
miasm/expression/expression.py

Summary

Maintainability
F
3 wks
Test Coverage

File expression.py has 1643 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#
# Copyright (C) 2011 EADS France, Fabrice Desclaux <fabrice.desclaux@eads.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Severity: Major
Found in miasm/expression/expression.py - About 4 days to fix

    Function match_expr has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

    def match_expr(expr, pattern, tks, result=None):
        """Try to match the @pattern expression with the pattern @expr with @tks jokers.
        Result is output dictionary with matching joker values.
        @expr : Expr pattern
        @pattern : Targeted Expr to match
    Severity: Minor
    Found in miasm/expression/expression.py - About 1 day 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

    Expr has 54 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Expr(object):
    
        "Parent class for Miasm Expressions"
    
        __slots__ = ["_hash", "_repr", "_size"]
    Severity: Major
    Found in miasm/expression/expression.py - About 7 hrs to fix

      Function compare_exprs has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

      def compare_exprs(expr1, expr2):
          """Compare 2 expressions for canonization
          @expr1: Expr
          @expr2: Expr
          0  => ==
      Severity: Minor
      Found in miasm/expression/expression.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 visit has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          def visit(self, expr, *args, **kwargs):
              if expr.is_int() or expr.is_id() or expr.is_loc():
                  pass
              elif expr.is_assign():
                  ret = self.visit(expr.dst, *args, **kwargs)
      Severity: Minor
      Found in miasm/expression/expression.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 __init__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, op, *args):
              """Create an ExprOp
              @op: str, operation
              @*args: Expr, operand list
              """
      Severity: Minor
      Found in miasm/expression/expression.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

      Consider simplifying this complex logical expression.
      Open

          if (isinstance(child, ExprId) or isinstance(child, ExprInt) or
              isinstance(child, ExprCompose) or isinstance(child, ExprMem) or
              isinstance(child, ExprSlice)):
              return False
          elif isinstance(child, ExprOp) and not child.is_infix():
      Severity: Critical
      Found in miasm/expression/expression.py - About 1 hr to fix

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

            def edge2str(self, nfrom, nto):
                if isinstance(nfrom, ExprCompose):
                    for i in nfrom.args:
                        if i[0] == nto:
                            return "[%s, %s]" % (i[1], i[2])
        Severity: Minor
        Found in miasm/expression/expression.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 visit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def visit(self, expr, *args, **kwargs):
                if expr.is_int() or expr.is_id() or expr.is_loc():
                    ret = expr
                elif expr.is_assign():
                    dst = self.visit(expr.dst, *args, **kwargs)
        Severity: Minor
        Found in miasm/expression/expression.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 should_parenthesize_child has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def should_parenthesize_child(child, parent):
            if (isinstance(child, ExprId) or isinstance(child, ExprInt) or
                isinstance(child, ExprCompose) or isinstance(child, ExprMem) or
                isinstance(child, ExprSlice)):
                return False
        Severity: Minor
        Found in miasm/expression/expression.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 visit_inner has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def visit_inner(self, expr, *args, **kwargs):
                self.get_r_leaves(expr)
                if expr.is_mem() and not self.mem_read:
                    # Don't visit memory sons
                    return None
        Severity: Minor
        Found in miasm/expression/expression.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

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

            def node2str(self, node):
                if isinstance(node, ExprOp):
                    return node.op
                elif isinstance(node, ExprId):
                    return node.name
        Severity: Minor
        Found in miasm/expression/expression.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 canonize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def canonize(self, expr):
                if not expr.is_op():
                    return expr
                if not expr.is_associative():
                    return expr
        Severity: Minor
        Found in miasm/expression/expression.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 ret
        Severity: Major
        Found in miasm/expression/expression.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return cmp_elts(expr1.size, expr2.size)
          Severity: Major
          Found in miasm/expression/expression.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return "[%d:%d]" % (node.start, node.stop)
            Severity: Major
            Found in miasm/expression/expression.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

                        return match_expr(expr.ptr, pattern.ptr, tks, result)
                Severity: Major
                Found in miasm/expression/expression.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

                                return cmp_elts(expr1.op, expr2.op)
                    Severity: Major
                    Found in miasm/expression/expression.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

                                      return "? %d" % node.size
                          Severity: Major
                          Found in miasm/expression/expression.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

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

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

                                        return repr(self) == repr(other)
                                Severity: Major
                                Found in miasm/expression/expression.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

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

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

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

                                          Avoid too many return statements within this function.
                                          Open

                                                  return cmp_elts(expr1.size, expr2.size)
                                          Severity: Major
                                          Found in miasm/expression/expression.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

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

                                                Avoid too many return statements within this function.
                                                Open

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

                                                  Avoid too many return statements within this function.
                                                  Open

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

                                                    Avoid too many return statements within this function.
                                                    Open

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

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return cmp_elts(expr1.size, expr2.size)
                                                      Severity: Major
                                                      Found in miasm/expression/expression.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

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

                                                          Avoid too many return statements within this function.
                                                          Open

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

                                                            Avoid too many return statements within this function.
                                                            Open

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

                                                              Avoid too many return statements within this function.
                                                              Open

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

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                        return match_expr(expr.arg, pattern.arg, tks, result)
                                                                Severity: Major
                                                                Found in miasm/expression/expression.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

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

                                                                    Avoid too many return statements within this function.
                                                                    Open

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

                                                                      Avoid too many return statements within this function.
                                                                      Open

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

                                                                        Avoid too many return statements within this function.
                                                                        Open

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

                                                                          Avoid too many return statements within this function.
                                                                          Open

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

                                                                            Avoid too many return statements within this function.
                                                                            Open

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

                                                                              Avoid too many return statements within this function.
                                                                              Open

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

                                                                                Avoid too many return statements within this function.
                                                                                Open

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

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                          return compare_expr_list(expr1.args, expr2.args)
                                                                                  Severity: Major
                                                                                  Found in miasm/expression/expression.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

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

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

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

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                return compare_expr_list_compose(expr1.args, expr2.args)
                                                                                        Severity: Major
                                                                                        Found in miasm/expression/expression.py - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                  return str(node)
                                                                                          Severity: Major
                                                                                          Found in miasm/expression/expression.py - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

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

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

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

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

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

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

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

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

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

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

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

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                    return "{ %d }" % node.size
                                                                                                        Severity: Major
                                                                                                        Found in miasm/expression/expression.py - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

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

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

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

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

                                                                                                                  def slice_rest(self):
                                                                                                                      "Return the completion of the current slice"
                                                                                                                      size = self._arg.size
                                                                                                                      if self._start >= size or self._stop > size:
                                                                                                                          raise ValueError('bad slice rest %s %s %s' %
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 day to fix
                                                                                                              miasm/ir/ir.py on lines 152..168

                                                                                                              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 146.

                                                                                                              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 expr_is_infinite(expr):
                                                                                                                  """Return 1 or 0 on 1 bit if expr represent an infinite value according to
                                                                                                                  IEEE754
                                                                                                                  """
                                                                                                                  info = size_to_IEEE754_info[expr.size]
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 7 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 2083..2093

                                                                                                              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 expr_is_NaN(expr):
                                                                                                                  """Return 1 or 0 on 1 bit if expr represent a NaN value according to IEEE754
                                                                                                                  """
                                                                                                                  info = size_to_IEEE754_info[expr.size]
                                                                                                                  exponent = expr[info["significand"]: info["significand"] + info["exponent"]]
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 7 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 2096..2107

                                                                                                              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 compare_expr_list_compose(l1_e, l2_e):
                                                                                                                  # Sort by list elements in incremental order, then by list size
                                                                                                                  for i in range(min(len(l1_e), len(l2_e))):
                                                                                                                      ret = compare_exprs(l1_e[i], l2_e[i])
                                                                                                                      if ret:
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 4 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 1535..1541

                                                                                                              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 75.

                                                                                                              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 compare_expr_list(l1_e, l2_e):
                                                                                                                  # Sort by list elements in incremental order, then by list size
                                                                                                                  for i in range(min(len(l1_e), len(l2_e))):
                                                                                                                      ret = compare_exprs(l1_e[i], l2_e[i])
                                                                                                                      if ret:
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 4 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 1526..1532

                                                                                                              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 75.

                                                                                                              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

                                                                                                                  def visit(self, expr, *args, **kwargs):
                                                                                                                      if expr in self.cache:
                                                                                                                          return self.cache[expr]
                                                                                                                      ret = self.visit_inner(expr, *args, **kwargs)
                                                                                                                      self.cache[expr] = ret
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 374..379

                                                                                                              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 61.

                                                                                                              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

                                                                                                                  def visit(self, expr, *args, **kwargs):
                                                                                                                      if expr in self.cache:
                                                                                                                          return self.cache[expr]
                                                                                                                      ret = self.visit_inner(expr, *args, **kwargs)
                                                                                                                      self.cache[expr] = ret
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 399..404

                                                                                                              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 61.

                                                                                                              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 cls1 == ExprSlice:
                                                                                                                      ret = compare_exprs(expr1.arg, expr2.arg)
                                                                                                                      if ret:
                                                                                                                          return ret
                                                                                                                      ret = cmp_elts(expr1.start, expr2.start)
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 1579..1587

                                                                                                              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 60.

                                                                                                              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 cls2 == ExprCond:
                                                                                                                      ret = compare_exprs(expr1.cond, expr2.cond)
                                                                                                                      if ret:
                                                                                                                          return ret
                                                                                                                      ret = compare_exprs(expr1.src1, expr2.src1)
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 1597..1605

                                                                                                              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 60.

                                                                                                              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 __init__(self, mem_read=False, cst_read=False):
                                                                                                                      super(ExprGetR, self).__init__(lambda x:None)
                                                                                                                      self.mem_read = mem_read
                                                                                                                      self.cst_read = cst_read
                                                                                                                      self.elements = set()
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/analysis/depgraph.py on lines 458..463

                                                                                                              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 53.

                                                                                                              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 canonize_to_exprloc(locdb, expr):
                                                                                                                  """
                                                                                                                  If expr is ExprInt, return ExprLoc with corresponding loc_key
                                                                                                                  Else, return expr
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/core/locationdb.py on lines 399..410

                                                                                                              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 51.

                                                                                                              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 signExtend(self, size):
                                                                                                                      """Sign extend to size
                                                                                                                      @size: int
                                                                                                                      """
                                                                                                                      assert self.size <= size
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 633..640

                                                                                                              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 50.

                                                                                                              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 zeroExtend(self, size):
                                                                                                                      """Zero extend to size
                                                                                                                      @size: int
                                                                                                                      """
                                                                                                                      assert self.size <= size
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 2 hrs to fix
                                                                                                              miasm/expression/expression.py on lines 642..649

                                                                                                              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 50.

                                                                                                              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 dst.size != src.size:
                                                                                                                          raise ValueError(
                                                                                                                              "sanitycheck: ExprAssign args must have same size! %s" %
                                                                                                                              ([(str(arg), arg.size) for arg in [dst, src]]))
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/ir/ir.py on lines 218..221

                                                                                                              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 47.

                                                                                                              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 __new__(cls, ptr, size=None):
                                                                                                                      if size is None:
                                                                                                                          warnings.warn('DEPRECATION WARNING: size is a mandatory argument: use ExprMem(ptr, SIZE)')
                                                                                                                          size = 32
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 846..850

                                                                                                              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 47.

                                                                                                              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 __new__(cls, name, size=None):
                                                                                                                      if size is None:
                                                                                                                          warnings.warn('DEPRECATION WARNING: size is a mandatory argument: use ExprId(name, SIZE)')
                                                                                                                          size = 32
                                                                                                                      return Expr.get_object(cls, (name, size))
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1149..1154

                                                                                                              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 47.

                                                                                                              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

                                                                                                                  cf = (((op1 ^ op2) ^ res) ^ ((op1 ^ res) & (op1 ^ op2))).msb()
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/arch/ppc/sem.py on lines 728..729

                                                                                                              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 45.

                                                                                                              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 graph_recursive(self, graph):
                                                                                                                      graph.add_node(self)
                                                                                                                      for arg in self.args:
                                                                                                                          arg.graph_recursive(graph)
                                                                                                                          graph.add_uniq_edge(self, arg)
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1340..1344

                                                                                                              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

                                                                                                                  def graph_recursive(self, graph):
                                                                                                                      graph.add_node(self)
                                                                                                                      for arg in self._args:
                                                                                                                          arg.graph_recursive(graph)
                                                                                                                          graph.add_uniq_edge(self, arg)
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1486..1490

                                                                                                              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

                                                                                                                  def graph_recursive(self, graph):
                                                                                                                      graph.add_node(self)
                                                                                                                      self._ptr.graph_recursive(graph)
                                                                                                                      graph.add_uniq_edge(self, self._ptr)
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1419..1422

                                                                                                              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 39.

                                                                                                              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 graph_recursive(self, graph):
                                                                                                                      graph.add_node(self)
                                                                                                                      self._arg.graph_recursive(graph)
                                                                                                                      graph.add_uniq_edge(self, self._arg)
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1181..1184

                                                                                                              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 39.

                                                                                                              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 get_expr_ids(expr):
                                                                                                                  """Retrieve ExprId in @expr
                                                                                                                  @expr: Expr"""
                                                                                                                  ids = set()
                                                                                                                  expr.visit(lambda x: get_expr_ids_visit(x, ids))
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1684..1689

                                                                                                              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 39.

                                                                                                              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 get_expr_locs(expr):
                                                                                                                  """Retrieve ExprLoc in @expr
                                                                                                                  @expr: Expr"""
                                                                                                                  locs = set()
                                                                                                                  expr.visit(lambda x: get_expr_locs_visit(x, locs))
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1676..1681

                                                                                                              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 39.

                                                                                                              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

                                                                                                                  def depth(self):
                                                                                                                      depth = [arg.depth() for arg in self._args]
                                                                                                                      return max(depth) + 1
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1482..1484

                                                                                                              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 38.

                                                                                                              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

                                                                                                                  def depth(self):
                                                                                                                      depth = [arg.depth() for arg in self._args]
                                                                                                                      return max(depth) + 1
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 1336..1338

                                                                                                              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 38.

                                                                                                              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 is_int(self, value=None):
                                                                                                                      if value is not None and self._arg != value:
                                                                                                                          return False
                                                                                                                      return True
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 2 other locations - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 873..876
                                                                                                              miasm/expression/expression.py on lines 925..928

                                                                                                              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 38.

                                                                                                              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 is_loc(self, loc_key=None):
                                                                                                                      if loc_key is not None and self._loc_key != loc_key:
                                                                                                                          return False
                                                                                                                      return True
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 2 other locations - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 810..813
                                                                                                              miasm/expression/expression.py on lines 873..876

                                                                                                              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 38.

                                                                                                              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 is_id(self, name=None):
                                                                                                                      if name is not None and self._name != name:
                                                                                                                          return False
                                                                                                                      return True
                                                                                                              Severity: Major
                                                                                                              Found in miasm/expression/expression.py and 2 other locations - About 1 hr to fix
                                                                                                              miasm/expression/expression.py on lines 810..813
                                                                                                              miasm/expression/expression.py on lines 925..928

                                                                                                              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 38.

                                                                                                              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 __init__(self, callback):
                                                                                                                      super(ExprVisitorCallbackTopToBottom, self).__init__()
                                                                                                                      self.cache = dict()
                                                                                                                      self.callback = callback
                                                                                                              Severity: Minor
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 45 mins to fix
                                                                                                              miasm/expression/expression.py on lines 394..397

                                                                                                              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

                                                                                                                  def __init__(self, callback):
                                                                                                                      super(ExprVisitorCallbackBottomToTop, self).__init__()
                                                                                                                      self.cache = dict()
                                                                                                                      self.callback = callback
                                                                                                              Severity: Minor
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 45 mins to fix
                                                                                                              miasm/expression/expression.py on lines 369..372

                                                                                                              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

                                                                                                                  elif cls1 == ExprMem:
                                                                                                                      ret = compare_exprs(expr1.ptr, expr2.ptr)
                                                                                                                      if ret:
                                                                                                                          return ret
                                                                                                                      return cmp_elts(expr1.size, expr2.size)
                                                                                                              Severity: Minor
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 40 mins to fix
                                                                                                              miasm/expression/expression.py on lines 1570..1574

                                                                                                              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 34.

                                                                                                              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 __hash__(self):
                                                                                                                      if self._hash is None:
                                                                                                                          self._hash = self._exprhash()
                                                                                                                      return self._hash
                                                                                                              Severity: Minor
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 40 mins to fix
                                                                                                              miasm/expression/expression.py on lines 533..536

                                                                                                              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 34.

                                                                                                              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 __repr__(self):
                                                                                                                      if self._repr is None:
                                                                                                                          self._repr = self._exprrepr()
                                                                                                                      return self._repr
                                                                                                              Severity: Minor
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 40 mins to fix
                                                                                                              miasm/expression/expression.py on lines 538..541

                                                                                                              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 34.

                                                                                                              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 cls1 == ExprLoc:
                                                                                                                      ret = cmp_elts(expr1.loc_key, expr2.loc_key)
                                                                                                                      if ret:
                                                                                                                          return ret
                                                                                                                      return cmp_elts(expr1.size, expr2.size)
                                                                                                              Severity: Minor
                                                                                                              Found in miasm/expression/expression.py and 1 other location - About 40 mins to fix
                                                                                                              miasm/expression/expression.py on lines 1588..1592

                                                                                                              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 34.

                                                                                                              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