diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e967c8b..65757ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,8 +5,7 @@ on: branches: [main] pull_request: -env: - ruby_version: 2.7.1 +# env: # ImageOs must be configured to match the OS of the runner when using self-hosted runners. # ImageOS: ubuntu22 @@ -16,8 +15,6 @@ jobs: steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.ruby_version }} - name: Install dependencies run: bundle install - name: Run specs @@ -28,7 +25,7 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ env.ruby_version }} + bundler-cache: true - name: Install dependencies run: bundle install - name: Lint diff --git a/.github/workflows/issue_ops.yml b/.github/workflows/issue_ops.yml index e6b1514..a6f81cf 100644 --- a/.github/workflows/issue_ops.yml +++ b/.github/workflows/issue_ops.yml @@ -54,12 +54,10 @@ jobs: }) - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7.1 # ImageOs must be configured to match the OS of the runner when using self-hosted runners. # env: # ImageOS: ubuntu22 - - name: Install dependencies + - name: Install Dependencies run: bundle install env: BUNDLE_WITHOUT: development diff --git a/.rubocop.yml b/.rubocop.yml index a6b7ac4..d13970e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,12 @@ +require: + - rubocop-performance + inherit_gem: rubocop-github: - - config/default_edge.yml + - config/default.yml +AllCops: + NewCops: enable Lint/AmbiguousBlockAssociation: Exclude: - "spec/**/*" diff --git a/.ruby-version b/.ruby-version index 860487c..be94e6f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.1 +3.2.2 diff --git a/Gemfile b/Gemfile index 91d8b2d..b1dff3f 100644 --- a/Gemfile +++ b/Gemfile @@ -15,9 +15,9 @@ group :development do gem "pry-byebug", "~> 3.9" gem "rspec", "~> 3.10" gem "rspec-github", "~> 2.3", ">= 2.3.1" - gem "rubocop", "~> 0.80", "< 0.81" - gem "rubocop-github", "~> 0.14.0" - gem "rubocop-performance", "~> 1.6.1" + gem "rubocop", "~> 1.5" + gem "rubocop-github", "~> 0.2" + gem "rubocop-performance", "~> 1.18" gem "ruby-debug-ide", "~> 0.7.2" gem "shoulda-matchers", "~> 4.5.1" end diff --git a/Gemfile.lock b/Gemfile.lock index def0368..adeaf73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,75 +1,93 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.4.3) + activesupport (7.0.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) ast (2.4.2) + base64 (0.1.1) byebug (11.1.3) coderay (1.1.3) concurrent-ruby (1.2.2) - diff-lcs (1.4.4) + diff-lcs (1.5.0) dotenv (2.7.6) - factory_bot (6.2.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) - faker (2.19.0) - i18n (>= 1.6, < 2) - i18n (1.12.0) + faker (2.23.0) + i18n (>= 1.8.11, < 2) + i18n (1.14.1) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.4) - json (2.6.2) + json (2.6.3) + language_server-protocol (3.17.0.3) method_source (1.0.0) - minitest (5.18.0) - parallel (1.21.0) - parser (3.0.3.1) + minitest (5.19.0) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) - pry (0.13.1) + racc + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) + pry-byebug (3.10.1) byebug (~> 11.0) - pry (~> 0.13.0) - rainbow (3.0.0) + pry (>= 0.13, < 0.15) + racc (1.7.1) + rack (3.0.8) + rainbow (3.1.1) rake (13.0.6) + regexp_parser (2.8.1) require_all (3.0.0) - rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.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.10.0) - rspec-github (2.3.1) + rspec-support (~> 3.12.0) + rspec-github (2.4.0) rspec-core (~> 3.0) - rspec-mocks (3.10.2) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.3) - rubocop (0.80.1) - jaro_winkler (~> 1.5.1) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rubocop (1.56.0) + 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) - rexml + 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) - rubocop-github (0.14.0) - rubocop (~> 0.59) - rubocop-performance (1.6.1) - rubocop (>= 0.71.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-github (0.19.0) + rubocop (>= 1.0.0) + rubocop-performance + rubocop-rails + rubocop-performance (1.18.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.20.2) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) ruby-debug-ide (0.7.3) rake (>= 0.8.1) - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) shoulda-matchers (4.5.1) activesupport (>= 4.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (1.6.1) + unicode-display_width (2.4.2) PLATFORMS ruby @@ -85,11 +103,11 @@ DEPENDENCIES require_all (~> 3.0.0) rspec (~> 3.10) rspec-github (~> 2.3, >= 2.3.1) - rubocop (~> 0.80, < 0.81) - rubocop-github (~> 0.14.0) - rubocop-performance (~> 1.6.1) + rubocop (~> 1.5) + rubocop-github (~> 0.2) + rubocop-performance (~> 1.18) ruby-debug-ide (~> 0.7.2) shoulda-matchers (~> 4.5.1) BUNDLED WITH - 2.2.33 + 2.4.18 diff --git a/bin/parse_issue b/bin/parse_issue index bad38d0..26ef4bb 100755 --- a/bin/parse_issue +++ b/bin/parse_issue @@ -4,7 +4,7 @@ require "yaml" require "open3" -require_relative "./../cli" +require_relative "../cli" issue_content, comment_body, labels = ARGV diff --git a/bin/rspec b/bin/rspec index 80957cf..6bbe8d5 100755 --- a/bin/rspec +++ b/bin/rspec @@ -20,7 +20,8 @@ if File.file?(bundle_binstub) if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300)) load(bundle_binstub) else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. + abort( +"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") end end diff --git a/bin/rubocop b/bin/rubocop index 8d97c87..c5518e0 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -20,7 +20,8 @@ if File.file?(bundle_binstub) if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300)) load(bundle_binstub) else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. + abort( +"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") end end diff --git a/spec/models/arguments_spec.rb b/spec/models/arguments_spec.rb index a7456a6..8771108 100644 --- a/spec/models/arguments_spec.rb +++ b/spec/models/arguments_spec.rb @@ -11,17 +11,17 @@ RSpec.describe Arguments do context "when the command is found" do before do - expect(provider).to receive(:module).and_return(::Jenkins).at_least(:once) + expect(provider).to receive(:module).and_return(Jenkins).at_least(:once) expect(command).to receive(:classify).and_return("Audit").at_least(:once) expect(command).to receive(:options).and_return({}) end - it { is_expected.to be_a(::Jenkins::Audit) } + it { is_expected.to be_a(Jenkins::Audit) } end context "when the command is not found" do before do - expect(provider).to receive(:module).and_return(::Jenkins).at_least(:once) + expect(provider).to receive(:module).and_return(Jenkins).at_least(:once) expect(command).to receive(:classify).and_return("Whoopsie").at_least(:once) end @@ -35,10 +35,10 @@ RSpec.describe Arguments do let(:options) { {} } before do - expect(provider).to receive(:module).and_return(::AzureDevops).at_least(:once) + expect(provider).to receive(:module).and_return(AzureDevops).at_least(:once) expect(command).to receive(:classify).and_return("Audit").at_least(:once) expect(command).to receive(:options).and_return(options) - expect_any_instance_of(::AzureDevops::Audit).to receive(:to_a).and_return(output) + expect_any_instance_of(AzureDevops::Audit).to receive(:to_a).and_return(output) end context "when the output is nil" do diff --git a/spec/models/provider_spec.rb b/spec/models/provider_spec.rb index c72bc09..2fb6170 100644 --- a/spec/models/provider_spec.rb +++ b/spec/models/provider_spec.rb @@ -84,7 +84,7 @@ RSpec.describe Provider do LABELS end - it { is_expected.to eq(::TravisCI) } + it { is_expected.to eq(TravisCI) } end describe "to_output" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bb54771..95a024d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,7 @@ require "factory_bot" require "faker" require "fileutils" -require_relative "./../cli" +require_relative "../cli" Dir[File.join(__dir__, "support/**/*.rb")].sort.each { |f| require f }