From 63e2d2f2ec87d833408b7e8b6fb33e3f0fa0c804 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 10 Aug 2017 10:17:51 +0300 Subject: Significant rubocop fixups. This merge-request contains almost entirely mechanical changes, with a few exceptions: * I changed `do_ipv4` and `do_ipv6` to `ipv4` and `ipv6` respectively. * This fixed a warning about normal-casing. * I changed a test-case to compare against both `Integer` and `Fixnum` * Suspect this is a ruby-versionism. The tests continue to pass, so I believe this is safe to merge, but of course it is still not 100%: lib/custodian/queue.rb:135:21: W: Assignment in condition - you probably meant to use ==. added = true ^ lib/custodian/protocoltest/ssl.rb:218:5: W: Do not shadow rescued Exceptions rescue OpenSSL::SSL::SSLError => err ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/custodian/protocoltest/ssl.rb:286:5: W: Do not shadow rescued Exceptions rescue OpenSSL::SSL::SSLError => err ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/custodian/protocoltest/http.rb:307:7: C: Assignment Branch Condition size for run_test is too high. [84.53/72] def run_test ^^^ lib/custodian/protocoltest/http.rb:307:7: C: Cyclomatic complexity for run_test is too high. [22/19] def run_test ^^^ lib/custodian/protocoltest/http.rb:307:7: C: Method has too many lines. [97/87] def run_test ... ^^^^^^^^^^^^ lib/custodian/protocoltest/http.rb:307:7: C: Perceived complexity for run_test is too high. [23/21] def run_test In short this takes care of _most_ of the warnings, but updates requiring significant code-change have not been applied. --- lib/custodian/alerts/mauve.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/custodian/alerts') diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index 0aed390..bf4d08f 100644 --- a/lib/custodian/alerts/mauve.rb +++ b/lib/custodian/alerts/mauve.rb @@ -110,7 +110,7 @@ module Custodian # If we're Monday-Friday, between the start & end time, then # we're in the working day. # - if ((wday != 0) && (wday != 6)) && + if ((wday.nonzero?) && (wday != 6)) && (hour >= day_start && hour < day_end) working = true end @@ -229,7 +229,7 @@ module Custodian alert.id = Digest::SHA1.hexdigest(id_key) # Look for a subject-prefix - subject_prefix = Custodian::Util::Prefix.text() + subject_prefix = Custodian::Util::Prefix.text alert.subject = subject_prefix + subject alert.summary = "The #{test_type} test failed against #{test_host}" -- cgit v1.2.1