lib/nexpose/scan.rb
File scan.rb
has 490 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Nexpose
class Connection
include XMLUtils
# Perform an ad hoc scan of a single device.
Class Connection
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Connection
include XMLUtils
# Perform an ad hoc scan of a single device.
#
Method initialize
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(scan_id, site_id, engine_id, status, start_time, end_time, message, tasks, nodes, vulnerabilities)
Method initialize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(vuln_exploit, vuln_version, vuln_potential, not_vuln_exploit, not_vuln_version, error, disabled, other)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(scan_id, site_id, engine_id, status, start_time, end_time)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(live, dead, filtered, unresolved, other)
Method stop_scan
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def stop_scan(scan_id, wait_sec = 0)
r = execute(make_xml('ScanStopRequest', 'scan-id' => scan_id))
if r.success
so_far = 0
while so_far < wait_sec
- 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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.parse(scan_id, rexml)
return nil unless rexml
map = {}
rexml.elements.each("//ScanSummary[contains(@scan-id,'#{scan_id}')]/vulnerabilities") do |vuln|
status = map[vuln.attributes['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"