updates dependencies (#645)

This commit is contained in:
peter scholz 2017-11-03 22:40:09 +01:00 committed by GitHub
parent 9ba0f3356a
commit 8c3fb898a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 31 additions and 52 deletions

View File

@ -14,6 +14,7 @@ Metrics/BlockLength:
- spec/**/* - spec/**/*
Metrics/LineLength: Metrics/LineLength:
Max: 120
Exclude: Exclude:
- spec/**/* - spec/**/*

View File

@ -1,67 +1,53 @@
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2016-11-24 18:42:08 +0800 using RuboCop version 0.45.0. # on 2017-11-03 11:12:36 +0100 using RuboCop version 0.50.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 29 # Offense count: 30
Metrics/AbcSize: Metrics/AbcSize:
Max: 56 Max: 56
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/BlockLength:
Max: 29
# Offense count: 3 # Offense count: 3
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/ClassLength: Metrics/ClassLength:
Max: 280 Max: 280
# Offense count: 12 # Offense count: 10
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Max: 15 Max: 13
# Offense count: 129 # Offense count: 20
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
# URISchemes: http, https
Metrics/LineLength:
Max: 120
# Offense count: 35
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/MethodLength: Metrics/MethodLength:
Max: 40 Max: 40
# Offense count: 7 # Offense count: 6
Metrics/PerceivedComplexity: Metrics/PerceivedComplexity:
Max: 16 Max: 14
# Offense count: 3 # Offense count: 3
Style/ClassVars: Style/ClassVars:
Exclude: Exclude:
- 'lib/grape-swagger/doc_methods.rb' - 'lib/grape-swagger/doc_methods.rb'
# Offense count: 23 # Offense count: 20
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false
Style/MixinGrouping: # Offense count: 4
Exclude:
- spec/**/*
# Offense count: 1
# Cop supports --auto-correct.
Style/MultilineIfModifier:
Exclude:
- 'lib/grape-swagger/grape/route.rb'
# Offense count: 5
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed # SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral: Style/RegexpLiteral:
Exclude: Exclude:
- 'lib/grape-swagger.rb' - 'lib/grape-swagger.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: ConvertCodeThatCanStartToReturnNil.
Style/SafeNavigation:
Exclude:
- 'lib/grape-swagger/doc_methods/build_model_definition.rb'

View File

@ -7,11 +7,12 @@ before_install:
- gem install bundler - gem install bundler
after_success: after_success:
- coveralls
- bundle exec danger - bundle exec danger
rvm: rvm:
- 2.4.1 - 2.4.2
- 2.3.4 - 2.3.5
env: env:
- MODEL_PARSER=grape-swagger-entity - MODEL_PARSER=grape-swagger-entity
@ -27,7 +28,7 @@ matrix:
fast_finish: true fast_finish: true
include: include:
- rvm: 2.2.7 - rvm: 2.2.8
env: env:
- rvm: ruby-head - rvm: ruby-head
env: env:
@ -37,6 +38,7 @@ matrix:
env: env:
allow_failures: allow_failures:
- rvm: 2.2.8
- rvm: ruby-head - rvm: ruby-head
- rvm: jruby-head - rvm: jruby-head
- rvm: rbx-2 - rvm: rbx-2

View File

@ -25,7 +25,7 @@ group :development, :test do
gem 'rake' gem 'rake'
gem 'rdoc' gem 'rdoc'
gem 'rspec', '~> 3.0' gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 0.49.1' gem 'rubocop', '~>0.51', require: false
end end
group :test do group :test do

View File

@ -1,4 +1,3 @@
# encoding: utf-8
# frozen_string_literal: true # frozen_string_literal: true
require 'rubygems' require 'rubygems'

View File

@ -29,9 +29,9 @@ module Grape
version_for(options) version_for(options)
options = { target_class: self }.merge(options) options = { target_class: self }.merge(options)
@target_class = options[:target_class] @target_class = options[:target_class]
auth_wrapper = options[:endpoint_auth_wrapper] auth_wrapper = options[:endpoint_auth_wrapper] || Class.new
if auth_wrapper && auth_wrapper.method_defined?(:before) && !middleware.flatten.include?(auth_wrapper) if auth_wrapper.method_defined?(:before) && !middleware.flatten.include?(auth_wrapper)
use auth_wrapper use auth_wrapper
end end
@ -102,7 +102,7 @@ module Grape
def combine_namespace_routes(namespaces) def combine_namespace_routes(namespaces)
# iterate over each single namespace # iterate over each single namespace
namespaces.each do |name, _| namespaces.each_key do |name, _|
# get the parent route for the namespace # get the parent route for the namespace
parent_route_name = extract_parent_route(name) parent_route_name = extract_parent_route(name)
parent_route = @target_class.combined_routes[parent_route_name] parent_route = @target_class.combined_routes[parent_route_name]

View File

@ -68,7 +68,7 @@ module GrapeSwagger
def concatenate(extensions) def concatenate(extensions)
result = {} result = {}
extensions.values.each do |extension| extensions.each_value do |extension|
extension.each do |key, value| extension.each do |key, value|
result["x-#{key}"] = value result["x-#{key}"] = value
end end

View File

@ -77,7 +77,7 @@ module Grape
def path_and_definition_objects(namespace_routes, options) def path_and_definition_objects(namespace_routes, options)
@paths = {} @paths = {}
@definitions = {} @definitions = {}
namespace_routes.keys.each do |key| namespace_routes.each_key do |key|
routes = namespace_routes[key] routes = namespace_routes[key]
path_item(routes, options) path_item(routes, options)
end end
@ -163,7 +163,7 @@ module Grape
def consumes_object(route, format) def consumes_object(route, format)
method = route.request_method.downcase.to_sym method = route.request_method.downcase.to_sym
if route.settings[:description] && route.settings[:description][:consumes] if route.settings.dig(:description, :consumes)
format = route.settings[:description][:consumes] format = route.settings[:description][:consumes]
end end
mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format) if %i[post put].include?(method) mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format) if %i[post put].include?(method)
@ -332,7 +332,7 @@ module Grape
raise GrapeSwagger::Errors::UnregisteredParser, "No parser registered for #{model_name}." unless parser raise GrapeSwagger::Errors::UnregisteredParser, "No parser registered for #{model_name}." unless parser
properties = parser.new(model, self).call properties = parser.new(model, self).call
unless properties && properties.any? unless properties&.any?
raise GrapeSwagger::Errors::SwaggerSpec, raise GrapeSwagger::Errors::SwaggerSpec,
"Empty model #{model_name}, swagger 2.0 doesn't support empty definitions." "Empty model #{model_name}, swagger 2.0 doesn't support empty definitions."
end end

View File

@ -1,4 +1,3 @@
# encoding: utf-8
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'spec_helper'

View File

@ -131,7 +131,7 @@ describe 'swagger spec v2.0' do
specify do specify do
unexpected_paths = mounted_paths - [expected_path] unexpected_paths = mounted_paths - [expected_path]
subject.keys.each do |path| subject.each_key do |path|
unexpected_paths.each do |unexpected_path| unexpected_paths.each do |unexpected_path|
expect(path).not_to start_with unexpected_path expect(path).not_to start_with unexpected_path
end end

View File

@ -14,14 +14,6 @@ class SampleAuth < Grape::Middleware::Base
@protected_endpoint || false @protected_endpoint || false
end end
def access_token
@_access_token
end
def access_token=(token)
@_access_token = token
end
def resource_owner def resource_owner
@resource_owner = true if access_token == '12345' @resource_owner = true if access_token == '12345'
end end