ronin-rb/ronin

View on GitHub

Showing 57 of 57 total issues

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

module Ronin
  class CLI
    module Commands
      #
      # Encodes each character of data into a variety of encodings.
Severity: Major
Found in lib/ronin/cli/commands/encode.rb and 1 other location - About 1 day to fix
lib/ronin/cli/commands/decode.rb on lines 21..177

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

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 2 locations. Consider refactoring.
Open

module Ronin
  class CLI
    module Commands
      #
      # Decode each character of data from a variety of encodings.
Severity: Major
Found in lib/ronin/cli/commands/decode.rb and 1 other location - About 1 day to fix
lib/ronin/cli/commands/encode.rb on lines 21..177

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

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 2 locations. Consider refactoring.
Open

module Ronin
  class CLI
    module Commands
      #
      # Escapes each special character for a variety of encodings.
Severity: Major
Found in lib/ronin/cli/commands/escape.rb and 1 other location - About 4 hrs to fix
lib/ronin/cli/commands/unescape.rb on lines 21..123

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

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 2 locations. Consider refactoring.
Open

module Ronin
  class CLI
    module Commands
      #
      # Unescapes each escaped character from a variety of encodings.
Severity: Major
Found in lib/ronin/cli/commands/unescape.rb and 1 other location - About 4 hrs to fix
lib/ronin/cli/commands/escape.rb on lines 21..123

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

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

        def run(*args)
          local, upstream = *args

          if local.include?(':')
            proxy_host, proxy_port = host_and_port(local)
Severity: Minor
Found in lib/ronin/cli/commands/proxy.rb - About 4 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

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

module Ronin
  class CLI
    module Commands
      #
      # Updates and parses the public suffix list file.
Severity: Major
Found in lib/ronin/cli/commands/public_suffix_list.rb and 1 other location - About 4 hrs to fix
lib/ronin/cli/commands/tld_list.rb on lines 25..126

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

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 2 locations. Consider refactoring.
Open

module Ronin
  class CLI
    module Commands
      #
      # Updates and parses the TLD list file.
Severity: Major
Found in lib/ronin/cli/commands/tld_list.rb and 1 other location - About 4 hrs to fix
lib/ronin/cli/commands/public_suffix_list.rb on lines 25..126

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

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 run has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def run(*args)
          local, upstream = *args

          if local.include?(':')
            proxy_host, proxy_port = host_and_port(local)
Severity: Major
Found in lib/ronin/cli/commands/proxy.rb - About 4 hrs to fix

    Method server_loop has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

            def server_loop
              finished    = Async::Notification.new
              endpoint    = async_endpoint
              stdin       = async_stdin
              clients     = []
    Severity: Minor
    Found in lib/ronin/cli/commands/netcat.rb - About 3 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

    Method run has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            def run(*args)
              if options[:hexdump]
                require 'hexdump'
                @hexdump = Hexdump::Hexdump.new
              end
    Severity: Minor
    Found in lib/ronin/cli/commands/netcat.rb - About 3 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

    File hexdump.rb has 298 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'ronin/cli/file_processor_command'
    
    require 'hexdump'
    
    module Ronin
    Severity: Minor
    Found in lib/ronin/cli/commands/hexdump.rb - About 3 hrs to fix

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

      module Ronin
        class CLI
          module Commands
            #
            # Unquotes a double/single quoted string.
      Severity: Major
      Found in lib/ronin/cli/commands/unquote.rb and 1 other location - About 2 hrs to fix
      lib/ronin/cli/commands/quote.rb on lines 21..107

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

      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 2 locations. Consider refactoring.
      Open

      module Ronin
        class CLI
          module Commands
            #
            # Produces quoted a string for a variety of programming languages.
      Severity: Major
      Found in lib/ronin/cli/commands/quote.rb and 1 other location - About 2 hrs to fix
      lib/ronin/cli/commands/unquote.rb on lines 21..107

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

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

              def process_hostname(host)
                if options[:subdomain]
                  puts host.subdomain(options[:subdomain])
                elsif options[:domain]
                  puts host.domain
      Severity: Minor
      Found in lib/ronin/cli/commands/host.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

      File proxy.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'ronin/cli/command'
      require 'ronin/cli/host_and_port'
      require 'ronin/core/cli/logging'
      
      require 'ronin/support/network/tcp/proxy'
      Severity: Minor
      Found in lib/ronin/cli/commands/proxy.rb - About 2 hrs to fix

        Method define_char_sets has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.define_char_sets(command)
                command.option :numeric, short: '-N',
                                         desc: 'Searches for numeric characters (0-9)' do
                                           @char_set = Chars::NUMERIC
                                         end
        Severity: Major
        Found in lib/ronin/cli/char_set_options.rb - About 2 hrs to fix

          Class HTTPShell has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class HTTPShell < Core::CLI::CommandShell
          
                include Printing::HTTP
          
                # The base URI.
          Severity: Minor
          Found in lib/ronin/cli/http_shell.rb - About 2 hrs to fix

            File netcat.rb has 259 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'ronin/cli/command'
            require 'ronin/core/cli/logging'
            require 'ronin/support/network/ssl'
            
            require 'command_kit/options/verbose'
            Severity: Minor
            Found in lib/ronin/cli/commands/netcat.rb - About 2 hrs to fix

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

                      def client_loop
                        finished    = Async::Notification.new
                        endpoint    = async_endpoint
                        stdin       = async_stdin
                        buffer_size = options[:buffer_size]
              Severity: Minor
              Found in lib/ronin/cli/commands/netcat.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

              File pattern_options.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'ronin/support/text/patterns'
              
              module Ronin
                class CLI
                  #
              Severity: Minor
              Found in lib/ronin/cli/pattern_options.rb - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language