Skip to content

Commit 1f8809f

Browse files
committed
updates gem dependencies
- adds changelog entry
1 parent dc5e4b0 commit 1f8809f

24 files changed

+119
-93
lines changed

.rubocop_todo.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-09-28 13:52:41 +0200 using RuboCop version 0.39.0.
3+
# on 2016-12-01 19:41:18 +0100 using RuboCop version 0.46.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 41
9+
# Offense count: 3
10+
# this must be removed for preparation of ruby 2.4
11+
Lint/UnifiedInteger:
12+
Exclude:
13+
- 'lib/grape/dsl/inside_route.rb'
14+
- 'spec/grape/validations/validators/allow_blank_spec.rb'
15+
16+
# Offense count: 44
1017
Metrics/AbcSize:
1118
Max: 44
1219

@@ -19,27 +26,27 @@ Metrics/BlockNesting:
1926
Metrics/ClassLength:
2027
Max: 279
2128

22-
# Offense count: 28
29+
# Offense count: 26
2330
Metrics/CyclomaticComplexity:
2431
Max: 14
2532

26-
# Offense count: 955
27-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
33+
# Offense count: 964
34+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
2835
# URISchemes: http, https
2936
Metrics/LineLength:
3037
Max: 215
3138

32-
# Offense count: 52
39+
# Offense count: 55
3340
# Configuration parameters: CountComments.
3441
Metrics/MethodLength:
3542
Max: 33
3643

37-
# Offense count: 8
44+
# Offense count: 9
3845
# Configuration parameters: CountComments.
3946
Metrics/ModuleLength:
4047
Max: 212
4148

42-
# Offense count: 18
49+
# Offense count: 17
4350
Metrics/PerceivedComplexity:
4451
Max: 14
4552

@@ -48,6 +55,7 @@ Style/Documentation:
4855
Enabled: false
4956

5057
# Offense count: 16
58+
# Cop supports --auto-correct.
5159
# Configuration parameters: EnforcedStyle, SupportedStyles.
5260
# SupportedStyles: compact, exploded
5361
Style/RaiseArgs:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Next Release
1414
* [#1512](https://github.com/ruby-grape/grape/pull/1512): Fix: deeply nested parameters are included within `#declared(params)` - [@krbs](https://github.com/krbs).
1515
* [#1510](https://github.com/ruby-grape/grape/pull/1510): Fix: inconsistent validation for multiple parameters - [@dgasper](https://github.com/dgasper).
1616
* [#1526](https://github.com/ruby-grape/grape/pull/1526): Reduce warnings caused by instance variables not initialized - [@cpetschnig](https://github.com/cpetschnig).
17+
* [#1531](https://github.com/ruby-grape/grape/pull/1531): Updates gem dependencies - [@LeFnord](https://github.com/LeFnord).
18+
1719

1820
0.18.0 (10/7/2016)
1921
==================

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gemspec
77
group :development, :test do
88
gem 'bundler'
99
gem 'rake'
10-
gem 'rubocop', '0.39.0'
10+
gem 'rubocop', '~> 0.40'
1111
end
1212

1313
group :development do
@@ -21,7 +21,7 @@ group :development do
2121
end
2222

2323
group :test do
24-
gem 'grape-entity', '0.5.0'
24+
gem 'grape-entity', '~> 0.6'
2525
gem 'maruku'
2626
gem 'rack-test'
2727
gem 'rspec', '~> 3.0'

lib/grape/dsl/helpers.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ def helpers(new_mod = nil, &block)
3131
mod = new_mod || Module.new
3232
define_boolean_in_mod(mod)
3333
inject_api_helpers_to_mod(mod) if new_mod
34-
inject_api_helpers_to_mod(mod) do
35-
mod.class_eval(&block)
36-
end if block_given?
34+
if block_given?
35+
inject_api_helpers_to_mod(mod) do
36+
mod.class_eval(&block)
37+
end
38+
end
3739

3840
namespace_stackable(:helpers, mod)
3941
else

lib/grape/dsl/parameters.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ def all_or_none_of(*attrs)
176176
# @yield a parameter definition DSL
177177
def given(*attrs, &block)
178178
attrs.each do |attr|
179-
attr_ = attr.is_a?(Hash) ? attr.keys[0] : attr
180-
raise Grape::Exceptions::UnknownParameter.new(attr_) unless declared_param?(attr_)
179+
proxy_attr = attr.is_a?(Hash) ? attr.keys[0] : attr
180+
raise Grape::Exceptions::UnknownParameter.new(proxy_attr) unless declared_param?(proxy_attr)
181181
end
182182
new_lateral_scope(dependent_on: attrs, &block)
183183
end

lib/grape/dsl/request_response.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@ def rescue_from(*args, &block)
110110
end
111111
handler ||= extract_with(options)
112112

113-
case
114-
when args.include?(:all)
113+
if args.include?(:all)
115114
namespace_inheritable(:rescue_all, true)
116115
namespace_inheritable :all_rescue_handler, handler
117-
when args.include?(:grape_exceptions)
116+
elsif args.include?(:grape_exceptions)
118117
namespace_inheritable(:rescue_all, true)
119118
namespace_inheritable(:rescue_grape_exceptions, true)
120119
else

lib/grape/dsl/routing.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,17 @@ def reset_endpoints!
200200
# @option options [Regexp] You may supply a regular expression that the declared parameter must meet.
201201
def route_param(param, options = {}, &block)
202202
options = options.dup
203-
options[:requirements] = {
204-
param.to_sym => options[:requirements]
205-
} if options[:requirements].is_a?(Regexp)
203+
if options[:requirements].is_a?(Regexp)
204+
options[:requirements] = {
205+
param.to_sym => options[:requirements]
206+
}
207+
end
206208

207-
Grape::Validations::ParamsScope.new(api: self) do
208-
requires param, type: options[:type]
209-
end if options.key?(:type)
209+
if options.key?(:type)
210+
Grape::Validations::ParamsScope.new(api: self) do
211+
requires param, type: options[:type]
212+
end
213+
end
210214
namespace(":#{param}", options, &block)
211215
end
212216

lib/grape/error_formatter/base.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ def present(message, env)
1515
# env['api.endpoint'].route does not work when the error occurs within a middleware
1616
# the Endpoint does not have a valid env at this moment
1717
http_codes = env[Grape::Env::GRAPE_ROUTING_ARGS][:route_info].http_codes || []
18-
found_code = http_codes.find do |http_code|
19-
(http_code[0].to_i == env[Grape::Env::API_ENDPOINT].status) && http_code[2].respond_to?(:represent)
20-
end if env[Grape::Env::API_ENDPOINT].request
18+
if env[Grape::Env::API_ENDPOINT].request
19+
found_code = http_codes.find do |http_code|
20+
(http_code[0].to_i == env[Grape::Env::API_ENDPOINT].status) && http_code[2].respond_to?(:represent)
21+
end
22+
end
2123

2224
presenter = found_code[2] if found_code
2325
end

lib/grape/middleware/base.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ def call!(env)
4545

4646
# @abstract
4747
# Called before the application is called in the middleware lifecycle.
48-
def before
49-
end
48+
def before; end
5049

5150
# @abstract
5251
# Called after the application is called in the middleware lifecycle.
5352
# @return [Response, nil] a Rack SPEC response or nil to call the application afterwards.
54-
def after
55-
end
53+
def after; end
5654

5755
def response
5856
return @app_response if @app_response.is_a?(Rack::Response)

lib/grape/middleware/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def rescuable_by_grape?(klass)
7070
end
7171

7272
def exec_handler(e, &handler)
73-
if handler.lambda? && handler.arity == 0
73+
if handler.lambda? && handler.arity.zero?
7474
instance_exec(&handler)
7575
else
7676
instance_exec(e, &handler)

0 commit comments

Comments
 (0)