ronin-rb/ronin-web

View on GitHub

Showing 18 of 18 total issues

File spider.rb has 586 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'ronin/web/cli/command'
require 'ronin/web/spider'
require 'ronin/web/spider/archive'
require 'ronin/web/spider/git_archive'
require 'ronin/support/network/http/user_agents'
Severity: Major
Found in lib/ronin/web/cli/commands/spider.rb - About 1 day to fix

    Method agent_kwargs has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

              def agent_kwargs
                kwargs = {}
    
                if options[:open_timeout]
                  kwargs[:open_timeout] = options[:open_timeout]
    Severity: Minor
    Found in lib/ronin/web/cli/commands/spider.rb - About 6 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 agent_kwargs has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def agent_kwargs
                kwargs = {}
    
                if options[:open_timeout]
                  kwargs[:open_timeout] = options[:open_timeout]
    Severity: Major
    Found in lib/ronin/web/cli/commands/spider.rb - About 2 hrs to fix

      Method run has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def run
                  archive = if options[:archive]
                              Web::Spider::Archive.open(options[:archive])
                            elsif options[:git_archive]
                              Web::Spider::GitArchive.open(options[:git_archive])
      Severity: Major
      Found in lib/ronin/web/cli/commands/spider.rb - About 2 hrs to fix

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

                  def run
                    proxy = Ronin::Web::Server::ReverseProxy.new do |proxy|
                      proxy.on_request do |request|
                        puts "[#{request.ip} -> #{request.host_with_port}] #{request.request_method} #{request.url}"
        
        
        Severity: Minor
        Found in lib/ronin/web/cli/commands/reverse_proxy.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 run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def run
                    proxy = Ronin::Web::Server::ReverseProxy.new do |proxy|
                      proxy.on_request do |request|
                        puts "[#{request.ip} -> #{request.host_with_port}] #{request.request_method} #{request.url}"
        
        
        Severity: Minor
        Found in lib/ronin/web/cli/commands/reverse_proxy.rb - About 1 hr to fix

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

                    def run
                      archive = if options[:archive]
                                  Web::Spider::Archive.open(options[:archive])
                                elsif options[:git_archive]
                                  Web::Spider::GitArchive.open(options[:git_archive])
          Severity: Minor
          Found in lib/ronin/web/cli/commands/spider.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 define_printing_callbacks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def define_printing_callbacks(agent)
                      if options[:print_hosts]
                        agent.every_host do |host|
                          print_verbose "spidering new host #{host}"
                        end
          Severity: Minor
          Found in lib/ronin/web/cli/commands/spider.rb - About 1 hr to fix

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

                      def print_url(page)
                        if page.code < 300
                          puts "#{colors.green(page.url)} "
                        elsif page.code < 400
                          puts "#{colors.yellow(page.url)} "
            Severity: Major
            Found in lib/ronin/web/cli/commands/spider.rb and 1 other location - About 1 hr to fix
            lib/ronin/web/cli/commands/spider.rb on lines 826..835

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

                      def print_status(page)
                        if page.code < 300
                          print "#{colors.bright_green(page.code)} "
                        elsif page.code < 400
                          print "#{colors.bright_yellow(page.code)} "
            Severity: Major
            Found in lib/ronin/web/cli/commands/spider.rb and 1 other location - About 1 hr to fix
            lib/ronin/web/cli/commands/spider.rb on lines 844..853

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

                      def print_page(page)
                        print_status(page) if options[:print_status]
                        print_url(page)
            
                        if options[:print_headers]
            Severity: Minor
            Found in lib/ronin/web/cli/commands/spider.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 define_printing_callbacks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                      def define_printing_callbacks(agent)
                        if options[:print_hosts]
                          agent.every_host do |host|
                            print_verbose "spidering new host #{host}"
                          end
            Severity: Minor
            Found in lib/ronin/web/cli/commands/spider.rb - About 25 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

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

                      option :file, short: '-f',
                                    value: {
                                      type: String,
                                      usage: '/PATH:FILE'
                                    },
            Severity: Minor
            Found in lib/ronin/web/cli/commands/server.rb and 3 other locations - About 25 mins to fix
            lib/ronin/web/cli/commands/server.rb on lines 74..82
            lib/ronin/web/cli/commands/server.rb on lines 85..93
            lib/ronin/web/cli/commands/server.rb on lines 114..122

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

            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

                      option :redirect, short: '-R',
                                        value: {
                                          type:  String,
                                          usage: '/PATH:URL'
                                        },
            Severity: Minor
            Found in lib/ronin/web/cli/commands/server.rb and 3 other locations - About 25 mins to fix
            lib/ronin/web/cli/commands/server.rb on lines 74..82
            lib/ronin/web/cli/commands/server.rb on lines 85..93
            lib/ronin/web/cli/commands/server.rb on lines 96..104

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

            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

                      option :basic_auth, short: '-A',
                                          value: {
                                            type: String,
                                            usage: 'USER:PASSWORD'
                                          },
            Severity: Minor
            Found in lib/ronin/web/cli/commands/server.rb and 3 other locations - About 25 mins to fix
            lib/ronin/web/cli/commands/server.rb on lines 85..93
            lib/ronin/web/cli/commands/server.rb on lines 96..104
            lib/ronin/web/cli/commands/server.rb on lines 114..122

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

            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

                      option :dir, short: '-d',
                                   value: {
                                     type:  String,
                                     usage: '/PATH:DIR'
                                   },
            Severity: Minor
            Found in lib/ronin/web/cli/commands/server.rb and 3 other locations - About 25 mins to fix
            lib/ronin/web/cli/commands/server.rb on lines 74..82
            lib/ronin/web/cli/commands/server.rb on lines 96..104
            lib/ronin/web/cli/commands/server.rb on lines 114..122

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

            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
              module Web
                #
                # XML helper methods.
                #
            Severity: Minor
            Found in lib/ronin/web/xml.rb and 1 other location - About 15 mins to fix
            lib/ronin/web/html.rb on lines 23..82

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

            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
              module Web
                #
                # HTML helper methods.
                #
            Severity: Minor
            Found in lib/ronin/web/html.rb and 1 other location - About 15 mins to fix
            lib/ronin/web/xml.rb on lines 23..82

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

            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

            Severity
            Category
            Status
            Source
            Language