ronin-rb/ronin-support

View on GitHub

Showing 110 of 197 total issues

Method context has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def self.context(version:   nil,
                         verify:    :none,
                         key:       nil,
                         key_file:  nil,
                         cert:      nil,
Severity: Minor
Found in lib/ronin/support/network/ssl.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

Class Struct has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Struct < Memory

        # The type system used by the struct.
        #
        # @return [CTypes::StructType]
Severity: Minor
Found in lib/ronin/support/binary/struct.rb - About 2 hrs to fix

    Method build has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

              def self.build(method,path, # query string keyword arguments
                                          query:        nil,
                                          query_params: nil,
                                          # Basic-Auth keyword arguments
                                          user:     nil,
    Severity: Minor
    Found in lib/ronin/support/network/http/request.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

    Consider simplifying this complex logical expression.
    Open

                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)
                end
    Severity: Critical
    Found in lib/ronin/support/encoding/uri.rb - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
                    byte.chr
                  elsif byte == 0x20
                    '+'
                  else
      Severity: Critical
      Found in lib/ronin/support/encoding/http.rb - About 2 hrs to fix

        Method build has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

                  def self.build(fields, alignment: nil, padding: true)
                    members       = {}
                    max_alignment = 0
                    pack_string   = String.new(encoding: Encoding::ASCII_8BIT)
        
        
        Severity: Minor
        Found in lib/ronin/support/binary/ctypes/struct_type.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 read_string has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

                  def read_string(length=nil)
                    new_string = if (encoding = external_encoding)
                                   String.new('', encoding: encoding)
                                 else
                                   String.new('')
        Severity: Minor
        Found in lib/ronin/support/binary/stream/methods.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 initialize_ssl has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

                def initialize_ssl(ca_bundle:        nil,
                                   cert:             nil,
                                   cert_store:       nil,
                                   ciphers:          nil,
                                   extra_chain_cert: nil,
        Severity: Minor
        Found in lib/ronin/support/network/http.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 parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                  def parse(hexdump)
                    return enum_for(__method__,hexdump) unless block_given?
        
                    previous_address = nil
                    first_address    = nil
        Severity: Minor
        Found in lib/ronin/support/binary/unhexdump/parser.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 encode_byte has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.encode_byte(byte, format: :decimal, zero_pad: false, **kwargs)
                  case format
                  when :decimal
                    if zero_pad then "&#%.7d;" % byte
                    else             "&#%d;" % byte
        Severity: Minor
        Found in lib/ronin/support/encoding/xml.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 escape_byte has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.escape_byte(byte,**kwargs)
                  if (byte >= 0) && (byte <= 0xff)
                    if (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
                      byte.chr
                    elsif byte == 0x20
        Severity: Minor
        Found in lib/ronin/support/encoding/http.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 escape_byte has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.escape_byte(byte,**kwargs)
                  if (byte >= 0) && (byte <= 0xff)
                    if (byte == 33) || (byte == 36) || (byte == 38) || ((byte >= 39) && (byte <= 59)) || (byte == 61) || ((byte >= 63) && (byte <= 91)) || (byte == 93) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
                      byte.chr
                    else
        Severity: Minor
        Found in lib/ronin/support/encoding/uri.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 build has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def self.build(method,path, # query string keyword arguments
                                              query:        nil,
                                              query_params: nil,
                                              # Basic-Auth keyword arguments
                                              user:     nil,
        Severity: Minor
        Found in lib/ronin/support/network/http/request.rb - About 1 hr to fix

          Method generator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.generator(**kwargs)
                    if kwargs.empty?
                      DEFAULT
                    else
                      rules = []
          Severity: Minor
          Found in lib/ronin/support/text/typo.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 poll has 33 lines of code (exceeds 25 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 1 hr to fix

            Method each has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                      def each
                        return enum_for(__method__) unless block_given?
            
                        io = IO.popen(command_argv('-v','-l',@path))
            
            
            Severity: Minor
            Found in lib/ronin/support/archive/zip/reader.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 parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def parse(hexdump)
                        return enum_for(__method__,hexdump) unless block_given?
            
                        previous_address = nil
                        first_address    = nil
            Severity: Minor
            Found in lib/ronin/support/binary/unhexdump/parser.rb - About 1 hr to fix

              Method generate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def self.generate(version:    2,
                                        serial:     0,
                                        not_before: Time.now,
                                        not_after:  not_before + ONE_YEAR,
                                        subject:    nil,
              Severity: Minor
              Found in lib/ronin/support/crypto/cert.rb - About 1 hr to fix

                Method imap_connect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def imap_connect(host, user: ,
                                                 password: ,
                                                 port:  DEFAULT_PORT,
                                                 ssl:   nil,
                                                 auth: :login)
                Severity: Minor
                Found in lib/ronin/support/network/imap/mixin.rb - About 1 hr to fix

                  Method connect_uri has a Cognitive Complexity of 10 (exceeds 5 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

                  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