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/**/*
Metrics/LineLength:
Max: 120
Exclude:
- spec/**/*

View File

@ -1,67 +1,53 @@
# This configuration was generated by
# `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
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 29
# Offense count: 30
Metrics/AbcSize:
Max: 56
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/BlockLength:
Max: 29
# Offense count: 3
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 280
# Offense count: 12
# Offense count: 10
Metrics/CyclomaticComplexity:
Max: 15
Max: 13
# Offense count: 129
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
# URISchemes: http, https
Metrics/LineLength:
Max: 120
# Offense count: 35
# Offense count: 20
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 40
# Offense count: 7
# Offense count: 6
Metrics/PerceivedComplexity:
Max: 16
Max: 14
# Offense count: 3
Style/ClassVars:
Exclude:
- 'lib/grape-swagger/doc_methods.rb'
# Offense count: 23
# Offense count: 20
Style/Documentation:
Enabled: false
Style/MixinGrouping:
Exclude:
- spec/**/*
# Offense count: 1
# Cop supports --auto-correct.
Style/MultilineIfModifier:
Exclude:
- 'lib/grape-swagger/grape/route.rb'
# Offense count: 5
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- '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
after_success:
- coveralls
- bundle exec danger
rvm:
- 2.4.1
- 2.3.4
- 2.4.2
- 2.3.5
env:
- MODEL_PARSER=grape-swagger-entity
@ -27,7 +28,7 @@ matrix:
fast_finish: true
include:
- rvm: 2.2.7
- rvm: 2.2.8
env:
- rvm: ruby-head
env:
@ -37,6 +38,7 @@ matrix:
env:
allow_failures:
- rvm: 2.2.8
- rvm: ruby-head
- rvm: jruby-head
- rvm: rbx-2

View File

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

View File

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

View File

@ -29,9 +29,9 @@ module Grape
version_for(options)
options = { target_class: self }.merge(options)
@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
end
@ -102,7 +102,7 @@ module Grape
def combine_namespace_routes(namespaces)
# iterate over each single namespace
namespaces.each do |name, _|
namespaces.each_key do |name, _|
# get the parent route for the namespace
parent_route_name = extract_parent_route(name)
parent_route = @target_class.combined_routes[parent_route_name]

View File

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

View File

@ -77,7 +77,7 @@ module Grape
def path_and_definition_objects(namespace_routes, options)
@paths = {}
@definitions = {}
namespace_routes.keys.each do |key|
namespace_routes.each_key do |key|
routes = namespace_routes[key]
path_item(routes, options)
end
@ -163,7 +163,7 @@ module Grape
def consumes_object(route, format)
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]
end
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
properties = parser.new(model, self).call
unless properties && properties.any?
unless properties&.any?
raise GrapeSwagger::Errors::SwaggerSpec,
"Empty model #{model_name}, swagger 2.0 doesn't support empty definitions."
end

View File

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

View File

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

View File

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