From 13b815f03da5a37088623ebfdfc2fa5e0c813d57 Mon Sep 17 00:00:00 2001 From: sylvestre antoine Date: Mon, 11 Sep 2023 15:55:51 +0200 Subject: [PATCH] Upgrade Ruby to version 3 and RuboCop to version 1.5. See https://github.com/codecademy-engineering/Codecademy/pull/36403 --- .github/workflows/lint.yaml | 2 +- .ruby-version | 2 +- Gemfile.lock | 58 ++++++++++++++++++++++++--------- codecademy-style.gemspec | 7 ++-- default.yml | 2 +- lib/codecademy_style/version.rb | 2 +- spec/codecademy/style_spec.rb | 8 ++--- spec/spec_helper.rb | 2 +- 8 files changed, 55 insertions(+), 28 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 496ebbc..b3647c0 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 # no need for ruby-version because we have a .ruby_version file with: - bundler-cache: true + bundler-cache: true - name: Run Rubocop run: bundle exec rubocop --config ./.rubocop.yml diff --git a/.ruby-version b/.ruby-version index 860487c..818bd47 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.1 +3.0.6 diff --git a/Gemfile.lock b/Gemfile.lock index c5e11f0..b0b5af3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,27 +1,54 @@ PATH remote: . specs: - codecademy-style (0.1.9) - rubocop (= 0.79) + codecademy-style (0.2.0) + rubocop (~> 1.56) GEM remote: https://rubygems.org/ specs: - ast (2.4.0) - jaro_winkler (1.5.4) - parallel (1.19.1) - parser (2.7.0.2) - ast (~> 2.4.0) - rainbow (3.0.0) - rubocop (0.79.0) - jaro_winkler (~> 1.5.1) + ast (2.4.2) + base64 (0.1.1) + diff-lcs (1.5.0) + json (2.6.3) + language_server-protocol (3.17.0.3) + parallel (1.23.0) + parser (3.2.2.3) + ast (~> 2.4.1) + racc + racc (1.7.1) + rainbow (3.1.1) + regexp_parser (2.8.1) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rubocop (1.56.3) + base64 (~> 0.1.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - ruby-progressbar (1.10.1) - unicode-display_width (1.6.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + unicode-display_width (2.4.2) PLATFORMS ruby @@ -29,7 +56,8 @@ PLATFORMS DEPENDENCIES bundler (>= 2.2.10) codecademy-style! - rubocop (= 0.79) + rspec + rubocop (~> 1.56) BUNDLED WITH 2.2.25 diff --git a/codecademy-style.gemspec b/codecademy-style.gemspec index e779a6b..afd6af1 100644 --- a/codecademy-style.gemspec +++ b/codecademy-style.gemspec @@ -9,6 +9,8 @@ Gem::Specification.new do |spec| spec.version = CodecademyStyle::VERSION spec.authors = ['Codecademy Engineering'] + spec.required_ruby_version = '>= 3.0' + spec.summary = 'Shared RuboCop style configuration' spec.description = 'This gem holds shared RuboCop configuration for all of' \ 'Codecademy\'s Ruby code bases.' @@ -34,8 +36,9 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] # Require clients of this gem to have RuboCop installed - spec.add_dependency 'rubocop', '=0.79' + spec.add_dependency 'rubocop', '~>1.56' spec.add_development_dependency 'bundler', '>= 2.2.10' - spec.add_development_dependency 'rubocop', '=0.79' + spec.add_development_dependency 'rspec' + spec.add_development_dependency 'rubocop', '~>1.56' end diff --git a/default.yml b/default.yml index 4ad2233..3790216 100644 --- a/default.yml +++ b/default.yml @@ -2,7 +2,7 @@ Metrics/BlockLength: Exclude: - 'spec/**/*.rb' - '**/*.gemspec' - ExcludedMethods: + AllowedMethods: - 'included' # ActiveSupport concerns - 'namespace' # rake tasks - 'task' # rake tasks diff --git a/lib/codecademy_style/version.rb b/lib/codecademy_style/version.rb index 93b958e..ed2f319 100644 --- a/lib/codecademy_style/version.rb +++ b/lib/codecademy_style/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module CodecademyStyle - VERSION = '0.1.9' + VERSION = '0.2.0' end diff --git a/spec/codecademy/style_spec.rb b/spec/codecademy/style_spec.rb index 45fc426..011262c 100644 --- a/spec/codecademy/style_spec.rb +++ b/spec/codecademy/style_spec.rb @@ -1,11 +1,7 @@ # frozen_string_literal: true -RSpec.describe Codecademy::Style do +RSpec.describe CodecademyStyle do it 'has a version number' do - expect(Codecademy::Style::VERSION).not_to be nil - end - - it 'does something useful' do - expect(false).to eq(true) + expect(CodecademyStyle::VERSION).not_to be nil end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5feb9c2..e39d566 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'bundler/setup' -require 'codecademy/style' +require 'codecademy/style_spec' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure