Showing 173 of 173 total issues
Class ScanTemplate
has 65 methods (exceeds 20 allowed). Consider refactoring. Open
class ScanTemplate
include Sanitize
# Parsed XML of a scan template.
attr_reader :xml
File scan.rb
has 490 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Nexpose
class Connection
include XMLUtils
# Perform an ad hoc scan of a single device.
File site.rb
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Nexpose
class Connection
include XMLUtils
File report.rb
has 412 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Nexpose
class Connection
include XMLUtils
Method execute
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def execute(options = {})
@conn_tries = 0
begin
prepare_http_client
@http.read_timeout = options.key?(:timeout) ? options[:timeout] : 120
- 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 from_hash
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def self.from_hash(hash)
start = nil
start = Nexpose::ISO8601.to_time(hash[:start_date]) if hash[:start_date]
repeat_scan_hash = hash[:repeat_scan]
if repeat_scan_hash.nil?
- 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 to_h
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def to_h
schedule_hash = {
enabled: @enabled,
scan_template_id: @scan_template_id,
maximum_scan_duration: @max_duration
- 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
File scan_template.rb
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Nexpose
class Connection
# List the scan templates currently configured on the console.
Class Site
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Site < APIObject
include JsonSerializer
# The site ID. An ID of -1 is used to designate a site that has not been
# saved to a Nexpose console.
attr_accessor :id
Method list_vuln_exceptions
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def list_vuln_exceptions(status = nil)
unless is_valid_vuln_exception_status?(status)
raise "Unknown Status ~> '#{status}' :: For available options refer to Nexpose::VulnException::Status"
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
Class Connection
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Connection
include XMLUtils
# Perform an ad hoc scan of a single device.
#
File common.rb
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Nexpose
# Constants useful across the Nexpose module.
module Scope
GLOBAL = 'global'
SILO = 'silo'
Method execute
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(options = {})
@conn_tries = 0
begin
prepare_http_client
@http.read_timeout = options.key?(:timeout) ? options[:timeout] : 120
Method generate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def generate(connection, timeout = 300, raw = false)
xml = %(<ReportAdhocGenerateRequest session-id="#{connection.session_id}">)
xml << to_xml
xml << '</ReportAdhocGenerateRequest>'
response = connection.execute(xml, '1.1', timeout: timeout, raw: raw)
- 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 validate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate
raise ArgumentError.new('No vuln_id.') unless @vuln_id
raise ArgumentError.new('No scope.') unless @scope
raise ArgumentError.new('No reason.') unless @reason
- 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 deserialize
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def deserialize(data)
data.each do |key, value|
if respond_to?(key)
property = value
if value.respond_to? :each
- 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
File silo.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Nexpose
class Connection
include XMLUtils
Method parse
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(xml)
rexml = REXML::Document.new(xml)
rexml.elements.each('Credential') do |c|
cred = new(c.elements['Name'].text, c.attributes['id'].to_i)
- 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 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(xml)
rexml = REXML::Document.new(xml)
rexml.elements.each('Credential') do |c|
cred = new(c.elements['Name'].text, c.attributes['id'].to_i)
Method as_xml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def as_xml
xml = REXML::Element.new('Schedule')
xml.attributes['enabled'] = @enabled ? 1 : 0
xml.attributes['type'] = @type
xml.attributes['interval'] = @interval
- 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"