Showing 15 of 15 total issues
Method included
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(command)
command.option :ip, value: {
type: String,
usage: 'IP'
},
Method filter_targets
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def filter_targets(xml)
targets = xml.each_up_host.lazy
unless @with_ips.empty?
targets = filter_targets_by_ip(targets)
- Read upRead up
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 highlight_host
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def highlight_host(host,pattern)
addresses = host.addresses
hostnames = host.hostnames
unless hostnames.empty?
Method scan
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.scan(*targets, sudo: nil, **kwargs,&block)
nmap = ::Nmap::Command.new(**kwargs,&block)
nmap.targets ||= targets
Method host_as_json
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.host_as_json(host)
hash = {
start_time: host.start_time,
end_time: host.end_time,
status: status_as_json(host.status),
Method print_target
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_target(host)
puts "[ #{host} ]"
puts
unless host.addresses.empty?
Method run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run(xml_file,output_file=nil)
unless File.file?(xml_file)
print_error "no such file or directory: #{xml_file}"
exit(-1)
end
- Read upRead up
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 filter_targets
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter_targets(xml)
targets = xml.each_up_host.lazy
unless @with_ips.empty?
targets = filter_targets_by_ip(targets)
Method highlight_host
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def highlight_host(host,pattern)
addresses = host.addresses
hostnames = host.hostnames
unless hostnames.empty?
- Read upRead up
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_uris
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_uris(host)
filter_ports(host).each do |port|
if (port.service && port.service.name == 'http') ||
(port.number == 80)
puts URI::HTTP.build(
- Read upRead up
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 host_as_json
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.host_as_json(host)
hash = {
start_time: host.start_time,
end_time: host.end_time,
status: status_as_json(host.status),
- Read upRead up
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(*nmap_args)
if (output = options[:output])
output_format = options.fetch(:output_format) do
infer_output_format(output)
end
- Read upRead up
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_target
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_target(host)
puts "[ #{host} ]"
puts
unless host.addresses.empty?
- Read upRead up
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 match_service
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def match_service(service,pattern)
product = service.product
version = service.version
extra_info = service.extra_info
- Read upRead up
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 scan
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.scan(*targets, sudo: nil, **kwargs,&block)
nmap = ::Nmap::Command.new(**kwargs,&block)
nmap.targets ||= targets
- Read upRead up
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"