From 1ce0906b3480702085d4596dbb4758c115ab298f Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 9 Mar 2015 13:10:32 +0000 Subject: Don't use parenthesis aroudn conditions in an if. --- lib/custodian/alerts/mauve.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/custodian/alerts') diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index dfa4a04..92c38ee 100644 --- a/lib/custodian/alerts/mauve.rb +++ b/lib/custodian/alerts/mauve.rb @@ -109,8 +109,8 @@ module Custodian # If we're Monday-Friday, between the start & end time, then # we're in the working day. # - if ( ( ( wday != 0 ) && ( wday != 6 ) ) && - ( hour >= day_start && hour < day_end ) ) + if ( ( wday != 0 ) && ( wday != 6 ) ) && + ( hour >= day_start && hour < day_end ) working = true end @@ -198,10 +198,10 @@ module Custodian # subject = @test.target - if ( ( subject =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ ) || - ( subject =~ /^([0-9a-f:]+)$/ ) ) + if ( subject =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ ) || + ( subject =~ /^([0-9a-f:]+)$/ ) res = Custodian::Util::DNS.ip_to_hostname( subject ) - if ( res ) + if res subject = res end end @@ -234,7 +234,7 @@ module Custodian # # If we're raising then add the error # - if ( failure ) + if failure alert.detail = "

The #{test_type} test failed against #{test_host}.

" @@ -246,7 +246,7 @@ module Custodian # # Add the user-detail if present # - alert.detail = "#{alert.detail}

#{user_text}

" if ( !user_text.nil? ) + alert.detail = "#{alert.detail}

#{user_text}

" if !user_text.nil? # # Add the test-failure message @@ -257,7 +257,7 @@ module Custodian # Determine if this is inside/outside the bytemark network # location = expand_inside_bytemark( test_host ) - if ( !location.nil? && location.length ) + if !location.nil? && location.length alert.detail = "#{alert.detail}\n#{location}" end end @@ -282,7 +282,7 @@ module Custodian # We'll also make the host a link that can be clicked in the alert we raise. # target = host - if ( target =~ /^([a-z]+):\/\/([^\/]+)/ ) + if target =~ /^([a-z]+):\/\/([^\/]+)/ target = $2.dup host = "#{host}" end @@ -296,8 +296,8 @@ module Custodian # # Resolve the target to an IP, unless it is already an address. # - if ( ( target =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ ) || - ( target =~ /^([0-9a-f:]+)$/ ) ) + if ( target =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ ) || + ( target =~ /^([0-9a-f:]+)$/ ) resolved = target else resolved = Custodian::Util::DNS.hostname_to_ip( target ) @@ -307,13 +307,13 @@ module Custodian # # Did we get an error? # - return "" unless ( !resolved.nil? ) + return "" unless !resolved.nil? # # Return the formatted message # - if ( Custodian::Util::Bytemark.inside?( resolved.to_s ) ) + if Custodian::Util::Bytemark.inside?( resolved.to_s ) if ( resolved == target ) return "

#{host} is inside the Bytemark network.

" else -- cgit v1.2.1