From e5be70bba69804a2d169c0ef974c8e51f1c0f5bf Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Wed, 6 Aug 2025 08:18:06 -0500 Subject: [PATCH 01/12] update CI configuration to include Ruby 2.7 in the testing matrix --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a93059..2538e94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.1.0','head'] # test only recommend Ruby version (and stable version on the gitaction server) - # ruby-version: ['2.7.4','3.1.0','head'] + ruby-version: ['2.7', '3.1.0','head'] # test only recommend Ruby version (and stable version on the gitaction server) steps: - uses: actions/checkout@v3 - name: Set up Ruby ${{ matrix.ruby-version }} From 6b3b797654feafd153096a1c23aee663f102762b Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 10 Aug 2025 22:45:10 -0500 Subject: [PATCH 02/12] update gitaction to match the latest instruction from github.com/ruby/setup-ruby --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2538e94..b0ebc6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,12 +11,12 @@ jobs: matrix: ruby-version: ['2.7', '3.1.0','head'] # test only recommend Ruby version (and stable version on the gitaction server) steps: - - uses: actions/checkout@v3 - - name: Set up Ruby ${{ matrix.ruby-version }} - uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby-version }} - - name: Install dependencies + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: install dependencies run: bundle install - name: lint run: bundle exec rake lint @@ -24,7 +24,7 @@ jobs: env: SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} run: bundle exec rake test - - name: oobt + - name: out of box testing env: SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} run: bundle exec rake oobt From 28b98d279b0094abdab8da8af0f03bad2b4ba886 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 10 Aug 2025 22:49:10 -0500 Subject: [PATCH 03/12] fix a typo i --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0ebc6b..003b832 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.7', '3.1.0','head'] # test only recommend Ruby version (and stable version on the gitaction server) + ruby: ['2.7', '3.1.0','head'] # test only recommend Ruby version (and stable version on the gitaction server) steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 From d7241a8eb8174e446f825ca23f02671370b5fc1c Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 10 Aug 2025 22:54:17 -0500 Subject: [PATCH 04/12] add newly required rubocop-rake dependency --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index b7e4596..8117e8f 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ group :test, :development do gem 'yard', '~>0.9.28' # linter for ruby gem 'rubocop', '~>1.75.7' + gem 'rubocop-rake', require: false # for rake tasks linting # test for ruby gem 'rspec', '~>3.11' # code coverage to monitor rspec tests From 3a88351cb07c10f40fa7b909ff849685882b888d Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 10 Aug 2025 22:55:58 -0500 Subject: [PATCH 05/12] remove version of rubocop to simplify multiple ruby version compatibility --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 8117e8f..027df79 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ group :test, :development do # documentation generation gem 'yard', '~>0.9.28' # linter for ruby - gem 'rubocop', '~>1.75.7' + gem 'rubocop' gem 'rubocop-rake', require: false # for rake tasks linting # test for ruby gem 'rspec', '~>3.11' From cfc6acca0e5204d721cc176469324e3e08d9a208 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 10 Aug 2025 22:59:06 -0500 Subject: [PATCH 06/12] enable rake plugin for rubocop --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index bfce55a..e57be70 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ +# Require rubocop-rake plugin +require: + - rubocop-rake # human should be able to read 200 chars per line Layout/LineLength: Max: 200 From 8795607206e235f9debb3e3fb4be2f3d0b0068af Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 10 Aug 2025 23:05:16 -0500 Subject: [PATCH 07/12] explicitly set link add rubocop-rake dependency --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 290bd21..02fcc53 100644 --- a/Rakefile +++ b/Rakefile @@ -50,6 +50,7 @@ RSpec::Core::RakeTask.new(:benchmark) do |t| end RuboCop::RakeTask.new(:lint) do |t| + t.plugins << 'rubocop-rake' t.options = ['--display-cop-names'] end From af98ea3689a757c1ac02a68797907810e9a17be5 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Sun, 10 Aug 2025 23:09:40 -0500 Subject: [PATCH 08/12] fix bad syntax proposed by ChatGPT --- .rubocop.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index e57be70..49eb4cd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,7 @@ # Require rubocop-rake plugin -require: +plugins: - rubocop-rake + # human should be able to read 200 chars per line Layout/LineLength: Max: 200 From f38de9c3923c06c54b4945520f4eb93b509877c0 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Mon, 11 Aug 2025 22:51:56 -0500 Subject: [PATCH 09/12] rake call rubocop directly --- .rubocop.yml | 6 +----- Rakefile | 7 +++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 49eb4cd..8dacac8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ Metrics/AbcSize: # short clear method name Metrics/MethodLength: - Max: 25 + Max: 30 # no performance implication Style/OptionalBooleanParameter: @@ -30,10 +30,6 @@ Style/FrozenStringLiteralComment: Metrics/PerceivedComplexity: Max: 12 -# method length is not a problem -MethodLength: - Max: 30 - # if works as well as safe navigation (&.) Style/SafeNavigation: Enabled: false diff --git a/Rakefile b/Rakefile index 02fcc53..d82e2a3 100644 --- a/Rakefile +++ b/Rakefile @@ -10,7 +10,6 @@ require 'rake' require 'rspec/core/rake_task' -require 'rubocop/rake_task' require 'yard' require_relative 'lib/serpapi' @@ -49,9 +48,9 @@ RSpec::Core::RakeTask.new(:benchmark) do |t| t.rspec_opts = '--format documentation' end -RuboCop::RakeTask.new(:lint) do |t| - t.plugins << 'rubocop-rake' - t.options = ['--display-cop-names'] +desc 'run rubocop linter' +task :lint do + sh('rubocop --display-cop-names') end desc "format ruby code using rubocop" From 7cf9a02664e8fe595eb299c30c82fef4ca29fd8b Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Mon, 11 Aug 2025 22:59:16 -0500 Subject: [PATCH 10/12] update Ruby version in CI configuration to 2.7.8 and set Bundler version for compatibility --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 003b832..f8a1e3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ['2.7', '3.1.0','head'] # test only recommend Ruby version (and stable version on the gitaction server) + ruby: ['2.7.8', '3.1.0','head'] # test only recommend Ruby version (and stable version on the GitHub action server) steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + # Install Bundler 2.4.x for Ruby 2.7 + - name: Install Bundler 2.4.x for Ruby 2.7 + if: matrix.ruby == '2.7.8' + run: gem install bundler -v '~> 2.4' - name: install dependencies run: bundle install - name: lint From 53374b2dae69735a6db6979cf82f5ec260308562 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Mon, 11 Aug 2025 23:01:24 -0500 Subject: [PATCH 11/12] ruby 3.5 is not compatible with rubocop --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8a1e3c..e510af5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ['2.7.8', '3.1.0','head'] # test only recommend Ruby version (and stable version on the GitHub action server) + ruby: ['2.7.8', '3.1.0','3.4.4'] # test only recommend Ruby version (and stable version on the GitHub action server) steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 From 6b64a4834b734c5c8907250a8d275099be87a09b Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Mon, 11 Aug 2025 23:04:55 -0500 Subject: [PATCH 12/12] add panolint dependency, remote rubocop-rake requirement --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 027df79..a2231e1 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,8 @@ group :test, :development do gem 'yard', '~>0.9.28' # linter for ruby gem 'rubocop' - gem 'rubocop-rake', require: false # for rake tasks linting + gem 'panolint' + #gem 'rubocop-rake', require: false # for rake tasks linting # test for ruby gem 'rspec', '~>3.11' # code coverage to monitor rspec tests