ducky/cpu/instructions.py

Summary

Maintainability
F
2 mos
Test Coverage

File instructions.py has 2413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import ctypes
import enum
import logging
import sys

Severity: Major
Found in ducky/cpu/instructions.py - About 6 days to fix

    Function jit has a Cognitive Complexity of 198 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        core.DEBUG('JIT: %s', inst)
    
        regset = core.registers
        ip = Registers.IP.value
    Severity: Minor
    Found in ducky/cpu/instructions.py - About 4 days to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function jit has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
        reg1 = inst.reg1
    
        if inst.immediate_flag == 1:
    Severity: Minor
    Found in ducky/cpu/instructions.py - About 2 days to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function jit has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
    
        if inst.immediate_flag == 0:
          reg1, reg2 = inst.reg1, inst.reg2
    Severity: Minor
    Found in ducky/cpu/instructions.py - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function jit has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        reg1, reg2 = inst.reg1, inst.reg2
        regset = core.registers
    
        if inst.opcode == DuckyOpcodes.STW:
    Severity: Minor
    Found in ducky/cpu/instructions.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function jit has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset, reg1, reg2 = core.registers, inst.reg1, inst.reg2
    
        if inst.opcode == DuckyOpcodes.LW:
          reader = core.MEM_IN32
    Severity: Minor
    Found in ducky/cpu/instructions.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function assemble_operands has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      def assemble_operands(cls, ctx, inst, operands):
        from ..asm.ast import RegisterOperand, ReferenceOperand
    
        op = operands[0]
    
    
    Severity: Minor
    Found in ducky/cpu/instructions.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 jit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
    
        if inst.immediate_flag == 1:
          reg = inst.reg1
    Severity: Minor
    Found in ducky/cpu/instructions.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 jit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
        err = DivideByZeroError(core = core)
    
        if inst.immediate_flag == 1:
    Severity: Minor
    Found in ducky/cpu/instructions.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 assemble_operands has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def assemble_operands(cls, ctx, inst, operands):
        from ..asm.ast import RegisterOperand, ReferenceOperand
    
        ctx.encode(inst, 'reg1', 5, operands[0].operand)
    
    
    Severity: Minor
    Found in ducky/cpu/instructions.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 execute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def execute(core, inst):
        regset = core.registers
        r = regset[inst.reg1]
        v = RI_VAL(core, inst, 'reg2')
    
    
    Severity: Minor
    Found in ducky/cpu/instructions.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 evaluate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def evaluate(core, inst):
        # genuine flags
        if inst.flag in _COND.GFLAGS and inst.value == getattr(core, _COND.FLAGS[inst.flag]):
          return True
    
    
    Severity: Minor
    Found in ducky/cpu/instructions.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 disassemble_mnemonic has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def disassemble_mnemonic(inst):
        if inst.flag in _COND.GFLAGS:
          return 'b%s%s' % ('n' if inst.value == 0 else '', _COND.MNEMONICS[inst.flag])
    
        else:
    Severity: Minor
    Found in ducky/cpu/instructions.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 assemble_operands has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def assemble_operands(cls, ctx, inst, operands):
        ctx.encode(inst, 'reg1', 5, operands[0].operand)
    
        set_condition = partial(_COND.set_condition, ctx, inst)
    
    
    Severity: Minor
    Found in ducky/cpu/instructions.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 jit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
    
        if inst.immediate_flag == 1:
          reg = inst.reg1
    Severity: Minor
    Found in ducky/cpu/instructions.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 jit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
    
        if inst.immediate_flag == 1:
          reg = inst.reg1
    Severity: Minor
    Found in ducky/cpu/instructions.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def execute(core, inst):
        r = core.registers[inst.reg1]
        v = RI_VAL(core, inst, 'reg2')
    
        if inst.opcode == DuckyOpcodes.AND:
    Severity: Minor
    Found in ducky/cpu/instructions.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 evaluate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def evaluate(core, x, y, signed = True):
        """
        Compare two numbers, and update relevant flags. Signed comparison is used unless ``signed`` is ``False``.
        All arithmetic flags are set to zero before the relevant ones are set.
    
    
    Severity: Minor
    Found in ducky/cpu/instructions.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 jit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
    
        if inst.immediate_flag == 0:
          reg1, reg2 = inst.reg1, inst.reg2
    Severity: Minor
    Found in ducky/cpu/instructions.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 jit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
        err = DivideByZeroError(core = core)
    
        if inst.immediate_flag == 1:
    Severity: Minor
    Found in ducky/cpu/instructions.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 jit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def jit(core, inst):
        regset = core.registers
        err = DivideByZeroError(core = core)
    
        if inst.immediate_flag == 1:
    Severity: Minor
    Found in ducky/cpu/instructions.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 encode has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def encode(self, inst, field, size, value, raise_on_large_value = False):
    Severity: Minor
    Found in ducky/cpu/instructions.py - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in ducky/cpu/instructions.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return __branch_ge
        Severity: Major
        Found in ducky/cpu/instructions.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return __branch_s
          Severity: Major
          Found in ducky/cpu/instructions.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return __branch_no
            Severity: Major
            Found in ducky/cpu/instructions.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return __branch_z
              Severity: Major
              Found in ducky/cpu/instructions.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return __branch_ns
                Severity: Major
                Found in ducky/cpu/instructions.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return __branch_nz
                  Severity: Major
                  Found in ducky/cpu/instructions.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return __branch_o
                    Severity: Major
                    Found in ducky/cpu/instructions.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return __branch_o
                      Severity: Major
                      Found in ducky/cpu/instructions.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return __branch_nz
                        Severity: Major
                        Found in ducky/cpu/instructions.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                    return __branch_l
                          Severity: Major
                          Found in ducky/cpu/instructions.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                      return __branch_le
                            Severity: Major
                            Found in ducky/cpu/instructions.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                        return __branch_no
                              Severity: Major
                              Found in ducky/cpu/instructions.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                          return __branch_l
                                Severity: Major
                                Found in ducky/cpu/instructions.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                            return __branch_ns
                                  Severity: Major
                                  Found in ducky/cpu/instructions.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                              return __branch_ge
                                    Severity: Major
                                    Found in ducky/cpu/instructions.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                return __branch_z
                                      Severity: Major
                                      Found in ducky/cpu/instructions.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                  return __branch_le
                                        Severity: Major
                                        Found in ducky/cpu/instructions.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                    return __branch_s
                                          Severity: Major
                                          Found in ducky/cpu/instructions.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                return False
                                            Severity: Major
                                            Found in ducky/cpu/instructions.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                        return __jit_selle
                                              Severity: Major
                                              Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                          return __jit_ls
                                                Severity: Major
                                                Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                          return __jit_ls
                                                  Severity: Major
                                                  Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                        return None
                                                    Severity: Major
                                                    Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                return __jit_sts
                                                      Severity: Major
                                                      Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                  return __jit_selg
                                                        Severity: Major
                                                        Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                    return __jit_stb
                                                          Severity: Major
                                                          Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                      return __jit_selge
                                                            Severity: Major
                                                            Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                        return __jit_selg
                                                              Severity: Major
                                                              Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                          return __branch_g
                                                                Severity: Major
                                                                Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                            return __jit_selle
                                                                  Severity: Major
                                                                  Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                              return __jit_lb
                                                                    Severity: Major
                                                                    Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                                return __jit_sell
                                                                      Severity: Major
                                                                      Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                return __jit_stb
                                                                        Severity: Major
                                                                        Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                    return __jit_stb
                                                                          Severity: Major
                                                                          Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                return None
                                                                            Severity: Major
                                                                            Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                        return __branch_g
                                                                              Severity: Major
                                                                              Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                          return __jit_sell
                                                                                Severity: Major
                                                                                Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                      return None
                                                                                  Severity: Major
                                                                                  Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                              return __jit_lb
                                                                                    Severity: Major
                                                                                    Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                              return __jit_lb
                                                                                      Severity: Major
                                                                                      Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                return __jit_sts
                                                                                        Severity: Major
                                                                                        Found in ducky/cpu/instructions.py - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                    return __jit_selge
                                                                                          Severity: Major
                                                                                          Found in ducky/cpu/instructions.py - About 30 mins to fix

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

                                                                                              def disassemble_mnemonic(inst):
                                                                                                if inst.flag in _COND.GFLAGS:
                                                                                                  return 'set%s%s' % ('n' if inst.value == 0 else '', _COND.MNEMONICS[inst.flag])
                                                                                            
                                                                                                else:
                                                                                            Severity: Minor
                                                                                            Found in ducky/cpu/instructions.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 sign_extend_immediate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                              def sign_extend_immediate(logger, inst, sign_mask, ext_mask):
                                                                                                logger.debug('sign_extend_immediate: inst=%s, sign_mask=%s, ext_mask=%s', inst, UINT32_FMT(sign_mask), UINT32_FMT(ext_mask))
                                                                                            
                                                                                                if __debug__:
                                                                                                  u = u32_t(ext_mask | inst.immediate) if inst.immediate & sign_mask else u32_t(inst.immediate)
                                                                                            Severity: Minor
                                                                                            Found in ducky/cpu/instructions.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 disassemble_mnemonic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                              def disassemble_mnemonic(inst):
                                                                                                if inst.flag in _COND.GFLAGS:
                                                                                                  return 'sel%s%s' % ('n' if inst.value == 0 else '', _COND.MNEMONICS[inst.flag])
                                                                                            
                                                                                                else:
                                                                                            Severity: Minor
                                                                                            Found in ducky/cpu/instructions.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

                                                                                                elif inst.flag == 4:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __jit_selge():
                                                                                                        if core.arith_sign is True and core.arith_equal is False:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 4 days to fix
                                                                                            ducky/cpu/instructions.py on lines 1989..2054

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

                                                                                            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 inst.flag == 5:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __jit_selle():
                                                                                                        if core.arith_sign is False and core.arith_equal is False:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 4 days to fix
                                                                                            ducky/cpu/instructions.py on lines 1922..1987

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

                                                                                            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 inst.flag == 4:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __branch_ge():
                                                                                                        if core.arith_sign is False or core.arith_equal is True:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 2 days to fix
                                                                                            ducky/cpu/instructions.py on lines 1661..1690

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

                                                                                            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 inst.flag == 5:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __branch_le():
                                                                                                        if core.arith_sign is True or core.arith_equal is True:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 2 days to fix
                                                                                            ducky/cpu/instructions.py on lines 1630..1659

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

                                                                                            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

                                                                                                if cls is BE:
                                                                                                  set_condition('arith_equal', True)
                                                                                            
                                                                                                elif cls is BNE:
                                                                                                  set_condition('arith_equal', False)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 2 days to fix
                                                                                            ducky/cpu/instructions.py on lines 1705..1739
                                                                                            ducky/cpu/instructions.py on lines 1784..1818

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

                                                                                            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

                                                                                                if cls is SETE:
                                                                                                  set_condition('arith_equal', True)
                                                                                            
                                                                                                elif cls is SETNE:
                                                                                                  set_condition('arith_equal', False)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 2 days to fix
                                                                                            ducky/cpu/instructions.py on lines 1427..1461
                                                                                            ducky/cpu/instructions.py on lines 1784..1818

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

                                                                                            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

                                                                                                if cls is SELE:
                                                                                                  set_condition('arith_equal', True)
                                                                                            
                                                                                                elif cls is SELNE:
                                                                                                  set_condition('arith_equal', False)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 2 days to fix
                                                                                            ducky/cpu/instructions.py on lines 1427..1461
                                                                                            ducky/cpu/instructions.py on lines 1705..1739

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

                                                                                            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 inst.opcode == DuckyOpcodes.LB:
                                                                                                  reader = core.MEM_IN8
                                                                                            
                                                                                                  if inst.immediate_flag == 1:
                                                                                                    offset = inst.sign_extend_immediate(core.LOGGER, inst)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 2 days to fix
                                                                                            ducky/cpu/instructions.py on lines 2811..2842

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

                                                                                            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 inst.opcode == DuckyOpcodes.LS:
                                                                                                  reader = core.MEM_IN16
                                                                                            
                                                                                                  if inst.immediate_flag == 1:
                                                                                                    offset = inst.sign_extend_immediate(core.LOGGER, inst)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 2 days to fix
                                                                                            ducky/cpu/instructions.py on lines 2844..2875

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

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

                                                                                                if inst.flag == 0:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __branch_ne():
                                                                                                        if core.arith_equal is False:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 day to fix
                                                                                            ducky/cpu/instructions.py on lines 1537..1566
                                                                                            ducky/cpu/instructions.py on lines 1568..1597
                                                                                            ducky/cpu/instructions.py on lines 1599..1628

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

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

                                                                                                elif inst.flag == 1:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __branch_nz():
                                                                                                        if core.arith_zero is False:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 day to fix
                                                                                            ducky/cpu/instructions.py on lines 1506..1535
                                                                                            ducky/cpu/instructions.py on lines 1568..1597
                                                                                            ducky/cpu/instructions.py on lines 1599..1628

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

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

                                                                                                elif inst.flag == 2:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __branch_no():
                                                                                                        if core.arith_overflow is False:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 day to fix
                                                                                            ducky/cpu/instructions.py on lines 1506..1535
                                                                                            ducky/cpu/instructions.py on lines 1537..1566
                                                                                            ducky/cpu/instructions.py on lines 1599..1628

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

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

                                                                                                elif inst.flag == 3:
                                                                                                  if inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __branch_ns():
                                                                                                        if core.arith_sign is False:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 day to fix
                                                                                            ducky/cpu/instructions.py on lines 1506..1535
                                                                                            ducky/cpu/instructions.py on lines 1537..1566
                                                                                            ducky/cpu/instructions.py on lines 1568..1597

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

                                                                                            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 inst.value == 0:
                                                                                                    if inst.immediate_flag == 0:
                                                                                                      def __jit_selne():
                                                                                                        if core.arith_equal is True:
                                                                                                          regset[reg1] = v = regset[reg2]
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 1 day to fix
                                                                                            ducky/cpu/instructions.py on lines 1856..1920

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

                                                                                            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 inst.opcode == DuckyOpcodes.STW:
                                                                                                  writer = core.MEM_OUT32
                                                                                            
                                                                                                  if inst.immediate_flag == 1:
                                                                                                    offset = inst.sign_extend_immediate(core.LOGGER, inst)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 1 day to fix
                                                                                            ducky/cpu/instructions.py on lines 2951..2973

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

                                                                                            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 inst.opcode == DuckyOpcodes.STS:
                                                                                                  writer = core.MEM_OUT16
                                                                                            
                                                                                                  if inst.immediate_flag == 1:
                                                                                                    offset = inst.sign_extend_immediate(core.LOGGER, inst)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 1 day to fix
                                                                                            ducky/cpu/instructions.py on lines 2927..2949

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

                                                                                            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

                                                                                              @staticmethod
                                                                                              def assemble_operands(ctx, inst, operands):
                                                                                                ctx.encode(inst, 'reg1', 5, operands[0].operand)
                                                                                            
                                                                                                base, offset = operands[1].operand
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 6 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2883..2893

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

                                                                                            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

                                                                                              @staticmethod
                                                                                              def assemble_operands(ctx, inst, operands):
                                                                                                ctx.encode(inst, 'reg2', 5, operands[1].operand)
                                                                                            
                                                                                                base, offset = operands[0].operand
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 6 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2734..2744

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

                                                                                            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

                                                                                              @staticmethod
                                                                                              def disassemble_mnemonic(inst):
                                                                                                if inst.flag in _COND.GFLAGS:
                                                                                                  return 'set%s%s' % ('n' if inst.value == 0 else '', _COND.MNEMONICS[inst.flag])
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 5 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 1827..1833

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

                                                                                            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

                                                                                              @staticmethod
                                                                                              def disassemble_mnemonic(inst):
                                                                                                if inst.flag in _COND.GFLAGS:
                                                                                                  return 'sel%s%s' % ('n' if inst.value == 0 else '', _COND.MNEMONICS[inst.flag])
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 5 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 1745..1751

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

                                                                                            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

                                                                                              @staticmethod
                                                                                              def disassemble_operands(logger, inst):
                                                                                                if inst.immediate_flag == 0:
                                                                                                  return [REGISTER_NAMES[inst.reg1], REGISTER_NAMES[inst.reg2]]
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 5 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 405..410

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 93.

                                                                                            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

                                                                                              @staticmethod
                                                                                              def disassemble_operands(logger, inst):
                                                                                                if inst.immediate_flag == 0:
                                                                                                  return [REGISTER_NAMES[inst.reg1], REGISTER_NAMES[inst.reg2]]
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 5 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 1820..1825

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

                                                                                            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 STI(Descriptor):
                                                                                              mnemonic = 'sti'
                                                                                              opcode = DuckyOpcodes.STI
                                                                                              encoding = EncodingI
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 5 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 789..809

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

                                                                                            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 CLI(Descriptor):
                                                                                              mnemonic = 'cli'
                                                                                              opcode = DuckyOpcodes.CLI
                                                                                              encoding = EncodingI
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 5 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 811..831

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

                                                                                            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

                                                                                              @staticmethod
                                                                                              def disassemble_operands(logger, inst):
                                                                                                if inst.immediate_flag == 0:
                                                                                                  return [REGISTER_NAMES[inst.reg]]
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 4 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 1469..1474

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

                                                                                            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

                                                                                              @staticmethod
                                                                                              def disassemble_operands(logger, inst):
                                                                                                if inst.immediate_flag == 0:
                                                                                                  return [REGISTER_NAMES[inst.reg]]
                                                                                            
                                                                                            
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 4 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 674..679

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

                                                                                            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

                                                                                                if isinstance(op, RegisterOperand):
                                                                                                  ctx.encode(inst, 'reg', 5, op.operand)
                                                                                            
                                                                                                else:
                                                                                                  ctx.encode(inst, 'immediate_flag', 1, 1)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 393..403
                                                                                            ducky/cpu/instructions.py on lines 1771..1780

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

                                                                                            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

                                                                                                if isinstance(op, RegisterOperand):
                                                                                                  ctx.encode(inst, 'reg2', 5, op.operand)
                                                                                            
                                                                                                else:
                                                                                                  ctx.encode(inst, 'immediate_flag', 1, 1)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 339..349
                                                                                            ducky/cpu/instructions.py on lines 393..403

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

                                                                                            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

                                                                                                if isinstance(op, RegisterOperand):
                                                                                                  ctx.encode(inst, 'reg2', 5, op.operand)
                                                                                            
                                                                                                else:
                                                                                                  ctx.encode(inst, 'immediate_flag', 1, 1)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 339..349
                                                                                            ducky/cpu/instructions.py on lines 1771..1780

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

                                                                                            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 i == 32:
                                                                                                      v = regset[reg1] << i
                                                                                                      regset[reg1] = 0
                                                                                                      core.arith_zero = True
                                                                                                      core.arith_overflow = (v & ~0xFFFFFFFF) != 0
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2499..2504

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

                                                                                            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 __jit_shiftl():
                                                                                                      v = regset[reg] << i
                                                                                                      regset[reg] = 0
                                                                                                      core.arith_zero = True
                                                                                                      core.arith_overflow = (v & ~0xFFFFFFFF) != 0
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2530..2535

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

                                                                                            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 __jit_lw():
                                                                                                        regset[reg1] = v = reader(regset[reg2])
                                                                                                        core.arith_zero = v == 0
                                                                                                        core.arith_overflow = False
                                                                                                        core.arith_sign = (v & 0x80000000) != 0
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2803..2807

                                                                                            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

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

                                                                                                    def __jit_lw():
                                                                                                      regset[reg1] = v = reader(regset[reg2])
                                                                                                      core.arith_zero = v == 0
                                                                                                      core.arith_overflow = False
                                                                                                      core.arith_sign = (v & 0x80000000) != 0
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2785..2789

                                                                                            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

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

                                                                                                    if xs:
                                                                                                      if ys:
                                                                                                        # x < 0, y < 0
                                                                                                        core.arith_sign = abs(x) < abs(y)
                                                                                                      else:
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2166..2175

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

                                                                                            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 inst.immediate_flag == 1:
                                                                                                  operands.append('%s[%s]' % (REGISTER_NAMES[inst.reg2], inst.sign_extend_immediate(logger, inst)))
                                                                                            
                                                                                                else:
                                                                                                  operands.append(REGISTER_NAMES[inst.reg2])
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2899..2903

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

                                                                                            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 xs:
                                                                                                      if ys:
                                                                                                        core.arith_sign = abs(x) < abs(y)
                                                                                                      else:
                                                                                                        core.arith_sign = True
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2128..2141

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

                                                                                            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 inst.immediate_flag == 1:
                                                                                                  operands.append('%s[%s]' % (REGISTER_NAMES[inst.reg1], inst.sign_extend_immediate(logger, inst)))
                                                                                            
                                                                                                else:
                                                                                                  operands.append(REGISTER_NAMES[inst.reg1])
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 3 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2750..2754

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

                                                                                            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

                                                                                                  if i == 0:
                                                                                                    def __jit_shiftl():
                                                                                                      v = regset[reg]
                                                                                                      core.arith_zero = v == 0
                                                                                                      core.arith_overflow = False
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 2 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2558..2565
                                                                                            ducky/cpu/instructions.py on lines 2621..2628

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

                                                                                            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

                                                                                                  if i == 0:
                                                                                                    def __jit_shiftr():
                                                                                                      v = regset[reg]
                                                                                                      core.arith_zero = v == 0
                                                                                                      core.arith_overflow = False
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 2 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2489..2496
                                                                                            ducky/cpu/instructions.py on lines 2621..2628

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

                                                                                            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

                                                                                                  if i == 0:
                                                                                                    def __jit_shrs():
                                                                                                      v = regset[reg]
                                                                                                      core.arith_zero = v == 0
                                                                                                      core.arith_overflow = False
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 2 hrs to fix
                                                                                            ducky/cpu/instructions.py on lines 2489..2496
                                                                                            ducky/cpu/instructions.py on lines 2558..2565

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

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

                                                                                              @staticmethod
                                                                                              def assemble_operands(ctx, inst, operands):
                                                                                                ctx.encode(inst, 'reg1', 5, operands[0].operand)
                                                                                                ctx.encode(inst, 'reg2', 5, operands[1].operand)
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 2 other locations - About 2 hrs to fix
                                                                                            ducky/cpu/coprocessor/math_copro.py on lines 411..414
                                                                                            ducky/cpu/coprocessor/math_copro.py on lines 465..468

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 50.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                                return '<%s: %s>' % (inst.__class__.__name__, ', '.join(['%s=%s' % (k, v) for k, v in iteritems(d)]))
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 1 hr to fix
                                                                                            ducky/asm/__init__.py on lines 125..125

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

                                                                                            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

                                                                                                        v = (x >> i) | (((1 << i) - 1) << (32 - i))
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 2373..2376

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 41.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                                  if r & 0x80000000 == 0:
                                                                                                    value = r >> shift
                                                                                                  else:
                                                                                                    value = (r >> shift) | (((1 << shift) - 1) << (32 - shift))
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 2670..2670

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

                                                                                                    if x == y:
                                                                                                      core.arith_equal = True
                                                                                                      core.arith_zero = x == 0
                                                                                                      core.arith_sign = False
                                                                                                      return
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 2116..2120
                                                                                            ducky/cpu/instructions.py on lines 2155..2159
                                                                                            ducky/cpu/instructions.py on lines 2202..2206

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                                    if x == y:
                                                                                                      core.arith_equal = True
                                                                                                      core.arith_zero = x == 0
                                                                                                      core.arith_sign = False
                                                                                                      return
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 2155..2159
                                                                                            ducky/cpu/instructions.py on lines 2202..2206
                                                                                            ducky/cpu/instructions.py on lines 2223..2227

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                                    if x == y:
                                                                                                      core.arith_equal = True
                                                                                                      core.arith_zero = x == 0
                                                                                                      core.arith_sign = False
                                                                                                      return
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 2116..2120
                                                                                            ducky/cpu/instructions.py on lines 2155..2159
                                                                                            ducky/cpu/instructions.py on lines 2223..2227

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                              @staticmethod
                                                                                              def fill_reloc_slot(inst, slot):
                                                                                                logging.getLogger().debug('fill_reloc_slot: inst=%s, slot=%s', inst, slot)
                                                                                            
                                                                                                slot.patch_offset = 17
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 98..103
                                                                                            ducky/cpu/instructions.py on lines 124..129
                                                                                            ducky/cpu/instructions.py on lines 147..152

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                              @staticmethod
                                                                                              def fill_reloc_slot(inst, slot):
                                                                                                logging.getLogger().debug('fill_reloc_slot: inst=%s, slot=%s', inst, slot)
                                                                                            
                                                                                                slot.patch_offset = 21
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 73..78
                                                                                            ducky/cpu/instructions.py on lines 98..103
                                                                                            ducky/cpu/instructions.py on lines 147..152

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                              @staticmethod
                                                                                              def fill_reloc_slot(inst, slot):
                                                                                                logging.getLogger().debug('fill_reloc_slot: inst=%s, slot=%s', inst, slot)
                                                                                            
                                                                                                slot.patch_offset = 12
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 73..78
                                                                                            ducky/cpu/instructions.py on lines 98..103
                                                                                            ducky/cpu/instructions.py on lines 124..129

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                                    if x == y:
                                                                                                      core.arith_equal = True
                                                                                                      core.arith_zero = x == 0
                                                                                                      core.arith_sign = False
                                                                                                      return
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 2116..2120
                                                                                            ducky/cpu/instructions.py on lines 2202..2206
                                                                                            ducky/cpu/instructions.py on lines 2223..2227

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                              @staticmethod
                                                                                              def fill_reloc_slot(inst, slot):
                                                                                                logging.getLogger().debug('fill_reloc_slot: inst=%s, slot=%s', inst, slot)
                                                                                            
                                                                                                slot.patch_offset = 16
                                                                                            Severity: Major
                                                                                            Found in ducky/cpu/instructions.py and 3 other locations - About 1 hr to fix
                                                                                            ducky/cpu/instructions.py on lines 73..78
                                                                                            ducky/cpu/instructions.py on lines 124..129
                                                                                            ducky/cpu/instructions.py on lines 147..152

                                                                                            Duplicated Code

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

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

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

                                                                                            Tuning

                                                                                            This issue has a mass of 38.

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

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

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

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

                                                                                            Refactorings

                                                                                            Further Reading

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

                                                                                                core.registers[inst.reg1] = (core.registers[inst.reg1] - 1) % 4294967296
                                                                                            Severity: Minor
                                                                                            Found in ducky/cpu/instructions.py and 1 other location - About 55 mins to fix
                                                                                            ducky/cpu/__init__.py on lines 761..761

                                                                                            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

                                                                                            There are no issues that match your filters.

                                                                                            Category
                                                                                            Status