Skip to content

Commit 7169b78

Browse files
committed
Upgraded RuboCop to 0.42.0.
1 parent 8a0bf0f commit 7169b78

File tree

9 files changed

+35
-33
lines changed

9 files changed

+35
-33
lines changed

.rubocop_todo.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-03-15 15:48:04 -0400 using RuboCop version 0.33.0.
3+
# on 2016-08-20 10:53:42 -0400 using RuboCop version 0.42.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
@@ -12,7 +12,8 @@ Metrics/ClassLength:
1212
Max: 103
1313

1414
# Offense count: 85
15-
# Configuration parameters: AllowURI, URISchemes.
15+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
16+
# URISchemes: http, https
1617
Metrics/LineLength:
1718
Max: 142
1819

@@ -33,28 +34,21 @@ Style/AsciiComments:
3334

3435
# Offense count: 2
3536
# Configuration parameters: EnforcedStyle, SupportedStyles.
37+
# SupportedStyles: nested, compact
3638
Style/ClassAndModuleChildren:
3739
Exclude:
3840
- 'features/steps/api_navigation.rb'
3941
- 'features/steps/default_config.rb'
4042

41-
# Offense count: 14
43+
# Offense count: 4
4244
Style/Documentation:
4345
Exclude:
46+
- 'spec/**/*'
47+
- 'test/**/*'
4448
- 'features/steps/api_navigation.rb'
4549
- 'features/steps/default_config.rb'
4650
- 'features/support/api.rb'
4751
- 'features/support/fixtures.rb'
48-
- 'lib/hyperclient/version.rb'
49-
- 'test/faraday/connection_test.rb'
50-
- 'test/hyperclient/attributes_test.rb'
51-
- 'test/hyperclient/collection_test.rb'
52-
- 'test/hyperclient/curie_test.rb'
53-
- 'test/hyperclient/entry_point_test.rb'
54-
- 'test/hyperclient/link_collection_test.rb'
55-
- 'test/hyperclient/link_test.rb'
56-
- 'test/hyperclient/resource_collection_test.rb'
57-
- 'test/hyperclient/resource_test.rb'
5852

5953
# Offense count: 2
6054
Style/DoubleNegation:
@@ -64,15 +58,23 @@ Style/DoubleNegation:
6458

6559
# Offense count: 5
6660
# Cop supports --auto-correct.
61+
# Configuration parameters: EnforcedStyle, SupportedStyles.
62+
# SupportedStyles: line_count_dependent, lambda, literal
6763
Style/Lambda:
6864
Exclude:
6965
- 'test/hyperclient/entry_point_test.rb'
7066
- 'test/hyperclient/link_test.rb'
7167
- 'test/hyperclient/resource_test.rb'
7268

69+
# Offense count: 1
70+
Style/MethodMissing:
71+
Exclude:
72+
- 'lib/hyperclient/collection.rb'
73+
7374
# Offense count: 1
7475
# Cop supports --auto-correct.
7576
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
77+
# SupportedStyles: slashes, percent_r, mixed
7678
Style/RegexpLiteral:
7779
Exclude:
7880
- 'features/support/api.rb'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ group :development, :test do
1515
gem 'yard-tomdoc'
1616
gem 'rake'
1717
gem 'simplecov', require: false
18-
gem 'rubocop', '~> 0.33.0', require: false
18+
gem 'rubocop', '~> 0.42.0', require: false
1919
end
2020

2121
group :test do

examples/splines_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# enumerate splines
99
api.splines.each do |spline|
10-
puts "#{spline.uuid}"
10+
puts spline.uuid.to_s
1111
puts " reticulated: #{spline.reticulated ? 'yes' : 'no'}"
1212
puts " thumbnail: #{spline['images:thumbnail']}"
1313
end

lib/hyperclient/attributes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Hyperclient
99
# resource.attributes.title
1010
#
1111
class Attributes < Collection
12-
RESERVED_PROPERTIES = [/^_links$/, /^_embedded$/] # http://tools.ietf.org/html/draft-kelly-json-hal#section-4.1
12+
RESERVED_PROPERTIES = [/^_links$/, /^_embedded$/].freeze # http://tools.ietf.org/html/draft-kelly-json-hal#section-4.1
1313

1414
# Public: Initializes the Attributes of a Resource.
1515
#

lib/hyperclient/collection.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def [](name)
6262
def to_h
6363
@collection.to_hash
6464
end
65-
alias_method :to_hash, :to_h
65+
alias to_hash to_h
6666

6767
def to_s
6868
to_hash
@@ -76,7 +76,7 @@ def to_s
7676
# Returns an Object.
7777
def method_missing(method_name, *_args, &_block)
7878
@collection.fetch(method_name.to_s) do
79-
fail "Could not find `#{method_name}` in #{self.class.name}"
79+
raise "Could not find `#{method_name}` in #{self.class.name}"
8080
end
8181
end
8282

lib/hyperclient/entry_point.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ def initialize(url, &_block)
5252
def connection(options = {}, &block)
5353
@faraday_options ||= options.dup
5454
if block_given?
55-
fail ConnectionAlreadyInitializedError if @connection
56-
if @faraday_options.delete(:default) == false
57-
@faraday_block = block
58-
else
59-
@faraday_block = lambda do |conn|
60-
default_faraday_block.call conn
61-
block.call conn
62-
end
63-
end
55+
raise ConnectionAlreadyInitializedError if @connection
56+
@faraday_block = if @faraday_options.delete(:default) == false
57+
block
58+
else
59+
lambda do |conn|
60+
default_faraday_block.call conn
61+
yield conn
62+
end
63+
end
6464
else
6565
@connection ||= Faraday.new(_url, faraday_options, &faraday_block)
6666
end
@@ -78,7 +78,7 @@ def headers
7878
#
7979
# value - A Hash containing headers to include with every API request.
8080
def headers=(value)
81-
fail ConnectionAlreadyInitializedError if @connection
81+
raise ConnectionAlreadyInitializedError if @connection
8282
@headers = value
8383
end
8484

@@ -93,7 +93,7 @@ def faraday_options
9393
#
9494
# value - A Hash containing options to pass to Faraday
9595
def faraday_options=(value)
96-
fail ConnectionAlreadyInitializedError if @connection
96+
raise ConnectionAlreadyInitializedError if @connection
9797
@faraday_options = value
9898
end
9999

@@ -108,7 +108,7 @@ def faraday_block
108108
#
109109
# value - A Proc accepting a Faraday::Connection.
110110
def faraday_block=(value)
111-
fail ConnectionAlreadyInitializedError if @connection
111+
raise ConnectionAlreadyInitializedError if @connection
112112
@faraday_block = value
113113
end
114114

lib/hyperclient/link_collection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LinkCollection < Collection
1919
# curies - The Hash with link curies.
2020
# entry_point - The EntryPoint object to inject the configuration.
2121
def initialize(collection, curies, entry_point)
22-
fail "Invalid response for LinkCollection. The response was: #{collection.inspect}" if collection && !collection.respond_to?(:collect)
22+
raise "Invalid response for LinkCollection. The response was: #{collection.inspect}" if collection && !collection.respond_to?(:collect)
2323

2424
@_curies = (curies || {}).reduce({}) do |hash, curie_hash|
2525
curie = build_curie(curie_hash, entry_point)

lib/hyperclient/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def fetch(key, *args)
6565
elsif block_given?
6666
yield key
6767
else
68-
fail KeyError
68+
raise KeyError
6969
end
7070
end
7171

lib/hyperclient/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Hyperclient
2-
VERSION = '0.8.2'
2+
VERSION = '0.8.2'.freeze
33
end

0 commit comments

Comments
 (0)