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 9f672c6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ Naming:

# Style stuff
#
Style/ArgumentsForwarding:
# disabled because this breaks on Ruby < 3.2
Enabled: false

Style/Documentation:
Enabled: 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
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 9f672c6

Please sign in to comment.