From edf0e675123e4869e2739d1bab0ed57b3b9f664c Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 9 Mar 2015 13:09:46 +0000 Subject: Do not use parentheses for method calls with no arguments. This is neater. Flagged by rubocop --- lib/custodian/alerts/file.rb | 2 +- lib/custodian/alerts/graphite.rb | 4 ++-- lib/custodian/alerts/mauve.rb | 8 ++++---- lib/custodian/alerts/redis-state.rb | 2 +- lib/custodian/alerts/smtp.rb | 4 ++-- lib/custodian/parser.rb | 2 +- lib/custodian/protocoltest/dns.rb | 12 ++++++------ lib/custodian/protocoltest/http.rb | 4 ++-- lib/custodian/protocoltest/mx.rb | 4 ++-- lib/custodian/protocoltest/openproxy.rb | 6 +++--- lib/custodian/protocoltest/ping.rb | 4 ++-- lib/custodian/protocoltest/smtprelay.rb | 2 +- lib/custodian/protocoltest/tcp.rb | 10 +++++----- lib/custodian/queue.rb | 2 +- lib/custodian/settings.rb | 18 +++++++++--------- lib/custodian/util/dns.rb | 8 ++++---- lib/custodian/worker.rb | 18 +++++++++--------- 17 files changed, 55 insertions(+), 55 deletions(-) (limited to 'lib') diff --git a/lib/custodian/alerts/file.rb b/lib/custodian/alerts/file.rb index cc2a672..5874136 100644 --- a/lib/custodian/alerts/file.rb +++ b/lib/custodian/alerts/file.rb @@ -31,7 +31,7 @@ module Custodian # Record a raise event for the given test. # def raise - write_message( "RAISE: #{test.target} failed #{test.get_type}-test - #{test.error()}" ) + write_message( "RAISE: #{test.target} failed #{test.get_type}-test - #{test.error}" ) end diff --git a/lib/custodian/alerts/graphite.rb b/lib/custodian/alerts/graphite.rb index 34ec73c..2e49125 100644 --- a/lib/custodian/alerts/graphite.rb +++ b/lib/custodian/alerts/graphite.rb @@ -63,9 +63,9 @@ module Custodian # # Send via UDP. # - socket = UDPSocket.new() + socket = UDPSocket.new socket.send( payload, 0, @target, 2003 ); - socket.close() + socket.close end diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index 8ce14c1..dfa4a04 100644 --- a/lib/custodian/alerts/mauve.rb +++ b/lib/custodian/alerts/mauve.rb @@ -69,7 +69,7 @@ module Custodian # update = Mauve::Proto::AlertUpdate.new update.alert = [] - update.source = @settings.alert_source() + update.source = @settings.alert_source update.replace = false # @@ -151,7 +151,7 @@ module Custodian # update = Mauve::Proto::AlertUpdate.new update.alert = [] - update.source = @settings.alert_source() + update.source = @settings.alert_source update.replace = false # @@ -241,7 +241,7 @@ module Custodian # # The text from the job-defition # - user_text = test.get_notification_text() + user_text = test.get_notification_text # # Add the user-detail if present @@ -251,7 +251,7 @@ module Custodian # # Add the test-failure message # - alert.detail = "#{alert.detail}

#{test.error()}

" + alert.detail = "#{alert.detail}

#{test.error}

" # # Determine if this is inside/outside the bytemark network diff --git a/lib/custodian/alerts/redis-state.rb b/lib/custodian/alerts/redis-state.rb index 7d9daa7..f37cef2 100644 --- a/lib/custodian/alerts/redis-state.rb +++ b/lib/custodian/alerts/redis-state.rb @@ -59,7 +59,7 @@ module Custodian tmp["type"] = @test.get_type tmp["target"] = @test.target tmp["result"] = "RAISE" - tmp["reason"] = @test.error() + tmp["reason"] = @test.error tmp["test" ] = @test.to_s tmp["class" ] = @test.class diff --git a/lib/custodian/alerts/smtp.rb b/lib/custodian/alerts/smtp.rb index 4de6fbe..d37701b 100644 --- a/lib/custodian/alerts/smtp.rb +++ b/lib/custodian/alerts/smtp.rb @@ -30,8 +30,8 @@ module Custodian # Raise an alert by email. # def raise - subject = "#{test.target} alert #{test.get_type}-test - #{test.error()}" - body = "The alert has raised, with the following details:\n#{test.error()}\nRegards\n"; + subject = "#{test.target} alert #{test.get_type}-test - #{test.error}" + body = "The alert has raised, with the following details:\n#{test.error}\nRegards\n"; _send_mail( @target, subject, body ) end diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index 0bafd47..bce507b 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -139,7 +139,7 @@ module Custodian text = getURL(uri) text.split( /[\r\n]/ ).each do |line| - val.push( line ) if ( line.length() > 0) + val.push( line ) if ( line.length > 0) end elsif ( line =~ /\s(is|are)\s+(.*)\.+$/ ) diff --git a/lib/custodian/protocoltest/dns.rb b/lib/custodian/protocoltest/dns.rb index 05c8534..5787881 100644 --- a/lib/custodian/protocoltest/dns.rb +++ b/lib/custodian/protocoltest/dns.rb @@ -100,8 +100,8 @@ module Custodian # # Get the timeout period. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout # # Do the lookup @@ -147,16 +147,16 @@ module Custodian case ltype when /^A$/ then - dns.getresources(name, Resolv::DNS::Resource::IN::A).map{ |r| results.push( r.address.to_s() ) } + dns.getresources(name, Resolv::DNS::Resource::IN::A).map{ |r| results.push( r.address.to_s ) } when /^AAAA$/ then - dns.getresources(name, Resolv::DNS::Resource::IN::AAAA).map{ |r| results.push( r.address.to_s() ) } + dns.getresources(name, Resolv::DNS::Resource::IN::AAAA).map{ |r| results.push( r.address.to_s ) } when /^NS$/ then - dns.getresources(name, Resolv::DNS::Resource::IN::NS).map{ |r| results.push( Resolv.getaddresses( r.name.to_s() ) ) } + dns.getresources(name, Resolv::DNS::Resource::IN::NS).map{ |r| results.push( Resolv.getaddresses( r.name.to_s ) ) } when /^MX$/ then - dns.getresources(name, Resolv::DNS::Resource::IN::MX).map{ |r| results.push( Resolv.getaddresses( r.exchange.to_s() ) ) } + dns.getresources(name, Resolv::DNS::Resource::IN::MX).map{ |r| results.push( Resolv.getaddresses( r.exchange.to_s ) ) } else @error = "Unknown record type to resolve: '#{ltype}'" diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index 0bbe290..a36b349 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -209,8 +209,8 @@ module Custodian # # Get the timeout period for this test. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout # # The URL we'll fetch/poll. diff --git a/lib/custodian/protocoltest/mx.rb b/lib/custodian/protocoltest/mx.rb index 29a9183..2372556 100644 --- a/lib/custodian/protocoltest/mx.rb +++ b/lib/custodian/protocoltest/mx.rb @@ -57,8 +57,8 @@ module Custodian # # Get the timeout period. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout # # The MX-hosts diff --git a/lib/custodian/protocoltest/openproxy.rb b/lib/custodian/protocoltest/openproxy.rb index 5313343..851982c 100644 --- a/lib/custodian/protocoltest/openproxy.rb +++ b/lib/custodian/protocoltest/openproxy.rb @@ -80,13 +80,13 @@ module Custodian # # Get the timeout period for this test. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout begin timeout( period ) do begin - c = Curl::Easy.new() + c = Curl::Easy.new c.follow_location = true c.max_redirects = 10 c.ssl_verify_host = false diff --git a/lib/custodian/protocoltest/ping.rb b/lib/custodian/protocoltest/ping.rb index ff406d5..423b925 100644 --- a/lib/custodian/protocoltest/ping.rb +++ b/lib/custodian/protocoltest/ping.rb @@ -94,8 +94,8 @@ module Custodian # # Get the timeout period. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout diff --git a/lib/custodian/protocoltest/smtprelay.rb b/lib/custodian/protocoltest/smtprelay.rb index a1c0b33..45abf16 100644 --- a/lib/custodian/protocoltest/smtprelay.rb +++ b/lib/custodian/protocoltest/smtprelay.rb @@ -86,7 +86,7 @@ module Custodian begin - Net::SMTP.start(@host,@port, get_hostname() ) do |smtp| + Net::SMTP.start(@host,@port, get_hostname ) do |smtp| sent = smtp.send_message message, "noreply@bytemark.co.uk", "noreply@bytemark.co.uk" @status = sent.status.to_s diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb index 9ca2180..24a05be 100644 --- a/lib/custodian/protocoltest/tcp.rb +++ b/lib/custodian/protocoltest/tcp.rb @@ -153,8 +153,8 @@ module Custodian # # Get the timeout period. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout # # Perform the DNS lookups of the specified name. @@ -265,8 +265,8 @@ module Custodian # # Get the timeout period for this test. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout begin timeout(period) do @@ -283,7 +283,7 @@ module Custodian read.gsub!(/[\n\r]/, "") end - socket.close() + socket.close if ( banner.nil? ) @error = nil diff --git a/lib/custodian/queue.rb b/lib/custodian/queue.rb index 6e252e9..671e44e 100644 --- a/lib/custodian/queue.rb +++ b/lib/custodian/queue.rb @@ -182,7 +182,7 @@ end # Get the size of the queue # def size? - stats = @queue.stats() + stats = @queue.stats ( stats['current-jobs-ready'] || 0 ) end diff --git a/lib/custodian/settings.rb b/lib/custodian/settings.rb index 8bcf71c..e0d2d27 100644 --- a/lib/custodian/settings.rb +++ b/lib/custodian/settings.rb @@ -84,7 +84,7 @@ module Custodian # Retrieve an arbitrary key # def key( name ) - _load() unless( _loaded? ) + _load unless( _loaded? ) @settings[name] end @@ -93,7 +93,7 @@ module Custodian # The timeout period for each individual test. # def timeout - _load() unless( _loaded? ) + _load unless( _loaded? ) if ( @settings['timeout'] ) @settings['timeout'].to_i @@ -109,7 +109,7 @@ module Custodian # before raising an alert. # def retries - _load() unless( _loaded? ) + _load unless( _loaded? ) if ( @settings['retries'] ) @settings['retries'].to_i @@ -129,7 +129,7 @@ module Custodian # A delay of zero is permissable. # def retry_delay - _load() unless( _loaded? ) + _load unless( _loaded? ) if ( @settings['retry_delay'] ) @settings['retry_delay'].to_i @@ -146,7 +146,7 @@ module Custodian # environmental variable 'QUEUE_ADDRESS'. # def queue_type - _load() unless( _loaded? ) + _load unless( _loaded? ) @settings['queue_type'] || "redis" end @@ -157,7 +157,7 @@ module Custodian # The filename for the logfile. # def log_file - _load() unless( _loaded? ) + _load unless( _loaded? ) @settings['log_file'] || "custodian-dequeue.log" end @@ -167,7 +167,7 @@ module Custodian # The alerter to use # def alerter - _load() unless( _loaded? ) + _load unless( _loaded? ) @settings['alerter'] || "file" end @@ -177,7 +177,7 @@ module Custodian # The alert-source we send. Only used when the notifier is set to mauve. # def alert_source - _load() unless( _loaded? ) + _load unless( _loaded? ) @settings['alert_source'] || "Custodian" end @@ -195,7 +195,7 @@ module Custodian # When the alerter is "redis" the target is the redis-server address. # def alerter_target( alert ) - _load() unless( _loaded? ) + _load unless( _loaded? ) # diff --git a/lib/custodian/util/dns.rb b/lib/custodian/util/dns.rb index 82a7e68..9cbbf59 100644 --- a/lib/custodian/util/dns.rb +++ b/lib/custodian/util/dns.rb @@ -26,8 +26,8 @@ module Custodian # # Get the timeout period. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout begin timeout( period ) do @@ -54,8 +54,8 @@ module Custodian # # Get the timeout period. # - settings = Custodian::Settings.instance() - period = settings.timeout() + settings = Custodian::Settings.instance + period = settings.timeout begin timeout( period ) do diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb index b411c00..fd1abce 100644 --- a/lib/custodian/worker.rb +++ b/lib/custodian/worker.rb @@ -73,16 +73,16 @@ module Custodian @settings = settings # Connect to the queue - @queue = QueueType.create( @settings.queue_type() ) + @queue = QueueType.create( @settings.queue_type ) # Get the alerter-type(s) to instantiate @alerter = @settings.alerter # How many times to repeat a failing test - @retry_count=@settings.retries() + @retry_count=@settings.retries # Should we sleep between repeated tests? - @retry_delay = @settings.retry_delay() + @retry_delay = @settings.retry_delay end @@ -105,7 +105,7 @@ module Custodian def run! while( true ) log_message( "Waiting for job.." ) - process_single_job() + process_single_job end end @@ -170,7 +170,7 @@ module Custodian # Run the test - inverting the result if we should # result = test.run_test - result = ! result if ( test.inverted() ) + result = ! result if ( test.inverted ) if ( result ) log_message( "Test succeeed - clearing alert" ) @@ -223,7 +223,7 @@ module Custodian # # Raise the alert, passing the error message. # - log_message( "Test failed - alerting with #{test.error()}" ) + log_message( "Test failed - alerting with #{test.error}" ) do_raise( test ) end @@ -252,7 +252,7 @@ module Custodian # give the alerter a reference to the settings object. alert.set_settings( @settings ) - alert.raise() + alert.raise end end @@ -272,7 +272,7 @@ module Custodian # give the alerter a reference to the settings object. alert.set_settings( @settings ) - alert.clear() + alert.clear end end @@ -300,7 +300,7 @@ module Custodian # Process jobs until we see a failure, then stop. # def process_until_fail - while( process_single_job() ) + while( process_single_job ) # nop end end -- cgit v1.2.1