Showing 112 of 173 total issues
Method as_xml
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def as_xml
xml = REXML::Element.new('DiscoveryConnection')
xml.attributes['name'] = @name
xml.attributes['address'] = @address
xml.attributes['port'] = @port
- 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 json_initializer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.json_initializer(filter)
new(filter[:start] ? 1 : 0,
filter[:stop] ? 1 : 0,
filter[:failed] ? 1 : 0,
filter[:resume] ? 1 : 0,
- 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 create_discover_known_assets_step
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_discover_known_assets_step(workflow: nil, id:, previous_type_name: StepNames::EMPTY)
step = Step.new(workflow: workflow,
service_name: ServiceNames::NEXPOSE,
type_name: StepNames::DISCOVER_KNOWN,
previous_type_name: previous_type_name)
Method to_h
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_h
schedule_hash = {
enabled: @enabled,
scan_template_id: @scan_template_id,
maximum_scan_duration: @max_duration
Method generate
has 26 lines of code (exceeds 25 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)
Method initialize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(vuln_exploit, vuln_version, vuln_potential, not_vuln_exploit, not_vuln_version, error, disabled, other)
Method <=>
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def <=>(other)
return 1 unless other.respond_to? :from
from = IPAddr.new(@from)
to = @to.nil? ? from : IPAddr.new(@to)
cf_from = IPAddr.new(other.from)
- 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_xml
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_xml
xml = %(<ReportTemplate id='#{@id}' name='#{@name}' type='#{@type}')
xml << %( scope='#{@scope}') if @scope
xml << %( builtin='#{@built_in}') if @built_in
xml << '>'
- 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 load
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.load(connection, user_id)
xml = '<UserConfigRequest session-id="' + connection.session_id + '"'
xml << %( id="#{user_id}" )
xml << ' />'
r = connection.execute(xml, '1.1')
- 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 initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(ip, user, pass, port = 3780, silo_id = nil, token = nil, trust_cert = nil)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(config_id, name, template_id, status, generated_on, uri, scope)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, sender, server, recipients, enabled = 1, max_alerts = -1, verbose = 0)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, address, user, password, exchange_hostname, exchange_username, exchange_password)
Method enable_ip_stack_fingerprinting=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def enable_ip_stack_fingerprinting=(enable)
ns = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name="java/NetworkScanners"]')
param = REXML::XPath.first(ns, './param[@name="ipFingerprintEnabled"]')
if param
param.text = (enable ? 1 : 0)
- 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 windows_service_editor=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def windows_service_editor=(enable)
cifs_scanner = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name="java/CifsScanner"]')
param = REXML::XPath.first(cifs_scanner, './param[@name="windowsServiceEditor"]')
if param
param.text = (enable ? '1' : '0')
- 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 build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.build(connection, site_id, site_name, type, format, generate_now = false)
Method json_initializer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.json_initializer(filter)
new(filter[:severity] ? 1 : 0,
filter[:unconfirmed] ? 1 : 0,
filter[:confirmed] ? 1 : 0,
filter[:potential] ? 1 : 0)
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, full_name, id, description, enabled = true, scope = Scope::SILO)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, baseURL, loginURL, soft403Pattern, id = -1, enabled = true)
Method for_service
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.for_service(name, id = -1, desc = nil, host = nil, port = nil, service = Credential::Service::CIFS)