Skip to content

Commit

Permalink
Autocorrect rubocop since running on ruby 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ericproulx committed Dec 19, 2023
1 parent bd6feed commit 289d945
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
14 changes: 0 additions & 14 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ Naming/VariableNumber:
- 'spec/grape/exceptions/validation_errors_spec.rb'
- 'spec/grape/validations_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Performance/BindCall:
Exclude:
- 'lib/grape/endpoint.rb'

# Offense count: 4
RSpec/AnyInstance:
Exclude:
Expand Down Expand Up @@ -606,14 +600,6 @@ RSpec/VoidExpect:
- 'spec/grape/api_spec.rb'
- 'spec/grape/dsl/headers_spec.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowOnlyRestArgument.
Style/ArgumentsForwarding:
Exclude:
- 'lib/grape/api.rb'
- 'lib/grape/endpoint.rb'

# Offense count: 1
Style/CombinableLoops:
Exclude:
Expand Down
8 changes: 4 additions & 4 deletions lib/grape/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class << self
attr_accessor :base_instance, :instances

# Rather than initializing an object of type Grape::API, create an object of type Instance
def new(*args, &block)
base_instance.new(*args, &block)
def new(...)
base_instance.new(...)
end

# When inherited, will create a list of all instances (times the API was mounted)
Expand Down Expand Up @@ -77,8 +77,8 @@ def configure
# the headers, and the body. See [the rack specification]
# (http://www.rubydoc.info/github/rack/rack/master/file/SPEC) for more.
# NOTE: This will only be called on an API directly mounted on RACK
def call(*args, &block)
instance_for_rack.call(*args, &block)
def call(...)
instance_for_rack.call(...)
end

# Alleviates problems with autoloading by tring to search for the constant
Expand Down
6 changes: 3 additions & 3 deletions lib/grape/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Endpoint
attr_reader :env, :request, :headers, :params

class << self
def new(*args, &block)
self == Endpoint ? Class.new(Endpoint).new(*args, &block) : super
def new(...)
self == Endpoint ? Class.new(Endpoint).new(...) : super
end

def before_each(new_setup = false, &block)
Expand Down Expand Up @@ -55,7 +55,7 @@ def generate_api_method(method_name, &block)

proc do |endpoint_instance|
ActiveSupport::Notifications.instrument('endpoint_render.grape', endpoint: endpoint_instance) do
method.bind(endpoint_instance).call
method.bind_call(endpoint_instance)
end
end
end
Expand Down

0 comments on commit 289d945

Please sign in to comment.