ronin-rb/ronin-support

View on GitHub

Showing 197 of 197 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module Ronin
  module Support
    module Binary
      module CTypes
        module Arch
Severity: Major
Found in lib/ronin/support/binary/ctypes/arch/arm64.rb and 3 other locations - About 1 hr to fix
lib/ronin/support/binary/ctypes/arch/mips64.rb on lines 21..70
lib/ronin/support/binary/ctypes/arch/ppc64.rb on lines 21..70
lib/ronin/support/binary/ctypes/arch/x86_64.rb on lines 21..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module Ronin
  module Support
    module Binary
      module CTypes
        module Arch
Severity: Major
Found in lib/ronin/support/binary/ctypes/arch/mips64.rb and 3 other locations - About 1 hr to fix
lib/ronin/support/binary/ctypes/arch/arm64.rb on lines 21..70
lib/ronin/support/binary/ctypes/arch/ppc64.rb on lines 21..70
lib/ronin/support/binary/ctypes/arch/x86_64.rb on lines 21..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module Ronin
  module Support
    module Binary
      module CTypes
        module Arch
Severity: Major
Found in lib/ronin/support/binary/ctypes/arch/x86_64.rb and 3 other locations - About 1 hr to fix
lib/ronin/support/binary/ctypes/arch/arm64.rb on lines 21..70
lib/ronin/support/binary/ctypes/arch/mips64.rb on lines 21..70
lib/ronin/support/binary/ctypes/arch/ppc64.rb on lines 21..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      module Ronin
        module Support
          module Binary
            module CTypes
              module Arch
      Severity: Major
      Found in lib/ronin/support/binary/ctypes/arch/ppc.rb and 3 other locations - About 1 hr to fix
      lib/ronin/support/binary/ctypes/arch/arm.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/mips.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/x86.rb on lines 21..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      module Ronin
        module Support
          module Binary
            module CTypes
              module Arch
      Severity: Major
      Found in lib/ronin/support/binary/ctypes/arch/x86.rb and 3 other locations - About 1 hr to fix
      lib/ronin/support/binary/ctypes/arch/arm.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/mips.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/ppc.rb on lines 21..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      module Ronin
        module Support
          module Binary
            module CTypes
              module Arch
      Severity: Major
      Found in lib/ronin/support/binary/ctypes/arch/arm.rb and 3 other locations - About 1 hr to fix
      lib/ronin/support/binary/ctypes/arch/mips.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/ppc.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/x86.rb on lines 21..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      module Ronin
        module Support
          module Binary
            module CTypes
              module Arch
      Severity: Major
      Found in lib/ronin/support/binary/ctypes/arch/mips.rb and 3 other locations - About 1 hr to fix
      lib/ronin/support/binary/ctypes/arch/arm.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/ppc.rb on lines 21..70
      lib/ronin/support/binary/ctypes/arch/x86.rb on lines 21..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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 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

      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 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 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 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 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 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 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 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

              Severity
              Category
              Status
              Source
              Language