Maroc-OS/decompiler

View on GitHub

Showing 2,968 of 2,968 total issues

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

    if len(defn.uses) == 0:
      defn.parent_statement.expr.unlink()
      defn.parent_statement.remove()
Severity: Minor
Found in src/propagator.py and 1 other location - About 50 mins to fix
src/propagator.py on lines 64..66

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 5 locations. Consider refactoring.
Open

    if flags & SF:
      yield assign_t(self.sf.copy(), sign_t(self.eflags_expr.copy()))
Severity: Major
Found in src/ir/intel.py and 4 other locations - About 50 mins to fix
src/ir/intel.py on lines 213..214
src/ir/intel.py on lines 215..216
src/ir/intel.py on lines 217..218
src/ir/intel.py on lines 223..224

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 5 locations. Consider refactoring.
Open

    if flags & OF:
      yield assign_t(self.of.copy(), overflow_t(self.eflags_expr.copy()))
Severity: Major
Found in src/ir/intel.py and 4 other locations - About 50 mins to fix
src/ir/intel.py on lines 213..214
src/ir/intel.py on lines 215..216
src/ir/intel.py on lines 217..218
src/ir/intel.py on lines 221..222

Duplicated Code

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

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

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

Tuning

This issue has a mass of 36.

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

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

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

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

Refactorings

Further Reading

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

      branches = (self.function.blocks[stmt.true.value], self.function.blocks[stmt.false.value])
Severity: Minor
Found in src/filters/controlflow.py and 1 other location - About 50 mins to fix
src/filters/controlflow.py on lines 404..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 36.

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

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

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

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

Refactorings

Further Reading

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

    branches = (self.function.blocks[stmt.true.value], self.function.blocks[stmt.false.value])
Severity: Minor
Found in src/filters/controlflow.py and 1 other location - About 50 mins to fix
src/filters/controlflow.py on lines 319..319

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

    elif mnem == 'neg':

      op = self.get_operand_expression(ea, 0)

      expr = assign_t(op.copy(), neg_t(op))
Severity: Minor
Found in src/ir/intel.py and 1 other location - About 50 mins to fix
src/ir/intel.py on lines 310..315

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

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

  def reaches_to(self, block, end_block, visited):
    if block in visited:
      return False
    visited.append(block)
    to = block.jump_to_ea
Severity: Minor
Found in src/filters/controlflow.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 definition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def definition(self, defn):
    assert isinstance(defn, assignable_t) or defn is None, 'definition must be assignable'
    if self.__definition is not None:
      if defn is None:
        self.__definition.__uses.remove(self)
Severity: Minor
Found in src/expressions.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 parenthesize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def parenthesize(self, obj):
    """ parenthesize objects as needed. """

    if type(obj) not in (regloc_t, flagloc_t, value_t, var_t, stack_var_t, arg_t) or \
          (type(obj) in (regloc_t, flagloc_t) and obj.index is not None):
Severity: Minor
Found in src/output/c.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 iteroperands has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def iteroperands(self, depth_first=False, ltr=True):
    """ iterate over all operands, depth first, left to right """

    if not depth_first:
      yield self
Severity: Minor
Found in src/expressions.py - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Avoid deeply nested control flow statements.
Open

            if _block not in loop:
              loop.append(_block)
          added = True
Severity: Major
Found in src/filters/controlflow.py - About 45 mins to fix

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

      def get_call_expression(self, ea):
        """ get an expression representing a function call at this address. """
    
        insn = idautils.DecodeInstruction(ea)
    
    
    Severity: Minor
    Found in src/host/ida/dis/intel.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 statement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def statement(self, context, stmt):
        for expr in stmt.expressions:
          self.assign_definitions(context, expr)
    
        if type(stmt) == goto_t and stmt.is_known() and \
    Severity: Minor
    Found in src/ssa.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 flags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def flags(expr):
      """ transform flags operations into simpler expressions such as lower-than
          or greater-than.
    
      unsigned stuff:
    Severity: Minor
    Found in src/filters/simplify_expressions.py - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid deeply nested control flow statements.
    Open

                if ea_to not in self.func_items:
                  print '%x: jumped outside of function to %x' % (ea, ea_to, )
                else:
                  tonode = self.nodes[ea_to]
                  node.add_jump_to(tonode)
    Severity: Major
    Found in src/graph.py - About 45 mins to fix

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

        def find_condition(self):
          exit_block = list(set(self.start.jump_to).difference(self.blocks))
          if len(exit_block) == 1 and exit_block[0] in self.exits:
            self.condition_block = self.start
            self.exit_block = exit_block[0]
      Severity: Minor
      Found in src/filters/controlflow.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 prune has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def prune(self):
          while True:
            pruned = False
            for stmt in iterators.statement_iterator_t(self.function):
              if not self.is_prunable(stmt):
      Severity: Minor
      Found in src/pruner.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid deeply nested control flow statements.
      Open

                if isinstance(op, assignable_t):
                  op.unlink()
              expr.replace(newexpr)
      Severity: Major
      Found in src/filters/simplify_expressions.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if r in restored_grouped.keys():
                      restored_grouped[r].append(_def)
                    else:
                      restored_grouped[r] = [_def]
        
        
        Severity: Major
        Found in src/ssa.py - About 45 mins to fix

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

            def transform_ir(self):
              """ transform the program into the intermediate representation. """
          
              for node in self.iternodes():
          
          
          Severity: Minor
          Found in src/graph.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

          Severity
          Category
          Status
          Source
          Language