-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "Only Cleanup!" #293
Conversation
raise 'An SMTP alert must contain an array of recipient emails with at least 1 recipient' | ||
end | ||
|
||
recipients.each do |recipient| | ||
recipients.each do |recipient| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
@@ -172,23 +174,22 @@ class SMTPAlert | |||
attr_accessor :recipients, :sender, :verbose | |||
|
|||
def initialize(name, sender, server, recipients, enabled = 1, max_alerts = -1, verbose = 0) | |||
unless recipients.is_a?(Array) && !recipients.empty? | |||
unless recipients.is_a?(Array) && recipients.length > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use recipients.length.positive? instead of recipients.length > 0.
Use !empty? instead of length > 0.
def self.create(hash) | ||
alert_type = hash[:alert_type] | ||
raise 'An alert must have an alert type' if alert_type.nil? | ||
raise 'Alert name cannot be empty.' if !hash.key?(:name) || hash[:name].to_s == '' | ||
raise 'Alert name cannot be empty.' if !hash.has_key?(:name) || hash[:name].to_s == '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Hash#key? instead of Hash#has_key?.
@@ -130,10 +130,12 @@ def validate | |||
raise ArgumentError.new('Vuln filter is a required attribute.') unless @vuln_filter | |||
end | |||
|
|||
private |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless private access modifier.
yield | ||
ensure | ||
set_rows(nsc, pref, orig) | ||
begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant begin block detected.
@@ -15,7 +15,7 @@ module AJAX | |||
# Content type strings acceptect by Nexpose. | |||
# | |||
module CONTENT_TYPE | |||
XML = 'text/xml; charset=UTF-8' | |||
XML = 'text/xml; charset=UTF-8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Freeze mutable objects assigned to constants.
It wasn't only cleanup.... |
@@ -53,8 +54,8 @@ def update_engine(engine_id) | |||
# each active scan on the engine. | |||
# | |||
def engine_activity(engine_id) | |||
xml = make_xml('EngineActivityRequest', { 'engine-id' => engine_id }) | |||
r = execute(xml) | |||
xml = make_xml('EngineActivityRequest', {'engine-id' => engine_id}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Redundant curly braces around a hash parameter.
Space inside } missing.
response = AJAX.put(self, uri) | ||
response.eql?('true') | ||
response.eql?("true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -10,7 +10,8 @@ class Connection | |||
# @return [Boolean] true if engine successfully deleted. | |||
# | |||
def delete_engine(engine_id, scope = 'silo') | |||
xml = make_xml('EngineDeleteRequest', { 'engine-id' => engine_id, 'scope' => scope }) | |||
xml = make_xml('EngineDeleteRequest', | |||
{'engine-id' => engine_id, 'scope' => scope}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Redundant curly braces around a hash parameter.
Space inside } missing.
ON = 'poweredOn' | ||
OFF = 'poweredOff' | ||
ON = 'poweredOn' | ||
OFF = 'poweredOff' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Freeze mutable objects assigned to constants.
end | ||
|
||
module Value | ||
module PowerState | ||
ON = 'poweredOn' | ||
OFF = 'poweredOff' | ||
ON = 'poweredOn' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Freeze mutable objects assigned to constants.
@name, @address, @user, @password = name, address, user, password | ||
@protocol = Protocol::HTTPS | ||
@exchange_hostname = '' # nexpose will set to office365 server | ||
@exchange_username, @exchange_password = exchange_username, exchange_password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use parallel assignment.
@type = Type::ACTIVESYNC_OFFICE365 | ||
@id = -1 | ||
@port = 443 # Port not used for mobile connection | ||
@name, @address, @user, @password = name, address, user, password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use parallel assignment.
@port = 443 # Port not used for mobile connection | ||
@name, @address, @user, @password = name, address, user, password | ||
@protocol = Protocol::HTTPS | ||
@exchange_hostname, @exchange_username, @exchange_password = exchange_hostname, exchange_username, exchange_password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use parallel assignment.
@type = Type::ACTIVESYNC_POWERSHELL | ||
@id = -1 | ||
@port = 443 # Port not used for mobile connection | ||
@name, @address, @user, @password = name, address, user, password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use parallel assignment.
end | ||
end | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
Reverts #292