From 4d9e3a7f64820d57d97878ab8e311feac8c4e08b Mon Sep 17 00:00:00 2001 From: Jan Graichen Date: Thu, 18 Apr 2024 15:27:05 +0200 Subject: [PATCH] chore: Upgrade rubocop linting --- .rubocop.yml | 5 +---- Appraisals | 9 +++++---- Gemfile | 2 +- gemfiles/rails_6_1.gemfile | 2 +- gemfiles/rails_7_0.gemfile | 2 +- gemfiles/rails_7_1.gemfile | 2 +- gemfiles/rails_head.gemfile | 2 +- lib/paginate-responder/base.rb | 2 +- lib/paginate-responder/pagy_adapter.rb | 2 +- lib/paginate-responder/version.rb | 2 +- paginate-responder.gemspec | 1 - 11 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 4b7562f..1a48b75 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ # inherit_gem: - my-rubocop: default.yml + rubocop-config: default.yml AllCops: TargetRubyVersion: 2.5 @@ -10,6 +10,3 @@ AllCops: Naming/FileName: Exclude: - lib/paginate-responder.rb - -RSpec/MultipleMemoizedHelpers: - Max: 10 # Defaults to 5 o_O diff --git a/Appraisals b/Appraisals index faf1457..5d7c80c 100644 --- a/Appraisals +++ b/Appraisals @@ -1,16 +1,17 @@ +# frozen_string_literal: true -appraise "rails-6-1" do +appraise 'rails-6-1' do gem 'rails', '~> 6.1.0' end -appraise "rails-7-0" do +appraise 'rails-7-0' do gem 'rails', '~> 7.0.0' end -appraise "rails-7-1" do +appraise 'rails-7-1' do gem 'rails', '~> 7.1.0' end -appraise "rails-head" do +appraise 'rails-head' do gem 'rails', github: 'rails/rails' end diff --git a/Gemfile b/Gemfile index 4442edf..18600f4 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem 'sqlite3', '~> 1.4' # Rails does NOT accept 2.0 gem 'rspec' gem 'rspec-rails' -gem 'my-rubocop', github: 'jgraichen/my-rubocop', ref: 'v3' +gem 'rubocop-config', github: 'jgraichen/rubocop-config', ref: 'v11' group :development do gem 'appraisal' diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index 6d862af..de6a11f 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -10,7 +10,7 @@ gem "activerecord", ">= 3.2.0" gem "sqlite3", "~> 1.4" gem "rspec" gem "rspec-rails" -gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3" +gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v11" gem "rails", "~> 6.1.0" group :development do diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile index 5a3f7b5..18697b3 100644 --- a/gemfiles/rails_7_0.gemfile +++ b/gemfiles/rails_7_0.gemfile @@ -10,7 +10,7 @@ gem "activerecord", ">= 3.2.0" gem "sqlite3", "~> 1.4" gem "rspec" gem "rspec-rails" -gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3" +gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v11" gem "rails", "~> 7.0.0" group :development do diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile index 591f451..eb66386 100644 --- a/gemfiles/rails_7_1.gemfile +++ b/gemfiles/rails_7_1.gemfile @@ -10,7 +10,7 @@ gem "activerecord", ">= 3.2.0" gem "sqlite3", "~> 1.4" gem "rspec" gem "rspec-rails" -gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3" +gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v11" gem "rails", "~> 7.1.0" group :development do diff --git a/gemfiles/rails_head.gemfile b/gemfiles/rails_head.gemfile index 4b16f2c..a61ddd1 100644 --- a/gemfiles/rails_head.gemfile +++ b/gemfiles/rails_head.gemfile @@ -10,7 +10,7 @@ gem "activerecord", ">= 3.2.0" gem "sqlite3", "~> 1.4" gem "rspec" gem "rspec-rails" -gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3" +gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v11" gem "rails", github: "rails/rails" group :development do diff --git a/lib/paginate-responder/base.rb b/lib/paginate-responder/base.rb index 5596367..baf5b17 100644 --- a/lib/paginate-responder/base.rb +++ b/lib/paginate-responder/base.rb @@ -70,7 +70,7 @@ def per_page if val < 1 1 else - val > max_per_page ? max_per_page : val + [val, max_per_page].min end end end diff --git a/lib/paginate-responder/pagy_adapter.rb b/lib/paginate-responder/pagy_adapter.rb index 70b0f5f..5491df0 100644 --- a/lib/paginate-responder/pagy_adapter.rb +++ b/lib/paginate-responder/pagy_adapter.rb @@ -7,7 +7,7 @@ module PaginateResponder class PagyAdapter < Base def paginate self.pagy, self.pagy_resource = controller.send(self.class.pagy_method(resource), resource, page: page, -items: per_page,) + items: per_page,) pagy_resource end diff --git a/lib/paginate-responder/version.rb b/lib/paginate-responder/version.rb index 21d6166..083ae90 100644 --- a/lib/paginate-responder/version.rb +++ b/lib/paginate-responder/version.rb @@ -8,7 +8,7 @@ module VERSION STAGE = nil def self.to_s - [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join '.' + [MAJOR, MINOR, PATCH, STAGE].compact.join '.' end end end diff --git a/paginate-responder.gemspec b/paginate-responder.gemspec index f9649dd..d77483f 100644 --- a/paginate-responder.gemspec +++ b/paginate-responder.gemspec @@ -21,7 +21,6 @@ Gem::Specification.new do |gem| gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) gem.executables = gem.files.grep(%r{^bin/}).map {|f| File.basename(f) } - gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] gem.required_ruby_version = '>= 2.5.0'