ronin-rb/ronin-support

View on GitHub

Showing 197 of 197 total issues

Method cyan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def cyan(string=nil)
          if string
            if $stdout.tty? then "#{CYAN}#{string}#{RESET_COLOR}"
            else                 string
            end
Severity: Minor
Found in lib/ronin/support/cli/ansi.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 unpack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def unpack(data)
          if @pack_string
            values = data.unpack(@pack_string)

            @types.map do |type|
Severity: Minor
Found in lib/ronin/support/binary/template.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 up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.up(n,separator=File::SEPARATOR)
        case n
        when Integer
          if n == 0
            separator
Severity: Minor
Found in lib/ronin/support/path.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.parse(string)
          if string.include?('<') && string.end_with?('>')
            # Name <local-part@domain.com>
            if (match = string.match(/^([^<]+)\s+<([^>]+)>$/))
              name    = match[1]
Severity: Minor
Found in lib/ronin/support/network/email_address.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 unescape has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.unescape(data)
          unescaped = String.new(encoding: Encoding::UTF_8)
          scanner   = StringScanner.new(data)

          until scanner.eos?
Severity: Minor
Found in lib/ronin/support/encoding/xml.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 initialize_od has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def initialize_od(type: :uint16_le,
                            base: nil,
                            address_base: nil,
                            named_chars: nil)
            @format = :od
Severity: Minor
Found in lib/ronin/support/binary/unhexdump/parser.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 bold has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def bold(string=nil)
          if string
            if $stdout.tty? then "#{BOLD_ON}#{string}#{BOLD_OFF}"
            else                 string
            end
Severity: Minor
Found in lib/ronin/support/cli/ansi.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 white has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def white(string=nil)
          if string
            if $stdout.tty? then "#{WHITE}#{string}#{RESET_COLOR}"
            else                 string
            end
Severity: Minor
Found in lib/ronin/support/cli/ansi.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 callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def callback(event,client_connection,server_connection=nil,data=nil)
          action = catch(:action) do
            @callbacks[event].each do |block|
              case block.arity
              when 1
Severity: Minor
Found in lib/ronin/support/network/proxy.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 black has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def black(string=nil)
          if string
            if $stdout.tty? then "#{BLACK}#{string}#{RESET_COLOR}"
            else                 string
            end
Severity: Minor
Found in lib/ronin/support/cli/ansi.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(fields, **kwargs)
          initialize_type_system(**kwargs)

          @fields = []
          @types  = []
Severity: Minor
Found in lib/ronin/support/binary/template.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 each_suffix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def each_suffix(type: nil)
          return enum_for(__method__, type: type) unless block_given?

          PublicSuffix.list.each do |suffix|
            unless suffix.wildcard?
Severity: Minor
Found in lib/ronin/support/network/host.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 encode_byte has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.encode_byte(byte)
          if byte >= 0x00 && byte <= 0xff
            "\\x%.2x" % byte
          elsif byte >= 0x100 && byte <= 0xffff
            "\\u%.4x" % byte
Severity: Minor
Found in lib/ronin/support/encoding/c.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 unpack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def unpack(data)
            if @pack_string
              super(data)
            else
              hash = {}
Severity: Minor
Found in lib/ronin/support/binary/ctypes/struct_type.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 query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.query(ip)
          ip = IPAddr.new(ip) unless ip.kind_of?(IPAddr)

          if ip.ipv6?
            zone   = 'nmap6.asn.cymru.com'
Severity: Minor
Found in lib/ronin/support/network/asn.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 encode_byte has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.encode_byte(byte)
          if byte >= 0x00 && byte <= 0xff
            "\\x%.2X" % byte
          elsif byte >= 0x100 && byte <= 0xffff
            "\\u%.4X" % byte
Severity: Minor
Found in lib/ronin/support/encoding/ruby.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 red has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def red(string=nil)
          if string
            if $stdout.tty? then "#{RED}#{string}#{RESET_COLOR}"
            else                 string
            end
Severity: Minor
Found in lib/ronin/support/cli/ansi.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 unescape has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.unescape(data)
          char = if    (data[0] == "'" && data[-1] == "'") then "'"
                 elsif (data[0] == '"' && data[-1] == '"') then '"'
                 elsif (data[0] == '`' && data[-1] == '`') then '`'
                 else
Severity: Minor
Found in lib/ronin/support/encoding/sql.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 pack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def pack(hash)
            if @pack_string
              super(hash)
            else
              buffer = String.new("\0" * @size, encoding: Encoding::ASCII_8BIT)
Severity: Minor
Found in lib/ronin/support/binary/ctypes/struct_type.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 range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def self.range(first,last)
            first_ip = case first
                       when IPAddr then first
                       else             IPAddr.new(first)
                       end
Severity: Minor
Found in lib/ronin/support/network/ip_range/cidr.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