diff --git a/.rubocop.yml b/.rubocop.yml index 6cf84967..3417aef0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -183,6 +183,11 @@ Style/ModuleFunction: - 'lib/paper_trail/serializers/json.rb' - 'lib/paper_trail/serializers/yaml.rb' +# Too subtle to lint. Use `format` for multiple variables. For single variables, +# use either interpolation or concatenation, whichever is easier to read. +Style/StringConcatenation: + Enabled: false + # The Ruby Style Guide does not prescribe a particular quote character, only # that a project should pick one and be consistent. The decision has no # performance implications. Double quotes are slightly easier to read. diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 75f76295..7486d149 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -39,6 +39,10 @@ RSpec/NestedGroups: Security/YAMLLoad: Enabled: false +Style/ExplicitBlockArgument: + Exclude: + - lib/paper_trail/events/base.rb + # We want this, but not until we drop support for ruby 2.4 Style/HashTransformKeys: Enabled: false diff --git a/lib/paper_trail/version_concern.rb b/lib/paper_trail/version_concern.rb index 9c365351..08a6b43a 100644 --- a/lib/paper_trail/version_concern.rb +++ b/lib/paper_trail/version_concern.rb @@ -145,6 +145,7 @@ module PaperTrail # Default: false. # @return `ActiveRecord::Relation` # @api public + # rubocop:disable Style/OptionalBooleanParameter def preceding(obj, timestamp_arg = false) if timestamp_arg != true && primary_key_is_int? preceding_by_id(obj) @@ -152,6 +153,7 @@ module PaperTrail preceding_by_timestamp(obj) end end + # rubocop:enable Style/OptionalBooleanParameter # Returns versions after `obj`. # @@ -160,6 +162,7 @@ module PaperTrail # Default: false. # @return `ActiveRecord::Relation` # @api public + # rubocop:disable Style/OptionalBooleanParameter def subsequent(obj, timestamp_arg = false) if timestamp_arg != true && primary_key_is_int? subsequent_by_id(obj) @@ -167,6 +170,7 @@ module PaperTrail subsequent_by_timestamp(obj) end end + # rubocop:enable Style/OptionalBooleanParameter private @@ -248,12 +252,15 @@ module PaperTrail end alias version_author terminator + # @api private + # rubocop:disable Style/OptionalBooleanParameter def sibling_versions(reload = false) if reload || !defined?(@sibling_versions) || @sibling_versions.nil? @sibling_versions = self.class.with_item_keys(item_type, item_id) end @sibling_versions end + # rubocop:enable Style/OptionalBooleanParameter def next @next ||= sibling_versions.subsequent(self).first diff --git a/paper_trail.gemspec b/paper_trail.gemspec index cd9a0f3b..b6d06953 100644 --- a/paper_trail.gemspec +++ b/paper_trail.gemspec @@ -43,7 +43,7 @@ has been destroyed. s.add_development_dependency "memory_profiler", "~> 0.9.14" s.add_development_dependency "rake", "~> 13.0" s.add_development_dependency "rspec-rails", "~> 4.0" - s.add_development_dependency "rubocop", "~> 0.88.0" + s.add_development_dependency "rubocop", "~> 0.89.1" s.add_development_dependency "rubocop-performance", "~> 1.7.1" s.add_development_dependency "rubocop-rspec", "~> 1.42.0"