Skip to content

Commit 8c3fb89

Browse files
authored
updates dependencies (#645)
1 parent 9ba0f33 commit 8c3fb89

11 files changed

+31
-52
lines changed

.rubocop.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Metrics/BlockLength:
1414
- spec/**/*
1515

1616
Metrics/LineLength:
17+
Max: 120
1718
Exclude:
1819
- spec/**/*
1920

.rubocop_todo.yml

+16-30
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,53 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-11-24 18:42:08 +0800 using RuboCop version 0.45.0.
3+
# on 2017-11-03 11:12:36 +0100 using RuboCop version 0.50.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: 29
9+
# Offense count: 30
1010
Metrics/AbcSize:
1111
Max: 56
1212

13-
# Offense count: 1
14-
# Configuration parameters: CountComments.
15-
Metrics/BlockLength:
16-
Max: 29
17-
1813
# Offense count: 3
1914
# Configuration parameters: CountComments.
2015
Metrics/ClassLength:
2116
Max: 280
2217

23-
# Offense count: 12
18+
# Offense count: 10
2419
Metrics/CyclomaticComplexity:
25-
Max: 15
26-
27-
# Offense count: 129
28-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
29-
# URISchemes: http, https
30-
Metrics/LineLength:
31-
Max: 120
20+
Max: 13
3221

33-
# Offense count: 35
22+
# Offense count: 20
3423
# Configuration parameters: CountComments.
3524
Metrics/MethodLength:
3625
Max: 40
3726

38-
# Offense count: 7
27+
# Offense count: 6
3928
Metrics/PerceivedComplexity:
40-
Max: 16
29+
Max: 14
4130

4231
# Offense count: 3
4332
Style/ClassVars:
4433
Exclude:
4534
- 'lib/grape-swagger/doc_methods.rb'
4635

47-
# Offense count: 23
36+
# Offense count: 20
4837
Style/Documentation:
4938
Enabled: false
5039

51-
Style/MixinGrouping:
52-
Exclude:
53-
- spec/**/*
54-
55-
# Offense count: 1
56-
# Cop supports --auto-correct.
57-
Style/MultilineIfModifier:
58-
Exclude:
59-
- 'lib/grape-swagger/grape/route.rb'
60-
61-
# Offense count: 5
40+
# Offense count: 4
6241
# Cop supports --auto-correct.
6342
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
6443
# SupportedStyles: slashes, percent_r, mixed
6544
Style/RegexpLiteral:
6645
Exclude:
6746
- 'lib/grape-swagger.rb'
47+
48+
# Offense count: 1
49+
# Cop supports --auto-correct.
50+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil.
51+
Style/SafeNavigation:
52+
Exclude:
53+
- 'lib/grape-swagger/doc_methods/build_model_definition.rb'

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ before_install:
77
- gem install bundler
88

99
after_success:
10+
- coveralls
1011
- bundle exec danger
1112

1213
rvm:
13-
- 2.4.1
14-
- 2.3.4
14+
- 2.4.2
15+
- 2.3.5
1516

1617
env:
1718
- MODEL_PARSER=grape-swagger-entity
@@ -27,7 +28,7 @@ matrix:
2728
fast_finish: true
2829

2930
include:
30-
- rvm: 2.2.7
31+
- rvm: 2.2.8
3132
env:
3233
- rvm: ruby-head
3334
env:
@@ -37,6 +38,7 @@ matrix:
3738
env:
3839

3940
allow_failures:
41+
- rvm: 2.2.8
4042
- rvm: ruby-head
4143
- rvm: jruby-head
4244
- rvm: rbx-2

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ group :development, :test do
2525
gem 'rake'
2626
gem 'rdoc'
2727
gem 'rspec', '~> 3.0'
28-
gem 'rubocop', '~> 0.49.1'
28+
gem 'rubocop', '~>0.51', require: false
2929
end
3030

3131
group :test do

Rakefile

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# encoding: utf-8
21
# frozen_string_literal: true
32

43
require 'rubygems'

lib/grape-swagger.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def add_swagger_documentation(options = {})
2929
version_for(options)
3030
options = { target_class: self }.merge(options)
3131
@target_class = options[:target_class]
32-
auth_wrapper = options[:endpoint_auth_wrapper]
32+
auth_wrapper = options[:endpoint_auth_wrapper] || Class.new
3333

34-
if auth_wrapper && auth_wrapper.method_defined?(:before) && !middleware.flatten.include?(auth_wrapper)
34+
if auth_wrapper.method_defined?(:before) && !middleware.flatten.include?(auth_wrapper)
3535
use auth_wrapper
3636
end
3737

@@ -102,7 +102,7 @@ def determine_namespaced_routes(name, parent_route)
102102

103103
def combine_namespace_routes(namespaces)
104104
# iterate over each single namespace
105-
namespaces.each do |name, _|
105+
namespaces.each_key do |name, _|
106106
# get the parent route for the namespace
107107
parent_route_name = extract_parent_route(name)
108108
parent_route = @target_class.combined_routes[parent_route_name]

lib/grape-swagger/doc_methods/extensions.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def add_extension_to(part, extensions)
6868
def concatenate(extensions)
6969
result = {}
7070

71-
extensions.values.each do |extension|
71+
extensions.each_value do |extension|
7272
extension.each do |key, value|
7373
result["x-#{key}"] = value
7474
end

lib/grape-swagger/endpoint.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def contact_object(infos)
7777
def path_and_definition_objects(namespace_routes, options)
7878
@paths = {}
7979
@definitions = {}
80-
namespace_routes.keys.each do |key|
80+
namespace_routes.each_key do |key|
8181
routes = namespace_routes[key]
8282
path_item(routes, options)
8383
end
@@ -163,7 +163,7 @@ def produces_object(route, format)
163163

164164
def consumes_object(route, format)
165165
method = route.request_method.downcase.to_sym
166-
if route.settings[:description] && route.settings[:description][:consumes]
166+
if route.settings.dig(:description, :consumes)
167167
format = route.settings[:description][:consumes]
168168
end
169169
mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format) if %i[post put].include?(method)
@@ -332,7 +332,7 @@ def expose_params_from_model(model)
332332
raise GrapeSwagger::Errors::UnregisteredParser, "No parser registered for #{model_name}." unless parser
333333

334334
properties = parser.new(model, self).call
335-
unless properties && properties.any?
335+
unless properties&.any?
336336
raise GrapeSwagger::Errors::SwaggerSpec,
337337
"Empty model #{model_name}, swagger 2.0 doesn't support empty definitions."
338338
end

spec/issues/403_versions_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# encoding: utf-8
21
# frozen_string_literal: true
32

43
require 'spec_helper'

spec/swagger_v2/api_swagger_v2_mounted_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def app
131131

132132
specify do
133133
unexpected_paths = mounted_paths - [expected_path]
134-
subject.keys.each do |path|
134+
subject.each_key do |path|
135135
unexpected_paths.each do |unexpected_path|
136136
expect(path).not_to start_with unexpected_path
137137
end

spec/swagger_v2/guarded_endpoint_spec.rb

-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ def protected_endpoint?
1414
@protected_endpoint || false
1515
end
1616

17-
def access_token
18-
@_access_token
19-
end
20-
21-
def access_token=(token)
22-
@_access_token = token
23-
end
24-
2517
def resource_owner
2618
@resource_owner = true if access_token == '12345'
2719
end

0 commit comments

Comments
 (0)