Update rubocop et. al. to latest
This commit is contained in:
parent
a69e678887
commit
3a58f3f78c
|
@ -1,6 +1,6 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2021-03-18 03:26:00 UTC using RuboCop version 0.89.1.
|
||||
# on 2021-03-21 03:46:53 UTC using RuboCop version 1.11.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
|
||||
|
@ -15,7 +15,18 @@ Gemspec/OrderedDependencies:
|
|||
- 'paper_trail.gemspec'
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: IgnoredMethods.
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
|
||||
Lint/RedundantSafeNavigation:
|
||||
Exclude:
|
||||
- 'lib/paper_trail/events/base.rb'
|
||||
- 'lib/paper_trail/queries/versions/where_object_changes.rb'
|
||||
- 'lib/paper_trail/queries/versions/where_object_changes_from.rb'
|
||||
- 'lib/paper_trail/version_concern.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 19 # Goal: the default (17?)
|
||||
|
||||
|
@ -36,6 +47,26 @@ Naming/MemoizedInstanceVariableName:
|
|||
Exclude:
|
||||
- 'lib/paper_trail/model_config.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
|
||||
# SupportedStyles: snake_case, normalcase, non_integer
|
||||
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
||||
Naming/VariableNumber:
|
||||
Exclude:
|
||||
- 'spec/dummy_app/app/models/person.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Performance/BlockGivenWithExplicitBlock:
|
||||
Exclude:
|
||||
- 'lib/paper_trail.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: MinSize.
|
||||
Performance/CollectionLiteralInLoop:
|
||||
Exclude:
|
||||
- 'spec/models/version_spec.rb'
|
||||
|
||||
# Offense count: 115
|
||||
# Configuration parameters: Prefixes.
|
||||
# Prefixes: when, with, without
|
||||
|
@ -62,10 +93,6 @@ Rails/ApplicationController:
|
|||
Exclude:
|
||||
- 'spec/dummy_app/app/controllers/test_controller.rb'
|
||||
|
||||
# We want this, but not until we drop support for ruby 2.4
|
||||
Style/HashTransformKeys:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 56
|
||||
# Cop supports --auto-correct.
|
||||
Rails/ApplicationRecord:
|
||||
|
@ -122,7 +149,11 @@ Rails/WhereNot:
|
|||
Exclude:
|
||||
- 'lib/paper_trail/version_concern.rb'
|
||||
|
||||
# We want this, but not until we drop support for ruby 2.4
|
||||
Style/HashTransformValues:
|
||||
RSpec/FilePath:
|
||||
Exclude:
|
||||
- 'lib/paper_trail/events/destroy.rb'
|
||||
- 'spec/paper_trail/model_spec.rb'
|
||||
- 'spec/paper_trail/serializer_spec.rb'
|
||||
|
||||
Style/ClassEqualityComparison:
|
||||
Exclude:
|
||||
- 'lib/paper_trail/attribute_serializers/attribute_serializer_factory.rb'
|
||||
|
|
|
@ -35,7 +35,7 @@ module PaperTrail
|
|||
#
|
||||
# @override
|
||||
def changes_in_latest_version
|
||||
@record.attributes.map { |attr, value| [attr, [value, nil]] }.to_h
|
||||
@record.attributes.transform_values { |value| [value, nil] }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,11 +65,11 @@ has been destroyed.
|
|||
|
||||
s.add_development_dependency "rake", "~> 13.0"
|
||||
s.add_development_dependency "rspec-rails", "~> 4.0"
|
||||
s.add_development_dependency "rubocop", "~> 0.89.1"
|
||||
s.add_development_dependency "rubocop-rails", "~> 2.8"
|
||||
s.add_development_dependency "rubocop", "~> 1.11.0"
|
||||
s.add_development_dependency "rubocop-rails", "~> 2.9.1"
|
||||
s.add_development_dependency "rubocop-packaging", "~> 0.5.1"
|
||||
s.add_development_dependency "rubocop-performance", "~> 1.7.1"
|
||||
s.add_development_dependency "rubocop-rspec", "~> 1.42.0"
|
||||
s.add_development_dependency "rubocop-performance", "~> 1.10.1"
|
||||
s.add_development_dependency "rubocop-rspec", "~> 2.2.0"
|
||||
|
||||
# ## Database Adapters
|
||||
#
|
||||
|
|
|
@ -69,7 +69,7 @@ RSpec.describe(PaperTrail, versioning: true) do
|
|||
original_attributes = PaperTrail::Events::Base.
|
||||
new(customer, false).
|
||||
send(:nonskipped_attributes_before_change, false).
|
||||
reject { |_k, v| v.nil? }
|
||||
compact
|
||||
customer.update(name: "Some more text.")
|
||||
expect(customer.versions.length).to(eq(2))
|
||||
expect(customer.versions[0].reify).to(be_nil)
|
||||
|
|
|
@ -15,7 +15,7 @@ module CustomYamlSerializer
|
|||
end
|
||||
|
||||
def self.dump(object)
|
||||
object.is_a?(Hash) ? super(object.reject { |_k, v| v.nil? }) : super
|
||||
object.is_a?(Hash) ? super(object.compact) : super
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ RSpec.describe CustomYamlSerializer do
|
|||
describe ".dump" do
|
||||
it("serializes Ruby to YAML, removing pairs with nil values") do
|
||||
expect(described_class.dump(word_hash)).to eq(
|
||||
word_hash.reject { |_k, v| v.nil? }.to_yaml
|
||||
word_hash.compact.to_yaml
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,6 +10,6 @@ module CustomJsonSerializer
|
|||
end
|
||||
|
||||
def self.dump(object)
|
||||
object.is_a?(Hash) ? super(object.reject { |_k, v| v.nil? }) : super
|
||||
object.is_a?(Hash) ? super(object.compact) : super
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue