ronin-rb/ronin-support

View on GitHub

Showing 114 of 202 total issues

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

  def encode_chars(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

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

        def self.escape_byte(byte)
          if byte >= 0x00 && byte <= 0xff
            ESCAPE_BYTES.fetch(byte) do
              if byte >= 0x20 && byte <= 0x7e
                byte.chr
Severity: Minor
Found in lib/ronin/support/encoding/js.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 unescape has a Cognitive Complexity of 8 (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/ruby.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 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 ssl_connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

          def ssl_connect_and_send(data,host,port,**kwargs,&block)
Severity: Minor
Found in lib/ronin/support/network/ssl/mixin.rb - About 35 mins to fix

    Method connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def self.connect_and_send(data,host,port, min_version: 1, **kwargs, &block)
    Severity: Minor
    Found in lib/ronin/support/network/tls.rb - About 35 mins to fix

      Method udp_connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                def udp_connect_and_send(data,host,port,**kwargs,&block)
      Severity: Minor
      Found in lib/ronin/support/network/udp/mixin.rb - About 35 mins to fix

        Method tls_connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                  def tls_connect_and_send(data,host,port,**kwargs, &block)
        Severity: Minor
        Found in lib/ronin/support/network/tls/mixin.rb - About 35 mins to fix

          Method tcp_connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                    def tcp_connect_and_send(data,host,port,**kwargs,&block)
          Severity: Minor
          Found in lib/ronin/support/network/tcp/mixin.rb - About 35 mins to fix

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

                    def self.escape_byte(byte)
                      if byte >= 0x00 && byte <= 0xff
                        ESCAPE_BYTES.fetch(byte) do
                          if byte >= 0x20 && byte <= 0x7e
                            byte.chr
            Severity: Minor
            Found in lib/ronin/support/encoding/powershell.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 escape_byte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                    def self.escape_byte(byte)
                      if byte >= 0x00 && byte <= 0xff
                        ESCAPE_BYTES.fetch(byte) do
                          if byte >= 0x20 && byte <= 0x7e
                            byte.chr
            Severity: Minor
            Found in lib/ronin/support/encoding/c.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                    def initialize(name, direction: ,
                                         key:       nil,
                                         hash:      :sha256,
                                         password:  nil,
                                         iv:        nil,
            Severity: Minor
            Found in lib/ronin/support/crypto/cipher.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 pack has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                      def pack(hash)
                        unknown_keys = hash.keys - @members.keys
            
                        unless unknown_keys.empty?
                          raise(ArgumentError,"unknown union members: #{unknown_keys.map(&:inspect).join(', ')}")
            Severity: Minor
            Found in lib/ronin/support/binary/ctypes/union_type.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 escape_byte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                    def self.escape_byte(byte)
                      if byte >= 0x00 && byte <= 0xff
                        ESCAPE_BYTES.fetch(byte) do
                          if byte >= 0x20 && byte <= 0x7e
                            byte.chr
            Severity: Minor
            Found in lib/ronin/support/encoding/shell.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 to_s has a Cognitive Complexity of 7 (exceeds 5 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 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

            Severity
            Category
            Status
            Source
            Language