From 33ed25bd0ecde69d749406aaccdc27675c1f056f Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Tue, 30 Aug 2022 01:13:11 -0500 Subject: [PATCH] Puma 6 gemspec - required_ruby_version to Ruby 2.4, RuboCop updates (#2919) * Puma 6 - required_ruby_version to Ruby 2.4 * Actions - remove Ruby 2.2 & 2.3, add macOS 12 * Update Rubocop, disable Cops as needed to pass --- .github/workflows/tests.yaml | 29 +++++++++++------------------ .rubocop.yml | 25 ++++++++++++++++++++----- Gemfile | 3 ++- puma.gemspec | 2 +- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f631069f..c5cb1003 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -38,8 +38,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-18.04, macos-10.15, macos-11, windows-2022 ] - ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, head ] + os: [ ubuntu-20.04, ubuntu-18.04, macos-10.15, macos-11, macos-12, windows-2022 ] + ruby: [ 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, head ] no-ssl: [''] yjit: [''] include: @@ -52,16 +52,16 @@ jobs: - { os: ubuntu-22.04 , ruby: head } exclude: - - { os: ubuntu-20.04 , ruby: 2.2 } - - { os: ubuntu-20.04 , ruby: 2.3 } - { os: windows-2022 , ruby: head } - - { os: macos-10.15 , ruby: 2.6 } - { os: macos-10.15 , ruby: 2.7 } - { os: macos-10.15 , ruby: '3.0'} - { os: macos-10.15 , ruby: 3.1 } - - { os: macos-11 , ruby: 2.2 } - - { os: macos-11 , ruby: 2.3 } + - { os: macos-10.15 , ruby: head } - { os: macos-11 , ruby: 2.4 } + - { os: macos-11 , ruby: 2.5 } + - { os: macos-12 , ruby: 2.4 } + - { os: macos-12 , ruby: 2.5 } + - { os: macos-12 , ruby: 2.6 } steps: - name: repo checkout @@ -73,21 +73,14 @@ jobs: ruby-version: ${{ matrix.ruby }} apt-get: ragel brew: ragel - # below is only needed for Rubies 2.4 and earlier - mingw: openssl ragel + # below is only needed for Ruby 2.4 + mingw: openssl bundler-cache: true timeout-minutes: 10 - # Windows error thrown, doesn't affect CI - - name: update rubygems for Ruby 2.2 - if: matrix.ruby < '2.3' - run: gem update --system 2.7.11 --no-document - continue-on-error: true - timeout-minutes: 5 - # fixes 'has a bug that prevents `required_ruby_version`' - - name: update rubygems for Ruby 2.3 - 2.5 - if: contains('2.3 2.4 2.5', matrix.ruby) + - name: update rubygems for Ruby 2.4 - 2.5 + if: contains('2.4 2.5', matrix.ruby) run: gem update --system 3.3.14 --no-document continue-on-error: true timeout-minutes: 5 diff --git a/.rubocop.yml b/.rubocop.yml index 2ed66551..6f8779c8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,8 @@ +require: rubocop-performance + AllCops: DisabledByDefault: true - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.4 DisplayCopNames: true StyleGuideCopsOnly: false Exclude: @@ -9,6 +11,21 @@ AllCops: - 'examples/**/*' - 'pkg/**/*' - 'Rakefile' + SuggestExtensions: false + NewCops: disable + +# ————————————————————————————————————————— disabled cops + +Performance/RegexpMatch: + Enabled: false + +Performance/UnfreezeString: + Enabled: false + +Style/RedundantReturn: + Enabled: false + +# ————————————————————————————————————————— enabled cops Layout/SpaceAfterColon: Enabled: true @@ -26,10 +43,10 @@ Layout/SpaceBeforeFirstArg: Layout/SpaceInsideParens: Enabled: true -Layout/Tab: +Layout/IndentationStyle: Enabled: true -Layout/TrailingBlankLines: +Layout/TrailingEmptyLines: Enabled: true Layout/TrailingWhitespace: @@ -77,5 +94,3 @@ Style/WhileUntilModifier: Style/TernaryParentheses: Enabled: true -Style/RedundantReturn: - Enabled: true diff --git a/Gemfile b/Gemfile index 904eb16c..fa6e832c 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,8 @@ gem "sd_notify" gem "jruby-openssl", :platform => "jruby" unless ENV['PUMA_NO_RUBOCOP'] || RUBY_PLATFORM.include?('mswin') - gem "rubocop", "~> 0.64.0" + gem "rubocop", "1.12.1" + gem 'rubocop-performance', require: false end if %w(2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1).include? RUBY_VERSION diff --git a/puma.gemspec b/puma.gemspec index 888156e2..f5e01c25 100644 --- a/puma.gemspec +++ b/puma.gemspec @@ -28,5 +28,5 @@ Gem::Specification.new do |s| end s.license = "BSD-3-Clause" - s.required_ruby_version = Gem::Requirement.new(">= 2.2") + s.required_ruby_version = Gem::Requirement.new(">= 2.4") end