Upgraded to RuboCop 0.34.2.
This commit is contained in:
parent
f5fb158559
commit
acc3d48b91
|
@ -1,45 +1,65 @@
|
|||
# This configuration was generated by `rubocop --auto-gen-config`
|
||||
# on 2014-12-30 16:07:22 -0500 using RuboCop version 0.28.0.
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2015-10-25 15:12:09 -0400 using RuboCop version 0.34.2.
|
||||
# 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: 9
|
||||
# Offense count: 2
|
||||
Lint/NestedMethodDefinition:
|
||||
Exclude:
|
||||
- 'lib/hashie/extensions/indifferent_access.rb'
|
||||
|
||||
# Offense count: 8
|
||||
Metrics/AbcSize:
|
||||
Max: 37
|
||||
Max: 29
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/ClassLength:
|
||||
Max: 172
|
||||
Max: 171
|
||||
|
||||
# Offense count: 8
|
||||
# Offense count: 6
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 11
|
||||
|
||||
# Offense count: 167
|
||||
# Offense count: 218
|
||||
# Configuration parameters: AllowURI, URISchemes.
|
||||
Metrics/LineLength:
|
||||
Max: 170
|
||||
|
||||
# Offense count: 14
|
||||
# Offense count: 17
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/MethodLength:
|
||||
Max: 28
|
||||
|
||||
# Offense count: 8
|
||||
# Offense count: 6
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 10
|
||||
|
||||
# Offense count: 2
|
||||
Style/CaseEquality:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'lib/hashie/hash.rb'
|
||||
|
||||
# Offense count: 84
|
||||
# Offense count: 27
|
||||
# Configuration parameters: Exclude.
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 10
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'lib/hashie/dash.rb'
|
||||
- 'lib/hashie/extensions/dash/indifferent_access.rb'
|
||||
- 'lib/hashie/extensions/method_access.rb'
|
||||
- 'lib/hashie/mash.rb'
|
||||
- 'spec/hashie/extensions/coercion_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
|
||||
Style/RegexpLiteral:
|
||||
Exclude:
|
||||
- 'Guardfile'
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -5,7 +5,7 @@ gemspec
|
|||
group :development do
|
||||
gem 'pry'
|
||||
gem 'pry-stack_explorer', platforms: [:ruby_19, :ruby_20, :ruby_21]
|
||||
gem 'rubocop', '0.28.0'
|
||||
gem 'rubocop', '0.34.2'
|
||||
gem 'guard', '~> 2.6.1'
|
||||
gem 'guard-rspec', '~> 4.3.1', require: false
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
guard 'rspec', all_on_start: false, cmd: 'bundle exec rspec' do
|
||||
watch(/^spec\/.+_spec\.rb/)
|
||||
watch(/^lib\/(.+)\.rb/) { |m| "spec/#{m[1]}_spec.rb" }
|
||||
watch(/^lib\/(.+)\.rb/) { |m| "spec/#{m[1]}_spec.rb" }
|
||||
watch('spec/spec_helper.rb') { 'spec' }
|
||||
end
|
||||
|
|
|
@ -12,9 +12,9 @@ Gem::Specification.new do |gem|
|
|||
|
||||
gem.require_paths = ['lib']
|
||||
gem.files = %w(.yardopts CHANGELOG.md CONTRIBUTING.md LICENSE README.md UPGRADING.md Rakefile hashie.gemspec)
|
||||
gem.files += Dir['lib/**/*.rb']
|
||||
gem.files += Dir['spec/**/*.rb']
|
||||
gem.test_files = Dir['spec/**/*.rb']
|
||||
gem.files += Dir['lib/**/*.rb']
|
||||
gem.files += Dir['spec/**/*.rb']
|
||||
gem.test_files = Dir['spec/**/*.rb']
|
||||
|
||||
gem.add_development_dependency 'rake'
|
||||
gem.add_development_dependency 'rspec', '~> 3.0'
|
||||
|
|
|
@ -111,7 +111,7 @@ module Hashie
|
|||
options = { strict: true }.merge(options)
|
||||
|
||||
if ABSTRACT_CORE_TYPES.key? from
|
||||
ABSTRACT_CORE_TYPES[from].each do | type |
|
||||
ABSTRACT_CORE_TYPES[from].each do |type|
|
||||
coerce_value type, into, options
|
||||
end
|
||||
end
|
||||
|
@ -130,6 +130,7 @@ module Hashie
|
|||
def strict_value_coercions
|
||||
@strict_value_coercions ||= {}
|
||||
end
|
||||
|
||||
# Return all value coercions that have the :strict rule as false.
|
||||
def lenient_value_coercions
|
||||
@lenient_value_coercions ||= {}
|
||||
|
@ -158,7 +159,8 @@ module Hashie
|
|||
type, key_type, value_type = type.class, *type.first
|
||||
build_hash_coercion(type, key_type, value_type)
|
||||
else # Enumerable but not Hash: Array, Set
|
||||
type, value_type = type.class, type.first
|
||||
value_type = type.first
|
||||
type = type.class
|
||||
build_container_coercion(type, value_type)
|
||||
end
|
||||
elsif CORE_TYPES.key? type
|
||||
|
|
|
@ -87,7 +87,7 @@ describe Hashie::Extensions::Coercion do
|
|||
]
|
||||
expect(instance[:nested_list]).to be_a Array
|
||||
expect(instance[:nested_list].size).to eq(3)
|
||||
instance[:nested_list].each do | nested |
|
||||
instance[:nested_list].each do |nested|
|
||||
test_nested_object nested
|
||||
end
|
||||
end
|
||||
|
@ -100,7 +100,7 @@ describe Hashie::Extensions::Coercion do
|
|||
}
|
||||
expect(instance[:nested_hash]).to be_a Hash
|
||||
expect(instance[:nested_hash].size).to eq(3)
|
||||
instance[:nested_hash].each do | key, nested |
|
||||
instance[:nested_hash].each do |key, nested|
|
||||
expect(key).to be_a(String)
|
||||
test_nested_object nested
|
||||
end
|
||||
|
@ -251,9 +251,9 @@ describe Hashie::Extensions::Coercion do
|
|||
xyz: 987
|
||||
}
|
||||
expect(instance[:foo]).to eq(
|
||||
'abc' => '123',
|
||||
'xyz' => '987'
|
||||
)
|
||||
'abc' => '123',
|
||||
'xyz' => '987'
|
||||
)
|
||||
end
|
||||
|
||||
it 'can coerce via a proc' do
|
||||
|
@ -571,7 +571,7 @@ describe Hashie::Extensions::Coercion do
|
|||
float: 2.7,
|
||||
rational: Rational(2, 3),
|
||||
complex: Complex(1)
|
||||
}.each do | k, v |
|
||||
}.each do |k, v|
|
||||
instance[k] = v
|
||||
if v.is_a? Integer
|
||||
expect(instance[k]).to be_a(String)
|
||||
|
@ -592,7 +592,7 @@ describe Hashie::Extensions::Coercion do
|
|||
float: 2.7,
|
||||
rational: Rational(2, 3),
|
||||
complex: Complex(1)
|
||||
}.each do | k, v |
|
||||
}.each do |k, v|
|
||||
instance[k] = v
|
||||
expect(instance[k]).to be_a(String)
|
||||
expect(instance[k]).to eq(v.to_s)
|
||||
|
|
|
@ -54,13 +54,13 @@ describe Hashie::Extensions::IndifferentAccess do
|
|||
end
|
||||
|
||||
it 'returns the same instance of the hash that was set' do
|
||||
hash = Hash.new
|
||||
hash = {}
|
||||
h = subject.build(foo: hash)
|
||||
expect(h.values_at(:foo)[0]).to be(hash)
|
||||
end
|
||||
|
||||
it 'returns the same instance of the array that was set' do
|
||||
array = Array.new
|
||||
array = []
|
||||
h = subject.build(foo: array)
|
||||
expect(h.values_at(:foo)[0]).to be(array)
|
||||
end
|
||||
|
@ -86,13 +86,13 @@ describe Hashie::Extensions::IndifferentAccess do
|
|||
end
|
||||
|
||||
it 'returns the same instance of the hash that was set' do
|
||||
hash = Hash.new
|
||||
hash = {}
|
||||
h = subject.build(foo: hash)
|
||||
expect(h.fetch(:foo)).to be(hash)
|
||||
end
|
||||
|
||||
it 'returns the same instance of the array that was set' do
|
||||
array = Array.new
|
||||
array = []
|
||||
h = subject.build(foo: array)
|
||||
expect(h.fetch(:foo)).to be(array)
|
||||
end
|
||||
|
@ -156,7 +156,7 @@ describe Hashie::Extensions::IndifferentAccess do
|
|||
|
||||
it 'does not change the ancestors of the injected object class' do
|
||||
h.update(baz: { qux: 'abc' })
|
||||
expect(Hash.new).not_to be_respond_to(:indifferent_access?)
|
||||
expect({}).not_to be_respond_to(:indifferent_access?)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ describe Hashie::Extensions::IndifferentAccess do
|
|||
|
||||
it 'does not change the ancestors of the injected object class' do
|
||||
h.update(baz: { qux: 'abc' })
|
||||
expect(Hash.new).not_to be_respond_to(:indifferent_access?)
|
||||
expect({}).not_to be_respond_to(:indifferent_access?)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue