ronin-rb/ronin-support

View on GitHub

Showing 110 of 197 total issues

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

          def self.build(common_name: nil, organizational_unit: nil, organization: nil, locality: nil, state: nil, province: nil, country: nil)
            name = new
            name.add_entry("CN",common_name)         if common_name
            name.add_entry("OU",organizational_unit) if organizational_unit
            name.add_entry("O",organization)         if organization
Severity: Minor
Found in lib/ronin/support/crypto/cert.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)
          buffer  = String.new(encoding: Encoding::UTF_8)
          scanner = StringScanner.new(data)

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

          def tld_regexp(tld,subtree)
            if subtree
              subtree_regexp = if subtree.length == 1
                                 tld_regexp(subtree.keys[0],subtree.values[0])
                               else
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 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 join has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def join(*names)
        joined_path = if root? then String.new(encoding: Encoding::UTF_8)
                      else          self.to_s
                      end

Severity: Minor
Found in lib/ronin/support/path.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 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 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, version: 1.2, **kwargs, &block)
      Severity: Minor
      Found in lib/ronin/support/network/tls/mixin.rb - About 35 mins to fix

        Method to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                  def to_s
                    string = super()
                    string << "; Max-Age=#{@max_age}"          if @max_age
                    string << "; Expires=#{@expires.httpdate}" if @expires
                    string << "; Path=#{@path}"                if @path
        Severity: Minor
        Found in lib/ronin/support/network/http/set_cookie.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 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/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/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 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 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

        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 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/ruby.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(string)
                    @string = string
        
                    if @string.include?(':') # IPv6
                      @version   = 6
        Severity: Minor
        Found in lib/ronin/support/network/ip_range/glob.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

        Severity
        Category
        Status
        Source
        Language