Showing 214 of 421 total issues

Avoid too many return statements within this function.
Open

        return self._device.active_bank
Severity: Major
Found in ducky/devices/svga.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return u8_t(now.day).value
    Severity: Major
    Found in ducky/devices/rtc.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 '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

      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 core has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def core(self, cid):
          """
          Find CPU core by its string id.
      
          :param string cid: id of searched CPU core, in the form `#<cpuid>:#<coreid>`.
      Severity: Minor
      Found in ducky/machine.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def __init__(self, core):
          super(DebuggingSet, self).__init__()
      
          self.core = core
          self.points = []
      Severity: Minor
      Found in ducky/debugging.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 resolve_symbols has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def resolve_symbols(info, f_out, f_ins):
        D = get_logger().debug
      
        D('Resolve symbols - compute their new addresses')
      
      
      Severity: Minor
      Found in ducky/tools/ld.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def create(machine, desc):
          machine.LOGGER.debug('InputStream.create: desc=%s', desc)
      
          if isfile(desc):
            return FileInputStream(machine, desc)
      Severity: Minor
      Found in ducky/streams.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 _write_payload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def _write_payload(self):
          assert self._payload is not None
      
          self.parent.seek(self.header.offset)
      
      
      Severity: Minor
      Found in ducky/mm/binary.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 show_cores has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def show_cores(logger, state):
        logger.info('=== Cores ===')
      
        def __reg(index):
          return UINT32_FMT(cs.registers[index])
      Severity: Minor
      Found in ducky/tools/coredump.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 setup_debugging has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def setup_debugging(self):
          self.DEBUG('%s.setup_debugging', self.__class__.__name__)
      
          for section in self.config.iter_breakpoints():
            _get, _getint, _getbool = self.config.create_getters(section)
      Severity: Minor
      Found in ducky/boot.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 alloc_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def alloc_page(self, base = None):
          """
          Allocate new anonymous page for usage. The first available index is used.
      
          :param int base: if set, start searching pages from this address.
      Severity: Minor
      Found in ducky/mm/__init__.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 write_u32 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def write_u32(self, offset, value):
          self.DEBUG('%s.write_u32: offset=%s, value=%s', self.__class__.__name__, UINT8_FMT(offset), UINT32_FMT(value))
      
          value &= 0xFFFFFFFF
          dev = self._device
      Severity: Minor
      Found in ducky/devices/storage.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

      Severity
      Category
      Status
      Source
      Language