cea-sec/miasm

View on GitHub
miasm/arch/mep/arch.py

Summary

Maintainability
F
1 wk
Test Coverage

File arch.py has 1056 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Toshiba MeP-c4 - miasm architecture definition
# Guillaume Valadon <guillaume@valadon.net>

from builtins import range
from miasm.core.cpu import *
Severity: Major
Found in miasm/arch/mep/arch.py - About 2 days to fix

    Consider simplifying this complex logical expression.
    Open

            if self.name == "SSARB":
                # The first operand is displayed in decimal, not in hex
                o += " %d" % int(self.args[0])
                o += self.arg2str(self.args[1])
    
    
    Severity: Critical
    Found in miasm/arch/mep/arch.py - About 2 hrs to fix

      Function __str__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              """Return the mnemonic as a string.
      
              Note:
                  - it is not mandatory as the instruction class already implement
      Severity: Minor
      Found in miasm/arch/mep/arch.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 encode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def encode(self):
              """Modify the encoded value. One part is stored in this object, and
              the other one in a parent immediate.
              """
      
      
      Severity: Minor
      Found in miasm/arch/mep/arch.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 asm_ast_to_expr has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def asm_ast_to_expr(self, arg, loc_db):
              """Convert AST to expressions
      
                 Note: - code inspired by miasm/arch/mips32/arch.py"""
      
      
      Severity: Minor
      Found in miasm/arch/mep/arch.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 arg2str has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def arg2str(expr, pos=None, loc_db=None):
              """Convert mnemonics arguments into readable strings according to the
              MeP-c4 architecture manual and their internal types
      
              Notes:
      Severity: Minor
      Found in miasm/arch/mep/arch.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 value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def value(self, mode):
              """Adjust the assembled instruction based on the endianness
      
                 Note: code inspired by miasm/arch/mips32/arch.py
              """
      Severity: Minor
      Found in miasm/arch/mep/arch.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

      Consider simplifying this complex logical expression.
      Open

              if isinstance(expr, ExprId) or isinstance(expr, ExprInt) or isinstance(expr, ExprLoc):
                  return color_expr_html(expr, loc_db)
      
              elif isinstance(expr, ExprMem) and (isinstance(expr.ptr, ExprId) or isinstance(expr.ptr, ExprInt)):
                  return "(%s)" % color_expr_html(expr.ptr, loc_db)
      Severity: Major
      Found in miasm/arch/mep/arch.py - About 40 mins to fix

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

        def ExprInt2SignedString(expr, pos_fmt="%d", neg_fmt="%d", size=None, offset=0):
        Severity: Minor
        Found in miasm/arch/mep/arch.py - About 35 mins to fix

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

              def gen_modes(cls, subcls, name, bases, dct, fields):
          Severity: Minor
          Found in miasm/arch/mep/arch.py - About 35 mins to fix

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

                def arg2html(expr, pos=None, loc_db=None):
                    """Convert mnemonics arguments into readable html strings according to the
                    MeP-c4 architecture manual and their internal types
            
                    Notes:
            Severity: Minor
            Found in miasm/arch/mep/arch.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/arch/mep/arch.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return "0x%X(%s)" % (int(expr.ptr.args[1]), expr.ptr.args[0])
              Severity: Major
              Found in miasm/arch/mep/arch.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return ExprMem(addr, 32)
                Severity: Major
                Found in miasm/arch/mep/arch.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return None
                  Severity: Major
                  Found in miasm/arch/mep/arch.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

                                        return ExprInt(arg.value, 32)
                            Severity: Major
                            Found in miasm/arch/mep/arch.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

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

                                  def ExprInt2SignedString(expr, pos_fmt="%d", neg_fmt="%d", size=None, offset=0):
                                      """Return the signed string corresponding to an ExprInt
                                  
                                         Note: this function is only useful to mimic objdump output"""
                                  
                                  
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.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 endian_offset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def endian_offset(cls, attrib, offset):
                                          """Adjust the byte offset according to the endianness"""
                                  
                                          if attrib == "l":  # Little Endian
                                              if offset % 2:
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.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 3 locations. Consider refactoring.
                                  Open

                                  class mep_imm16_signed(mep_int32_noarg):
                                      """Toshiba MeP-c4 signed 16 bits immediate."""
                                      parser = base_expr
                                      intsize = 16
                                      intmask = (1 << intsize) - 1
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 2 other locations - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 894..899
                                  miasm/arch/mep/arch.py on lines 902..907

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

                                  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

                                  class mep_imm6(mep_int32_noarg):
                                      """Toshiba MeP-c4 signed 6 bits immediate."""
                                      parser = base_expr
                                      intsize = 6
                                      intmask = (1 << intsize) - 1
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 2 other locations - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 902..907
                                  miasm/arch/mep/arch.py on lines 918..923

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

                                  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

                                  class mep_imm8(mep_int32_noarg):
                                      """Toshiba MeP-c4 signed 8 bits immediate."""
                                      parser = base_expr
                                      intsize = 8
                                      intmask = (1 << intsize) - 1
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 2 other locations - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 894..899
                                  miasm/arch/mep/arch.py on lines 918..923

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

                                  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 getattr(self.parent, "disp7_align2", False):
                                  
                                              # Get the integer and check the upper bound
                                              v = int(self.expr.ptr.args[1].arg)
                                              if v > 0x80:
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 763..773

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 57.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                          if getattr(self.parent, "imm7_align4", False):
                                  
                                              # Get the integer and check the upper bound
                                              v = int(self.expr.ptr.args[1].arg)
                                              if v > 0x80:
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 787..797

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 57.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                          elif self.name == "SLL" and isinstance(self.args[1], ExprInt):  # Major Opcodes #6
                                              # The second operand is displayed in hex, not in decimal
                                              o += " " + self.arg2str(self.args[0])
                                              o += ", 0x%X" % int(self.args[1])
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 145..148

                                  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

                                          elif self.name in ["MOV", "ADD"] and isinstance(self.args[1], ExprInt):
                                              # The second operand is displayed in decimal, not in hex
                                              o += " " + self.arg2str(self.args[0])
                                              o += ", %s" % ExprInt2SignedString(self.args[1])
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 178..181

                                  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 decode(self, v):
                                          """Perform sign extension
                                          """
                                  
                                          mep_target24.decode(self, v)
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 1186..1195

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

                                  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 mep_disp12_align2_signed(mep_disp12_align2):
                                  
                                      def decode(self, v):
                                          """Perform sign extension.
                                          """
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 2 hrs to fix
                                  miasm/arch/mep/arch.py on lines 966..974

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

                                  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

                                              return "%s(%s)" % (
                                                  color_expr_html(expr.ptr.args[1], loc_db),
                                                  color_expr_html(expr.ptr.args[0], loc_db)
                                  Severity: Major
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 1 hr to fix
                                  miasm/arch/msp430/arch.py on lines 148..150

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

                                  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

                                              o += "(%s)" % self.arg2str(self.args[1].ptr.args[0])
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 55 mins to fix
                                  miasm/arch/mep/arch.py on lines 176..176

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

                                  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

                                              o += "(%s)" % self.arg2str(self.args[1].ptr.args[0])
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 55 mins to fix
                                  miasm/arch/mep/arch.py on lines 169..169

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

                                  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

                                          target24 = (v << 8) + ((self.parent.imm7.value & 0x7F) << 1)
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 45 mins to fix
                                  miasm/arch/mep/arch.py on lines 1252..1252

                                  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

                                          abs24 = (v << 8) + ((self.parent.imm6.value & 0x3F) << 2)
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 45 mins to fix
                                  miasm/arch/mep/arch.py on lines 939..939

                                  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 type(parse_results[0]) == int and isinstance(parse_results[2], AstId):
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 35 mins to fix
                                  miasm/arch/mep/arch.py on lines 556..556

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

                                  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 type(parse_results[0]) == AstInt and isinstance(parse_results[2], AstId):
                                  Severity: Minor
                                  Found in miasm/arch/mep/arch.py and 1 other location - About 35 mins to fix
                                  miasm/arch/mep/arch.py on lines 559..559

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

                                  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