Skip to content
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

Merged
merged 1 commit into from
Sep 6, 2017
Merged

Revert "Only Cleanup!" #293

merged 1 commit into from
Sep 6, 2017

Conversation

sgreen-r7
Copy link
Contributor

Reverts #292

@sgreen-r7 sgreen-r7 merged commit 5daaf30 into master Sep 6, 2017
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|

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

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 == ''

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

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

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'

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.

@sgreen-r7
Copy link
Contributor Author

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})

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")

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})

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'

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'

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

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

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

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

@sgreen-r7 sgreen-r7 deleted the revert-292-cleanup_formatting branch September 6, 2017 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants