ronin-rb/ronin-masscan

View on GitHub

Showing 5 of 5 total issues

Method included has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.included(command)
          command.option :protocol, short: '-P',
                                    value: {
                                      type: [:tcp, :udp]
                                    },
Severity: Minor
Found in lib/ronin/masscan/cli/filtering_options.rb - About 2 hrs to fix

    Method filter_records has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

            def filter_records(output_file)
              records = output_file.each.lazy
    
              unless @protocols.empty?
                records = filter_records_by_protocol(records)
    Severity: Minor
    Found in lib/ronin/masscan/cli/filtering_options.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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

              def run(*masscan_args)
                if (output = options[:output])
                  output_format = options.fetch(:output_format) do
                                    infer_output_format(output)
                                  end
    Severity: Minor
    Found in lib/ronin/masscan/cli/commands/scan.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 7 (exceeds 5 allowed). Consider refactoring.
    Open

              def run(input_file,output_file=nil)
                unless File.file?(input_file)
                  print_error "no such file or directory: #{input_file}"
                  exit(-1)
                end
    Severity: Minor
    Found in lib/ronin/masscan/cli/commands/convert.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(pattern,*masscan_files)
                masscan_files.each do |masscan_file|
                  unless File.file?(masscan_file)
                    print_error "no such file or directory: #{masscan_file}"
                    next
    Severity: Minor
    Found in lib/ronin/masscan/cli/commands/grep.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

    Severity
    Category
    Status
    Source
    Language