Autocorrect Style/GlobalStdStream offenses

This commit is contained in:
Carlos Chitty
2025-03-26 10:58:05 -04:00
parent 1109ccfc3d
commit be76e714c6
6 changed files with 6 additions and 16 deletions

View File

@@ -579,16 +579,6 @@ Style/ClassAndModuleChildren:
- 'lib/open_food_network/locking.rb'
- 'spec/models/spree/payment_method_spec.rb'
# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'lib/tasks/data.rake'
- 'lib/tasks/missing_payments.rake'
- 'lib/tasks/sample_data/logging.rb'
- 'lib/tasks/subscriptions/debug.rake'
- 'lib/tasks/subscriptions/test.rake'
# Offense count: 10
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSplatArgument.

View File

@@ -78,11 +78,11 @@ namespace :ofn do
# Ask how many months back we want to search for
puts "This task will search order cycle edited within (n) months of today's date.\n" \
"Please enter a value for (n), or hit ENTER to use the default of three (3) months."
input = check_default(STDIN.gets.chomp)
input = check_default($stdin.gets.chomp)
while !is_integer?(input)
puts "'#{input}' is not an integer. Please enter an integer."
input = check_default(STDIN.gets.chomp)
input = check_default($stdin.gets.chomp)
end
Integer(input)

View File

@@ -44,7 +44,7 @@ namespace :ofn do
details = Psych.load(entry.details)
out << row(details, details.params)
rescue StandardError
Logger.new(STDERR).warn(entry)
Logger.new($stderr).warn(entry)
end
def headers

View File

@@ -4,7 +4,7 @@ module Logging
private
def log(message)
@logger ||= ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
@logger ||= ActiveSupport::TaggedLogging.new(Logger.new($stdout))
@logger.tagged("ofn:sample_data") { @logger.info(message) }
end
end

View File

@@ -54,7 +54,7 @@ namespace :ofn do
def request_order_cycle_id
puts "Please input Order Cycle ID to debug"
input = STDIN.gets.chomp
input = $stdin.gets.chomp
exit if input.blank? || !Integer(input)
Integer(input)
end

View File

@@ -62,7 +62,7 @@ namespace :ofn do
def request_order_cycle_id
puts "Please input Order Cycle ID to reset"
input = STDIN.gets.chomp
input = $stdin.gets.chomp
exit if input.blank? || !Integer(input)
Integer(input)
end