Skip to content

Commit

Permalink
Fix rubocop issues, drop EOL ruby versions
Browse files Browse the repository at this point in the history
  • Loading branch information
inkstak committed Feb 21, 2024
1 parent 9ca7842 commit 882cfd7
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [ '2.7', '3.0', '3.1', '3.2', head ]
ruby-version: [ '3.0', '3.1', '3.2', '3.3', 'head' ]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ inherit_gem:
- config/ruby-3.0.yml

AllCops:
# Last supported version before EOL
# See: https://endoflife.date/ruby
TargetRubyVersion: 3.0
NewCops: enable
Exclude:
Expand Down
4 changes: 4 additions & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Last supported version before EOL
# See: https://endoflife.date/ruby
ruby_version: 3.0
format: progress
8 changes: 2 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
require "bundler/gem_tasks"
require "appraisal"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require "standard/rake"

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new

desc "Run the full CI"
task :default do
if ENV["APPRAISAL_INITIALIZED"]
RSpec::Core::RakeTask.new(:spec)
Rake::Task["spec"].invoke
else
# FYI: Standard & appraisal requires each a spawn process.
Expand All @@ -26,6 +22,6 @@ task :default do

fail unless system "bundle exec appraisal rspec"
fail unless system "bundle exec rubocop"
fail unless system "bundle exec rake standard"
fail unless system "bundle exec standardrb"
end
end
4 changes: 2 additions & 2 deletions lib/caoutsearch/model/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def index_with(index_class)
end

module ClassMethods
def reindex(*properties, **options, &block)
index_engine_class.reindex(all, *properties, **options, &block)
def reindex(...)
index_engine_class.reindex(all, ...)
end

def delete_indexes
Expand Down
12 changes: 6 additions & 6 deletions lib/caoutsearch/search/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ module Callbacks
end

class_methods do
def before_build(*filters, &blk)
set_callback(:build, :before, *filters, &blk)
def before_build(...)
set_callback(:build, :before, ...)
end

def after_build(*filters, &blk)
set_callback(:build, :after, *filters, &blk)
def after_build(...)
set_callback(:build, :after, ...)
end

def around_build(*filters, &blk)
set_callback(:build, :around, *filters, &blk)
def around_build(...)
set_callback(:build, :around, ...)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/caoutsearch/search/dsl/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def inspect

def properties_to_inspect
PROPERTIES_TO_INSPECT.each_with_object({}) do |name, properties|
value = instance_variable_get("@#{name}")
value = instance_variable_get(:"@#{name}")
properties[name] = value.inspect if value.present?
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/caoutsearch/search/inspect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def inspect

def properties_to_inspect
PROPERTIES_TO_INSPECT.each_with_object({}) do |name, properties|
value = instance_variable_get("@#{name}")
value = instance_variable_get(:"@#{name}")
properties[name] = value.inspect if value
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/caoutsearch/search/batch_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe Caoutsearch::Search::BatchMethods, active_record: true do
RSpec.describe Caoutsearch::Search::BatchMethods, :active_record do
let(:search_class) { stub_search_class("SampleSearch") }
let(:search) { search_class.new }
let(:records) { Array.new(12) { Sample.create } }
Expand Down
2 changes: 1 addition & 1 deletion spec/caoutsearch/search/records_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe Caoutsearch::Search::Records, active_record: true do
RSpec.describe Caoutsearch::Search::Records, :active_record do
let!(:search) { search_class.new }
let!(:search_class) { stub_search_class("SampleSearch") }

Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
expect.syntax = :expect
end

config.before :context, active_record: true do
config.before :context, :active_record do
require "database_cleaner/active_record"
require "active_record"

Expand All @@ -47,7 +47,7 @@
DatabaseCleaner.cleaning { example.run }
end

config.after :context, active_record: true do
config.after :context, :active_record do
ActiveRecord::Schema.define do
suppress_messages do
drop_table :samples
Expand Down

0 comments on commit 882cfd7

Please sign in to comment.