Skip to content

Commit

Permalink
Autocorrect Rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
magni- committed Dec 13, 2023
1 parent e45fcc8 commit be5253f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AllCops:
- vendor/**/*
- example/**/*
NewCops: enable
TargetRubyVersion: 3.2
TargetRubyVersion: 3.0
SuggestExtensions: false

# Layout stuff
Expand Down
4 changes: 2 additions & 2 deletions lib/grape_entity/condition/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module Grape
class Entity
module Condition
class Base
def self.new(inverse, *args, &block)
super(inverse).tap { |e| e.setup(*args, &block) }
def self.new(inverse, ...)
super(inverse).tap { |e| e.setup(...) }
end

def initialize(inverse = false)
Expand Down
4 changes: 2 additions & 2 deletions lib/grape_entity/entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,10 @@ def self.merge_options(options)
if existing_val.is_a?(Hash) && new_val.is_a?(Hash)
existing_val.merge(new_val)
elsif new_val.is_a?(Hash)
(opts["#{key}_extras".to_sym] ||= []) << existing_val
(opts[:"#{key}_extras"] ||= []) << existing_val
new_val
else
(opts["#{key}_extras".to_sym] ||= []) << new_val
(opts[:"#{key}_extras"] ||= []) << new_val
existing_val
end
else
Expand Down
4 changes: 2 additions & 2 deletions lib/grape_entity/exposure/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module Exposure
class Base
attr_reader :attribute, :is_safe, :documentation, :override, :conditions, :for_merge

def self.new(attribute, options, conditions, *args, &block)
super(attribute, options, conditions).tap { |e| e.setup(*args, &block) }
def self.new(attribute, options, conditions, ...)
super(attribute, options, conditions).tap { |e| e.setup(...) }
end

def initialize(attribute, options, conditions)
Expand Down
8 changes: 5 additions & 3 deletions spec/grape_entity/entity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@

it 'makes sure that :format_with as a proc cannot be used with a block' do
# rubocop:disable Style/BlockDelimiters
# rubocop:disable Lint/Debugger
expect { subject.expose :name, format_with: proc {} do p 'hi' end }.to raise_error ArgumentError
# rubocop:enable Lint/Debugger
expect {
subject.expose :name, format_with: proc {} do
p 'hi'
end
}.to raise_error ArgumentError
# rubocop:enable Style/BlockDelimiters
end

Expand Down

0 comments on commit be5253f

Please sign in to comment.