cea-sec/miasm

View on GitHub
miasm/ir/ir.py

Summary

Maintainability
F
1 wk
Test Coverage

File ir.py has 843 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#-*- coding:utf-8 -*-

#
# Copyright (C) 2013 Fabrice Desclaux
#
Severity: Major
Found in miasm/ir/ir.py - About 2 days to fix

    AssignBlock has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class AssignBlock(object):
        """Represent parallel IR assignment, such as:
        EAX = EBX
        EBX = EAX
    
    
    Severity: Minor
    Found in miasm/ir/ir.py - About 3 hrs to fix

      Function set_empty_dst_to_next has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_empty_dst_to_next(self, block, ir_blocks):
              for index, irblock in enumerate(ir_blocks):
                  if irblock.dst is not None:
                      continue
                  next_loc_key = block.get_next()
      Severity: Minor
      Found in miasm/ir/ir.py - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _set(self, dst, src):
              """
              Special cases:
              * if dst is an ExprSlice, expand it to assign the full Expression
              * if dst already known, sources are merged
      Severity: Minor
      Found in miasm/ir/ir.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 cache_dst has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def cache_dst(self):
              final_dst = None
              final_linenb = None
              for linenb, assignblk in enumerate(self):
                  for dst, src in viewitems(assignblk):
      Severity: Minor
      Found in miasm/ir/ir.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 getby_offset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def getby_offset(self, offset):
              """
              Return the set of loc_keys of irblocks containing @offset
              @offset: address
              """
      Severity: Minor
      Found in miasm/ir/ir.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 dst_trackback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def dst_trackback(self, irb):
              """
              Naive backtracking of IRDst
              @irb: irbloc instance
              """
      Severity: Minor
      Found in miasm/ir/ir.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 node2lines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def node2lines(self, node):
              node_name = self.loc_db.pretty_str(node)
              yield self.DotCellDescription(
                  text="%s" % node_name,
                  attr={
      Severity: Minor
      Found in miasm/ir/ir.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 add_asmblock_to_ircfg has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_asmblock_to_ircfg(self, block, ircfg, gen_pc_updt=False):
              """
              Add a native block to the current IR
              @block: native assembly block
              @ircfg: IRCFG instance
      Severity: Minor
      Found in miasm/ir/ir.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, irdst, loc_db, blocks=None, *args, **kwargs):
      Severity: Minor
      Found in miasm/ir/ir.py - About 35 mins to fix

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

            def add_instr_to_current_state(self, instr, block, assignments, ir_blocks_all, gen_pc_updt):
        Severity: Minor
        Found in miasm/ir/ir.py - About 35 mins to fix

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

              def set_dst(self, value):
                  """Generate a new IRBlock with a dst (IRBlock) fixed to @value"""
                  irs = []
                  dst_found = False
                  for assignblk in self:
          Severity: Minor
          Found in miasm/ir/ir.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 _extract_dst has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def _extract_dst(self, todo, done):
                  """
                  Naive extraction of @todo destinations
                  WARNING: @todo and @done are modified
                  """
          Severity: Minor
          Found in miasm/ir/ir.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, irs=None, instr=None):
                  """Create a new AssignBlock
                  @irs: (optional) sequence of ExprAssign, or dictionary dst (Expr) -> src
                        (Expr)
                  @instr: (optional) associate an instruction with this AssignBlock
          Severity: Minor
          Found in miasm/ir/ir.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 __eq__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __eq__(self, other):
                  if self.__class__ is not other.__class__:
                      return False
                  if self.loc_key != other.loc_key:
                      return False
          Severity: Minor
          Found in miasm/ir/ir.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 True
          Severity: Major
          Found in miasm/ir/ir.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

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

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

              def _expr_loc_to_symb(expr, loc_db):
                  if not expr.is_loc():
                      return expr
                  if loc_db is None:
                      name = str(expr)
              Severity: Minor
              Found in miasm/ir/ir.py - About 25 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  def edge_attr(self, src, dst):
                      if src not in self._blocks or dst not in self._blocks:
                          return {}
                      src_irdst = self._blocks[src].dst
                      edge_color = "blue"
              Severity: Minor
              Found in miasm/ir/ir.py - About 25 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  def simplify(self, simplifier):
                      """
                      Simplify expressions in each irblocks
                      @simplifier: ExpressionSimplifier instance
                      """
              Severity: Minor
              Found in miasm/ir/ir.py - About 25 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

              def slice_rest(expr):
                  "Return the completion of the current slice"
                  size = expr.arg.size
                  if expr.start >= size or expr.stop > size:
                      raise ValueError('bad slice rest %s %s %s' %
              Severity: Major
              Found in miasm/ir/ir.py and 1 other location - About 1 day to fix
              miasm/expression/expression.py on lines 1401..1417

              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

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

                  def from_ExprCond(self, expr):
                      cond = self.str_protected_child(expr.cond, expr)
                      src1 = self.from_expr(expr.src1)
                      src2 = self.from_expr(expr.src2)
                      out = "%s?(%s,%s)" % (cond, src1, src2)
              Severity: Major
              Found in miasm/ir/ir.py and 1 other location - About 3 hrs to fix
              example/ida/utils.py on lines 131..136

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

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

              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

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

                  def str_protected_child(self, child, parent):
                      return ("(%s)" % (
                          self.from_expr(child)) if m2_expr.should_parenthesize_child(child, parent)
                              else self.from_expr(child)
              Severity: Major
              Found in miasm/ir/ir.py and 1 other location - About 1 hr to fix
              example/ida/utils.py on lines 88..91

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

              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

              class IntermediateRepresentation(Lifter):
                  """
                  DEPRECATED object
                  Use Lifter instead of IntermediateRepresentation
                  """
              Severity: Major
              Found in miasm/ir/ir.py and 1 other location - About 1 hr to fix
              miasm/ir/analysis.py on lines 111..119

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 41.

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

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

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

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

              Refactorings

              Further Reading

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

                      for assignblk in self:
                          new_assignblk = assignblk.simplify(simplifier)
                          if assignblk != new_assignblk:
                              modified = True
                          assignblks.append(new_assignblk)
              Severity: Major
              Found in miasm/ir/ir.py and 1 other location - About 1 hr to fix
              miasm/ir/ir.py on lines 753..757

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 41.

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

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

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

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

              Refactorings

              Further Reading

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

                          for assignblk in block:
                              new_assignblk = assignblk.simplify(simplifier)
                              if assignblk != new_assignblk:
                                  modified = True
                              assignblks.append(new_assignblk)
              Severity: Major
              Found in miasm/ir/ir.py and 1 other location - About 1 hr to fix
              miasm/ir/ir.py on lines 578..582

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 41.

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

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

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

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

              Refactorings

              Further Reading

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

                      if expr._op == '-':        # Unary minus
                          return '-' + self.str_protected_child(expr._args[0], expr)
              Severity: Minor
              Found in miasm/ir/ir.py and 1 other location - About 50 mins to fix
              example/ida/utils.py on lines 139..140

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 36.

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

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

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

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

              Refactorings

              Further Reading

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

                  def from_ExprId(self, expr):
                      out = str(expr)
                      out = '<font color="%s">%s</font>' % (utils.COLOR_ID, out)
                      return out
              Severity: Minor
              Found in miasm/ir/ir.py and 1 other location - About 45 mins to fix
              miasm/ir/ir.py on lines 70..73

              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 from_ExprInt(self, expr):
                      out = str(expr)
                      out = '<font color="%s">%s</font>' % (utils.COLOR_INT, out)
                      return out
              Severity: Minor
              Found in miasm/ir/ir.py and 1 other location - About 45 mins to fix
              miasm/ir/ir.py on lines 75..78

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 35.

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

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

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

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

              Refactorings

              Further Reading

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

                  def from_ExprAssign(self, expr):
                      return "%s = %s" % tuple(map(expr.from_expr, (expr.dst, expr.src)))
              Severity: Minor
              Found in miasm/ir/ir.py and 1 other location - About 40 mins to fix
              example/ida/utils.py on lines 150..151

              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