ronin-rb/ronin-support

View on GitHub

Showing 110 of 197 total issues

Method escape_byte has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def self.escape_byte(byte)
          if byte >= 0x00 && byte <= 0xff
            if    byte == 0x22
              "\\\""
            elsif byte == 0x5d
Severity: Minor
Found in lib/ronin/support/encoding/hex.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 get_string has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def get_string(offset,length=nil)
          if (offset < 0) || (offset >= size)
            raise(IndexError,"offset #{offset} is out of bounds: 0...#{size - 1}")
          elsif (length && (offset + length) > size)
            raise(IndexError,"offset #{offset} or length #{length} is out of bounds: 0...#{size - 1}")
Severity: Minor
Found in lib/ronin/support/binary/buffer.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 ip has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

          def ip(ip)
            address = ip.to_s
            ip      = IPAddr.new(ip) unless ip.kind_of?(IPAddr)

            prefixes = if ip.ipv6? then @ipv6_prefixes
Severity: Minor
Found in lib/ronin/support/network/asn/list.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 pop3_connect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def pop3_connect(host, port: DEFAULT_PORT,
                                 ssl:  nil,
                                 user: ,
                                 password: )
            host = DNS::IDN.to_ascii(host)
Severity: Minor
Found in lib/ronin/support/network/pop3/mixin.rb - About 1 hr to fix

    Method to_s has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def to_s
                message = []
    
                if @from
                  message << "From: #{@from}"
    Severity: Minor
    Found in lib/ronin/support/network/smtp/email.rb - About 1 hr to fix

      Method parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def self.parse(string)
                  kwargs = {}
                  params = {}
      
                  string.split(/;\s+/) do |field|
      Severity: Minor
      Found in lib/ronin/support/network/http/set_cookie.rb - About 1 hr to fix

        Method connect_uri has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def self.connect_uri(url, ssl:      nil,
                                          user:     nil,
                                          password: nil,
                                          **kwargs, &block)
                  case url
        Severity: Minor
        Found in lib/ronin/support/network/http.rb - About 1 hr to fix

          Method each_unique_substring has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def each_unique_substring(min=1,&block)
              return enum_for(__method__,min) unless block
          
              unique_strings = {}
          
          
          Severity: Minor
          Found in lib/ronin/support/core_ext/string.rb - 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

          Method stream has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                  def stream(io, block_size: 16384, output: nil)
                    unless block_given?
                      output ||= String.new(encoding: Encoding::ASCII_8BIT)
                    end
          
          
          Severity: Minor
          Found in lib/ronin/support/crypto/cipher.rb - 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

          Method parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                    def self.parse(string)
                      kwargs = {}
                      params = {}
          
                      string.split(/;\s+/) do |field|
          Severity: Minor
          Found in lib/ronin/support/network/http/set_cookie.rb - 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

          Method padding has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.padding(new_padding=nil)
                    unless new_padding.nil?
                      @padding = new_padding
                    else
                      if @padding.nil?
          Severity: Minor
          Found in lib/ronin/support/binary/struct.rb - 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

          Method parse_line has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                    def parse_line(line)
                      if @type.kind_of?(CTypes::CharType)
                        # because od/hexdump print the ' ' char as white space,
                        # we need special parsing logic here.
                        if (start_index = line.index(' '))
          Severity: Minor
          Found in lib/ronin/support/binary/unhexdump/parser.rb - 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

          Method unescape has a Cognitive Complexity of 9 (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/c.rb - 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

          Method poll has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                    def poll
                      sockets = [@socket] + client_connections + server_connections
          
                      readable, _writtable, errors = IO.select(sockets,nil,sockets)
          
          
          Severity: Minor
          Found in lib/ronin/support/network/tcp/proxy.rb - 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

          Method parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def self.parse(path=PATH)
                      return enum_for(__method__,path) unless block_given?
          
                      type = nil
          
          
          Severity: Minor
          Found in lib/ronin/support/network/public_suffix/list.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def self.parse(path=PATH)
                      return enum_for(__method__,path) unless block_given?
          
                      io = if File.extname(path) == '.gz' then Zlib::GzipReader.open(path)
                           else                                File.new(path)
          Severity: Minor
          Found in lib/ronin/support/network/asn/list.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def initialize(string, offset: , length: )
                    if length == Float::INFINITY
                      length = string.bytesize - offset
                    end
          
          
          Severity: Minor
          Found in lib/ronin/support/binary/byte_slice.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 telnet_connect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def telnet_connect(host, # connection options
                                             proxy:     Telnet.proxy,
                                             port:      Telnet::DEFAULT_PORT,
                                             binmode:   false,
                                             wait_time: 0,
          Severity: Minor
          Found in lib/ronin/support/network/telnet/mixin.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 encode_bytes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def encode_bytes(include: nil, exclude: nil)
              included  = (Chars::CharSet.new(*include) if include)
              excluded  = (Chars::CharSet.new(*exclude) if exclude)
              formatted = String.new(encoding: ::Encoding::UTF_8)
          
          
          Severity: Minor
          Found in lib/ronin/support/encoding/core_ext/string.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 escape_byte has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def self.escape_byte(byte,**kwargs)
                      if (byte == 42) || (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122))
                        byte.chr
                      else
                        encode_byte(byte,**kwargs)
          Severity: Minor
          Found in lib/ronin/support/encoding/uri.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

          Severity
          Category
          Status
          Source
          Language