From d676c659e7de20aa1c1f78b43d1f1f0c33cddf1a Mon Sep 17 00:00:00 2001 From: Patrik Ragnarsson Date: Fri, 31 Dec 2021 14:18:16 +0100 Subject: [PATCH] Bump RuboCop to work with newer Psych versions (#2783) * Patch Rubocop's yaml_safe_load to work with newer Psych versions * Fix rubocop namespace * Remove rubocop skip condition from workflow steps * Fix rubygems warnings about required_ruby_version bug * Fix step name * Use RuboCop 0.64.0 Last version we can use while still having Ruby 2.2 support, 0.65.0 drops it: https://github.com/rubocop/rubocop/blob/0c0bee18073201396f679848954235d10b9f8355/CHANGELOG.md#0650-2019-02-19 Fixes issues with RubyGems and Psych: https://github.com/puma/puma/pull/2779 Co-authored-by: Dalibor Nasevic --- .github/workflows/mri.yml | 9 +++++++-- Gemfile | 2 +- lib/puma/thread_pool.rb | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mri.yml b/.github/workflows/mri.yml index b81828f3..2f28ae5f 100644 --- a/.github/workflows/mri.yml +++ b/.github/workflows/mri.yml @@ -59,6 +59,13 @@ jobs: continue-on-error: true timeout-minutes: 5 + # Fix RubyGems warnings about required_ruby_version bug with Bundler + - name: update rubygems for Ruby 2.3 - 2.5 + if: matrix.ruby >= '2.3' && matrix.ruby < '2.6' + run: gem update --system 3.2.3 --no-document + continue-on-error: true + timeout-minutes: 5 + - name: Compile Puma without SSL support if: matrix.no-ssl == ' no SSL' shell: bash @@ -72,8 +79,6 @@ jobs: run: bundle exec rake compile - name: rubocop - # 2021-05-20 - RuboCop won't run with Psych 4.0 - remove when fixed - if: (endsWith(matrix.ruby, 'head') == false) && (endsWith(matrix.ruby, 'ucrt') == false) run: bundle exec rake rubocop - name: Use yjit diff --git a/Gemfile b/Gemfile index 727ee281..f40b2674 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "sd_notify" gem "jruby-openssl", :platform => "jruby" -gem "rubocop", "~> 0.58.0" +gem "rubocop", "~> 0.64.0" if %w(2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1).include? RUBY_VERSION gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"] diff --git a/lib/puma/thread_pool.rb b/lib/puma/thread_pool.rb index 9454564f..e3e1915a 100644 --- a/lib/puma/thread_pool.rb +++ b/lib/puma/thread_pool.rb @@ -72,7 +72,7 @@ module Puma attr_accessor :out_of_band_hook # @version 5.0.0 def self.clean_thread_locals - Thread.current.keys.each do |key| # rubocop: disable Performance/HashEachMethods + Thread.current.keys.each do |key| # rubocop: disable Style/HashEachMethods Thread.current[key] = nil unless key == :__recursive_key__ end end