peter50216/pwntools-ruby

View on GitHub

Showing 12 of 12 total issues

Method mov has a Cognitive Complexity of 39 (exceeds 10 allowed). Consider refactoring.
Open

          def mov(dst, src, stack_allowed: true)
            raise ArgumentError, "#{dst} is not a register" unless register?(dst)

            dst = get_register(dst)
            if register?(src)
Severity: Minor
Found in lib/pwnlib/shellcraft/generators/amd64/common/mov.rb - 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

Method hexdump_iter has a Cognitive Complexity of 35 (exceeds 10 allowed). Consider refactoring.
Open

      def hexdump_iter(io, width: 16, skip: true, offset: 0, style: {}, highlight: '')
        Enumerator.new do |y|
          style = DEFAULT_STYLE.merge(style)
          highlight.bytes.each { |b| style[b] = HIGHLIGHT_STYLE }
          (0..255).each do |b|
Severity: Minor
Found in lib/pwnlib/util/hexdump.rb - About 4 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

Method mov has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring.
Open

          def mov(dst, src, stack_allowed: true)
            raise ArgumentError, "#{dst} is not a register" unless register?(dst)

            dst = get_register(dst)
            raise ArgumentError, "cannot use #{dst} on i386" if dst.size > 32 || dst.is64bit
Severity: Minor
Found in lib/pwnlib/shellcraft/generators/i386/common/mov.rb - About 4 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

Method pack has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring.
Open

      def pack(number, bits: nil, endian: nil, signed: nil)
        if bits == 'all'
          bits = nil
          is_all = true
        else
Severity: Minor
Found in lib/pwnlib/util/packing.rb - About 4 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

Method bits has a Cognitive Complexity of 26 (exceeds 10 allowed). Consider refactoring.
Open

      def bits(s, endian: 'big', zero: 0, one: 1)
        context.local(endian: endian) do
          is_little = context.endian == 'little'
          case s
          when String
Severity: Minor
Found in lib/pwnlib/util/fiddling.rb - 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

Method recvuntil has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
Open

      def recvuntil(delims, drop: false, timeout: nil)
        delims = Array(delims)
        max_len = delims.map(&:size).max
        @timer.countdown(timeout) do
          data = Buffer.new
Severity: Minor
Found in lib/pwnlib/tubes/tube.rb - 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

Method regsort has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring.
Open

    def regsort(in_out, all_regs, randomize: nil)
      # randomize = context.randomize if randomize.nil?

      # TODO(david942j): stringify_keys
      in_out = in_out.transform_keys(&:to_s)
Severity: Minor
Found in lib/pwnlib/reg_sort.rb - 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

Method setregs has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

          def setregs(reg_context, stack_allowed: true)
            abi = ::Pwnlib::ABI::ABI.default
            reg_context = reg_context.reject { |_, v| v.nil? }
            # convert all registers to string
            reg_context = reg_context.map do |k, v|
Severity: Minor
Found in lib/pwnlib/shellcraft/generators/x86/common/setregs.rb - 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

Method pushstr has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

          def pushstr(str, append_null: true)
            # This will not affect callee's +str+.
            str += "\x00" if append_null && !str.end_with?("\x00")
            return if str.empty?

Severity: Minor
Found in lib/pwnlib/shellcraft/generators/amd64/common/pushstr.rb - 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

Method load_symbols has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

      def load_symbols
        @symbols = OpenStruct.new
        @elf_file.each_sections do |section|
          next unless section.respond_to?(:symbols)

Severity: Minor
Found in lib/pwnlib/elf/elf.rb - About 35 mins to fix

Cognitive Complexity

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

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

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

Further reading

Method pushstr has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

          def pushstr(str, append_null: true)
            # This will not affect callee's +str+.
            str += "\x00" if append_null && !str.end_with?("\x00")
            return if str.empty?

Severity: Minor
Found in lib/pwnlib/shellcraft/generators/i386/common/pushstr.rb - 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

Method recvpred has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

      def recvpred(timeout: nil)
        raise ArgumentError, 'Need a block for recvpred' unless block_given?

        @timer.countdown(timeout) do
          data = +''
Severity: Minor
Found in lib/pwnlib/tubes/tube.rb - 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