diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 04af4c02d2..c7a086c5bd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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. diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index bb26f748b1..8f8a2b0183 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -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) diff --git a/lib/tasks/missing_payments.rake b/lib/tasks/missing_payments.rake index c822b62ee4..9f0982f82d 100644 --- a/lib/tasks/missing_payments.rake +++ b/lib/tasks/missing_payments.rake @@ -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 diff --git a/lib/tasks/sample_data/logging.rb b/lib/tasks/sample_data/logging.rb index ad85624092..9204b664be 100644 --- a/lib/tasks/sample_data/logging.rb +++ b/lib/tasks/sample_data/logging.rb @@ -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 diff --git a/lib/tasks/subscriptions/debug.rake b/lib/tasks/subscriptions/debug.rake index 750bfb4d73..bd641ce11f 100644 --- a/lib/tasks/subscriptions/debug.rake +++ b/lib/tasks/subscriptions/debug.rake @@ -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 diff --git a/lib/tasks/subscriptions/test.rake b/lib/tasks/subscriptions/test.rake index ff6317b841..c4349f1b7b 100644 --- a/lib/tasks/subscriptions/test.rake +++ b/lib/tasks/subscriptions/test.rake @@ -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