From d7f792c6cf5f9dab870d0205de1a174863ca6a12 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 9 Mar 2015 14:44:15 +0000 Subject: Updated to test for more whitespace issues. --- lib/custodian/parser.rb | 2 +- lib/custodian/protocoltest/dns.rb | 10 +++++----- lib/custodian/protocoltest/ssl.rb | 4 ++-- lib/custodian/util/bytemark.rb | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index c7002e0..1f59d26 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -416,7 +416,7 @@ module Custodian # # Read the configuration file. # - out = File.open(filename, 'r') {|file| file.readlines.collect} + out = File.open(filename, 'r') { |file| file.readlines.collect } # # Parse it diff --git a/lib/custodian/protocoltest/dns.rb b/lib/custodian/protocoltest/dns.rb index a4e7baf..4685029 100644 --- a/lib/custodian/protocoltest/dns.rb +++ b/lib/custodian/protocoltest/dns.rb @@ -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}'" @@ -178,7 +178,7 @@ module Custodian # # Flatten, sort, uniq # - results.flatten.map{|r| r.to_s.downcase }.sort.uniq + results.flatten.map { |r| r.to_s.downcase }.sort.uniq end diff --git a/lib/custodian/protocoltest/ssl.rb b/lib/custodian/protocoltest/ssl.rb index 5e14329..f2baf67 100644 --- a/lib/custodian/protocoltest/ssl.rb +++ b/lib/custodian/protocoltest/ssl.rb @@ -77,7 +77,7 @@ class SSLCheck # def tests=(ts) raise ArgumentError, 'tests must be an Array' unless ts.is_a?(Array) - @tests = ts.collect{|t| t.to_sym}.select{|t| ALL_TESTS.include?(t)} + @tests = ts.collect { |t| t.to_sym }.select { |t| ALL_TESTS.include?(t) } @tests end @@ -200,7 +200,7 @@ class SSLCheck self.errors << verbose("Failed to fetch certificate for #{self.domain}") return nil else - return ![verify_subject, verify_valid_from, verify_valid_to, verify_signature].any?{|r| false == r} + return ![verify_subject, verify_valid_from, verify_valid_to, verify_signature].any? { |r| false == r } end end diff --git a/lib/custodian/util/bytemark.rb b/lib/custodian/util/bytemark.rb index 99079a1..c23b082 100644 --- a/lib/custodian/util/bytemark.rb +++ b/lib/custodian/util/bytemark.rb @@ -20,7 +20,7 @@ module Custodian # These are used to test if an alert refers to a machine outwith our # network. # - BYTEMARK_RANGES = %w(80.68.80.0/20 89.16.160.0/19 212.110.160.0/19 46.43.0.0/18 91.223.58.0/24 213.138.96.0/19 5.153.224.0/21 5.28.58.0/24 2001:41c8::/29 2001:41c9::/32).collect{|i| IPAddr.new(i)} + BYTEMARK_RANGES = %w(80.68.80.0/20 89.16.160.0/19 212.110.160.0/19 46.43.0.0/18 91.223.58.0/24 213.138.96.0/19 5.153.224.0/21 5.28.58.0/24 2001:41c8::/29 2001:41c9::/32).collect { |i| IPAddr.new(i) } # @@ -29,7 +29,7 @@ module Custodian def self.inside?(target) inside = false - if BYTEMARK_RANGES.any?{|range| range.include?(IPAddr.new(target))} + if BYTEMARK_RANGES.any? { |range| range.include?(IPAddr.new(target)) } inside = true end -- cgit v1.2.1