ronin-rb/ronin

View on GitHub

Showing 57 of 57 total issues

Avoid deeply nested control flow statements.
Open

          elsif options[:query]
            print_records(host.get_records(options[:query]))
          else
            puts host.name
Severity: Major
Found in lib/ronin/cli/commands/host.rb - About 45 mins to fix

    Method process_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def process_value(ip)
              ip = Support::Network::IP.new(ip)
    
              if options[:reverse]
                puts ip.reverse
    Severity: Minor
    Found in lib/ronin/cli/commands/ip.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 process_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def process_value(host)
              host = Support::Network::Host.new(host)
    
              if options[:change_suffix]
                process_host(host.change_suffix(options[:change_suffix]))
    Severity: Minor
    Found in lib/ronin/cli/commands/host.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

    Avoid deeply nested control flow statements.
    Open

                puts host unless records.empty?
    Severity: Major
    Found in lib/ronin/cli/commands/host.rb - About 45 mins to fix

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

              def run
                if options[:list_categories]
                  puts tip_category_names
                else
                  category = options[:category]
      Severity: Minor
      Found in lib/ronin/cli/commands/tips.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 process_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def process_value(url)
                unless url =~ URL_REGEX
                  print_error "invalid URL: #{url.inspect}"
                  return
                end
      Severity: Minor
      Found in lib/ronin/cli/commands/http.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 process_input has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def process_input(input)
                buffer     = String.new
                min_length = options[:min_length]
      
                input.each_char do |char|
      Severity: Minor
      Found in lib/ronin/cli/commands/strings.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def run(*files)
              if (files.empty? && @input_values.empty?)
                process_input(stdin)
              else
                @input_values.each do |value|
      Severity: Minor
      Found in lib/ronin/cli/string_processor_command.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

      Method print_cert_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def print_cert_name(name)
                fields = {}
      
                if name.common_name
                  fields["Common Name"] = name.common_name
      Severity: Minor
      Found in lib/ronin/cli/commands/cert_dump.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

      Method hexdump_kwargs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def hexdump_kwargs
                kwargs = {}
      
                HEXDUMP_OPTIONS.each do |key|
                  kwargs[key] = options[key] if options.has_key?(key)
      Severity: Minor
      Found in lib/ronin/cli/commands/hexdump.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

      Method hexdump_highlights_kwargs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def hexdump_highlights_kwargs
                highlights = {}
      
                unless @highlight_index.empty?
                  highlights[:index] = @highlight_index
      Severity: Minor
      Found in lib/ronin/cli/commands/hexdump.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

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

              def run(*ips)
                if options[:public]
                  if (address = Support::Network::IP.public_address)
                    puts address
                  else
      Severity: Minor
      Found in lib/ronin/cli/commands/ip.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

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

              def run(*ip_ranges)
                if !@start.empty? && !@stop.empty?
                  unless @start.length == @stop.length
                    print_error "must specify an equal number of --start and --stop options"
                    exit(-1)
      Severity: Minor
      Found in lib/ronin/cli/commands/iprange.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

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

              def run(file=nil)
                parser = Support::Binary::Unhexdump::Parser.new(
                           **hexdump_parser_options
                         )
      
      
      Severity: Minor
      Found in lib/ronin/cli/commands/unhexdump.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

      Method subject_alt_name_ext has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def subject_alt_name_ext
                unless @subject_alt_names.empty?
                  @subject_alt_names.map { |name|
                    if name =~ IP_REGEXP
                      "IP: #{name}"
      Severity: Minor
      Found in lib/ronin/cli/commands/cert_gen.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 2 locations. Consider refactoring.
      Open

              command.option :include_chars, short: '-i',
                                             value: {
                                               type: String,
                                               usage: 'CHARS'
                                             },
      Severity: Minor
      Found in lib/ronin/cli/char_set_options.rb and 1 other location - About 15 mins to fix
      lib/ronin/cli/char_set_options.rb on lines 77..84

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

      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

              command.option :exclude_chars, short: '-e',
                                             value: {
                                               type:  String,
                                               usage: 'CHARS'
                                             },
      Severity: Minor
      Found in lib/ronin/cli/char_set_options.rb and 1 other location - About 15 mins to fix
      lib/ronin/cli/char_set_options.rb on lines 68..75

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

      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