bin/check-smart.rb in sensu-plugins-disk-checks-5.0.1 vs bin/check-smart.rb in sensu-plugins-disk-checks-5.1.0
- old
+ new
@@ -1,6 +1,8 @@
#! /usr/bin/env ruby
+# frozen_string_literal: true
+
#
# check-smart
#
# DESCRIPTION:
#
@@ -167,26 +169,26 @@
end
# Main function
#
def run
- unless @devices.length > 0
+ unless @devices.length > 0 # rubocop: disable Style/NumericPredicate
exit_with(
config[:no_smart_capable_disks],
'No SMART capable devices found'
)
end
unhealthy_disks = @devices.select { |disk| disk.smart_capable? && !disk.healthy? }
unknown_disks = @devices.reject(&:smart_capable?)
- if unhealthy_disks.length > 0
+ if unhealthy_disks.length > 0 # rubocop: disable Style/NumericPredicate
output = unhealthy_disks.map(&:health_output)
output.concat(unknown_disks.map(&:capability_output))
critical output.join("\n")
end
- if unknown_disks.length > 0
+ if unknown_disks.length > 0 # rubocop: disable Style/NumericPredicate
exit_with(
config[:smart_incapable_disks],
unknown_disks.map(&:capability_output).join("\n")
)
end