Skip to content

Commit 06a0a01

Browse files
committed
Merge pull request #1374 from dblock/rubocop-0.39.0
Fixed build and upgraded to Rubocop 0.39.0.
2 parents 044dad7 + 77b47c4 commit 06a0a01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+332
-261
lines changed

.rubocop_todo.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-03-14 21:22:57 +0300 using RuboCop version 0.35.1.
3+
# on 2016-04-26 16:12:14 -0400 using RuboCop version 0.39.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

99
# Offense count: 1
10-
Lint/NestedMethodDefinition:
10+
Lint/IneffectiveAccessModifier:
1111
Exclude:
12-
- 'lib/grape/util/strict_hash_configuration.rb'
12+
- 'lib/grape/router.rb'
1313

1414
# Offense count: 39
1515
Metrics/AbcSize:
@@ -19,29 +19,30 @@ Metrics/AbcSize:
1919
Metrics/BlockNesting:
2020
Max: 4
2121

22-
# Offense count: 6
22+
# Offense count: 7
2323
# Configuration parameters: CountComments.
2424
Metrics/ClassLength:
25-
Max: 281
25+
Max: 267
2626

2727
# Offense count: 24
2828
Metrics/CyclomaticComplexity:
2929
Max: 14
3030

31-
# Offense count: 853
32-
# Configuration parameters: AllowURI, URISchemes.
31+
# Offense count: 871
32+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
33+
# URISchemes: http, https
3334
Metrics/LineLength:
3435
Max: 215
3536

36-
# Offense count: 48
37+
# Offense count: 49
3738
# Configuration parameters: CountComments.
3839
Metrics/MethodLength:
39-
Max: 36
40+
Max: 34
4041

41-
# Offense count: 8
42+
# Offense count: 7
4243
# Configuration parameters: CountComments.
4344
Metrics/ModuleLength:
44-
Max: 277
45+
Max: 212
4546

4647
# Offense count: 15
4748
Metrics/PerceivedComplexity:
@@ -50,6 +51,10 @@ Metrics/PerceivedComplexity:
5051
# Offense count: 44
5152
# Cop supports --auto-correct.
5253
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
54+
# SupportedStyles: line_count_based, semantic, braces_for_chaining
55+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
56+
# FunctionalMethods: let, let!, subject, watch
57+
# IgnoredMethods: lambda, proc, it
5358
Style/BlockDelimiters:
5459
Exclude:
5560
- 'spec/grape/api_spec.rb'
@@ -58,7 +63,6 @@ Style/BlockDelimiters:
5863
- 'spec/grape/request_spec.rb'
5964

6065
# Offense count: 111
61-
# Configuration parameters: Exclude.
6266
Style/Documentation:
6367
Enabled: false
6468

@@ -70,7 +74,14 @@ Style/DoubleNegation:
7074
- 'lib/grape/middleware/versioner/header.rb'
7175
- 'lib/grape/path.rb'
7276

77+
# Offense count: 1
78+
# Configuration parameters: MinBodyLength.
79+
Style/GuardClause:
80+
Exclude:
81+
- 'lib/grape/endpoint.rb'
82+
7383
# Offense count: 14
7484
# Configuration parameters: EnforcedStyle, SupportedStyles.
85+
# SupportedStyles: compact, exploded
7586
Style/RaiseArgs:
7687
Enabled: false

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ gemfile:
2323
- gemfiles/rails_3.gemfile
2424
- gemfiles/rails_4.gemfile
2525
- gemfiles/rack_1.5.2.gemfile
26+
27+
bundler_args: --without development

Gemfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
1+
# when changing this file, run appraisal install ; rubocop -a gemfiles/*.gemfile
2+
13
source 'https://rubygems.org'
24

35
gemspec
46

57
group :development, :test do
8+
gem 'bundler'
9+
gem 'rake'
10+
gem 'rubocop', '0.39.0'
11+
end
12+
13+
group :development do
614
gem 'guard'
715
gem 'guard-rspec'
816
gem 'guard-rubocop'
17+
gem 'yard'
18+
gem 'appraisal'
19+
gem 'benchmark-ips'
20+
gem 'redcarpet'
21+
end
22+
23+
group :test do
24+
gem 'grape-entity', '0.5.0'
25+
gem 'maruku'
26+
gem 'rack-test'
27+
gem 'rspec', '~> 3.0'
28+
gem 'cookiejar'
29+
gem 'rack-contrib'
30+
gem 'mime-types', '< 3.0'
931
end

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,7 @@ module API
23162316
expose :text, documentation: { type: 'string', desc: 'Status update text.' }
23172317
expose :ip, if: { type: :full }
23182318
expose :user_type, :user_id, if: ->(status, options) { status.user.public? }
2319-
expose :digest do |status, options|
2319+
expose :digest do |status, options|
23202320
Digest::MD5.hexdigest(status.txt)
23212321
end
23222322
expose :replies, using: API::Status, as: :replies

Rakefile

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,47 @@ RuboCop::RakeTask.new
2323

2424
task default: [:rubocop, :spec]
2525

26-
require 'yard'
27-
DOC_FILES = ['lib/**/*.rb', 'README.md']
26+
begin
27+
require 'yard'
28+
DOC_FILES = ['lib/**/*.rb', 'README.md'].freeze
2829

29-
YARD::Rake::YardocTask.new(:doc) do |t|
30-
t.files = DOC_FILES
31-
end
32-
33-
namespace :doc do
34-
YARD::Rake::YardocTask.new(:pages) do |t|
35-
t.files = DOC_FILES
36-
t.options = ['-o', '../grape.doc/docs']
30+
YARD::Rake::YardocTask.new(:doc) do |t|
31+
t.files = DOC_FILES
3732
end
3833

39-
namespace :pages do
40-
desc 'Check out gh-pages.'
41-
task :checkout do
42-
dir = File.dirname(__FILE__) + '/../grape.doc'
43-
unless Dir.exist?(dir)
44-
Dir.mkdir(dir)
45-
Dir.chdir(dir) do
46-
system('git init')
47-
system('git remote add origin [email protected]:ruby-grape/grape.git')
48-
system('git pull')
49-
system('git checkout gh-pages')
34+
namespace :doc do
35+
YARD::Rake::YardocTask.new(:pages) do |t|
36+
t.files = DOC_FILES
37+
t.options = ['-o', '../grape.doc/docs']
38+
end
39+
40+
namespace :pages do
41+
desc 'Check out gh-pages.'
42+
task :checkout do
43+
dir = File.dirname(__FILE__) + '/../grape.doc'
44+
unless Dir.exist?(dir)
45+
Dir.mkdir(dir)
46+
Dir.chdir(dir) do
47+
system('git init')
48+
system('git remote add origin [email protected]:ruby-grape/grape.git')
49+
system('git pull')
50+
system('git checkout gh-pages')
51+
end
5052
end
5153
end
52-
end
5354

54-
desc 'Generate and publish YARD docs to GitHub pages.'
55-
task publish: ['doc:pages:checkout', 'doc:pages'] do
56-
Dir.chdir(File.dirname(__FILE__) + '/../grape.doc') do
57-
system('git checkout gh-pages')
58-
system('git add .')
59-
system('git add -u')
60-
system("git commit -m 'Generating docs for version #{Grape::VERSION}.'")
61-
system('git push origin gh-pages')
55+
desc 'Generate and publish YARD docs to GitHub pages.'
56+
task publish: ['doc:pages:checkout', 'doc:pages'] do
57+
Dir.chdir(File.dirname(__FILE__) + '/../grape.doc') do
58+
system('git checkout gh-pages')
59+
system('git add .')
60+
system('git add -u')
61+
system("git commit -m 'Generating docs for version #{Grape::VERSION}.'")
62+
system('git push origin gh-pages')
63+
end
6264
end
6365
end
6466
end
67+
rescue LoadError # rubocop:disable Lint/HandleExceptions
68+
# ignore
6569
end

gemfiles/rack_1.5.2.gemfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,29 @@ source 'https://rubygems.org'
55
gem 'rack', '1.5.2'
66

77
group :development, :test do
8+
gem 'bundler'
9+
gem 'rake'
10+
gem 'rubocop', '0.39.0'
11+
end
12+
13+
group :development do
814
gem 'guard'
915
gem 'guard-rspec'
1016
gem 'guard-rubocop'
17+
gem 'yard'
18+
gem 'appraisal'
19+
gem 'benchmark-ips'
20+
gem 'redcarpet'
21+
end
22+
23+
group :test do
24+
gem 'grape-entity', '0.5.0'
25+
gem 'maruku'
26+
gem 'rack-test'
27+
gem 'rspec', '~> 3.0'
28+
gem 'cookiejar'
29+
gem 'rack-contrib'
30+
gem 'mime-types', '< 3.0'
1131
end
1232

1333
gemspec path: '../'

gemfiles/rails_3.gemfile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,33 @@
22

33
source 'https://rubygems.org'
44

5-
gem 'rails', '3.2.22'
5+
gem 'rails', '3.2.19'
66
gem 'rack-cache', '<= 1.2'
77

88
group :development, :test do
9+
gem 'bundler'
10+
gem 'rake'
11+
gem 'rubocop', '0.39.0'
12+
end
13+
14+
group :development do
915
gem 'guard'
1016
gem 'guard-rspec'
1117
gem 'guard-rubocop'
18+
gem 'yard'
19+
gem 'appraisal'
20+
gem 'benchmark-ips'
21+
gem 'redcarpet'
22+
end
23+
24+
group :test do
25+
gem 'grape-entity', '0.5.0'
26+
gem 'maruku'
27+
gem 'rack-test'
28+
gem 'rspec', '~> 3.0'
29+
gem 'cookiejar'
30+
gem 'rack-contrib'
31+
gem 'mime-types', '< 3.0'
1232
end
1333

1434
gemspec path: '../'

gemfiles/rails_4.gemfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,29 @@ source 'https://rubygems.org'
55
gem 'rails', '4.1.6'
66

77
group :development, :test do
8+
gem 'bundler'
9+
gem 'rake'
10+
gem 'rubocop', '0.39.0'
11+
end
12+
13+
group :development do
814
gem 'guard'
915
gem 'guard-rspec'
1016
gem 'guard-rubocop'
17+
gem 'yard'
18+
gem 'appraisal'
19+
gem 'benchmark-ips'
20+
gem 'redcarpet'
21+
end
22+
23+
group :test do
24+
gem 'grape-entity', '0.5.0'
25+
gem 'maruku'
26+
gem 'rack-test'
27+
gem 'rspec', '~> 3.0'
28+
gem 'cookiejar'
29+
gem 'rack-contrib'
30+
gem 'mime-types', '< 3.0'
1131
end
1232

1333
gemspec path: '../'

grape.gemspec

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ Gem::Specification.new do |s|
2222
s.add_runtime_dependency 'virtus', '>= 1.0.0'
2323
s.add_runtime_dependency 'builder'
2424

25-
s.add_development_dependency 'grape-entity', '0.5.0'
26-
s.add_development_dependency 'rake', '~> 10'
27-
s.add_development_dependency 'maruku'
28-
s.add_development_dependency 'yard'
29-
s.add_development_dependency 'rack-test'
30-
s.add_development_dependency 'rspec', '~> 3.0'
31-
s.add_development_dependency 'bundler'
32-
s.add_development_dependency 'cookiejar'
33-
s.add_development_dependency 'rack-contrib'
34-
s.add_development_dependency 'mime-types', '< 3.0'
35-
s.add_development_dependency 'appraisal'
36-
s.add_development_dependency 'benchmark-ips'
37-
s.add_development_dependency 'rubocop', '0.35.1'
38-
3925
s.files = Dir['**/*'].keep_if { |file| File.file?(file) }
4026
s.test_files = Dir['spec/**/*']
4127
s.require_paths = ['lib']

lib/grape/dsl/headers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def header(key = nil, val = nil)
1010
@header ||= {}
1111
end
1212
end
13-
alias_method :headers, :header
13+
alias headers header
1414
end
1515
end
1616
end

0 commit comments

Comments
 (0)