From cc6ace402b3f87bc58bcd646b1a2fd57e1d16f7d Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sat, 13 Jul 2024 08:54:04 +0000 Subject: [PATCH] Layout/LineLength --- .rubocop_todo.yml | 13 +++---------- acts_as_commentable.gemspec | 17 ++++++++++++++++- lib/comment_methods.rb | 3 ++- lib/commentable_methods.rb | 4 +++- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 963a79d..ac7fd0d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-07-13 08:47:24 UTC using RuboCop version 1.65.0. +# on 2024-07-13 08:53:50 UTC using RuboCop version 1.65.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 @@ -16,7 +16,7 @@ Gemspec/RequiredRubyVersion: # Offense count: 5 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 38 + Max: 36 # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. @@ -31,7 +31,7 @@ Metrics/CyclomaticComplexity: # Offense count: 7 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 35 + Max: 37 # Offense count: 1 # Configuration parameters: AllowedMethods, AllowedPatterns. @@ -109,10 +109,3 @@ Style/FrozenStringLiteralComment: Style/StringConcatenation: Exclude: - 'test/acts_as_commentable_test.rb' - -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. -# URISchemes: http, https -Layout/LineLength: - Max: 414 diff --git a/acts_as_commentable.gemspec b/acts_as_commentable.gemspec index 0573aa6..344e352 100644 --- a/acts_as_commentable.gemspec +++ b/acts_as_commentable.gemspec @@ -8,7 +8,22 @@ Gem::Specification.new do |s| s.description = 'Plugin/gem that provides comment functionality' s.email = 'unknown@juixe.com' s.extra_rdoc_files = ['README.rdoc', 'MIT-LICENSE'] - s.files = ['MIT-LICENSE', 'README.rdoc', 'lib/acts_as_commentable.rb', 'lib/comment_methods.rb', 'lib/commentable_methods.rb', 'lib/generators', 'lib/generators/comment', 'lib/generators/comment/comment_generator.rb', 'lib/generators/comment/templates', 'lib/generators/comment/templates/comment.rb', 'lib/generators/comment/templates/create_comments.rb', 'lib/generators/comment/USAGE', 'init.rb', 'install.rb'] + s.files = [ + 'MIT-LICENSE', + 'README.rdoc', + 'lib/acts_as_commentable.rb', + 'lib/comment_methods.rb', + 'lib/commentable_methods.rb', + 'lib/generators', + 'lib/generators/comment', + 'lib/generators/comment/comment_generator.rb', + 'lib/generators/comment/templates', + 'lib/generators/comment/templates/comment.rb', + 'lib/generators/comment/templates/create_comments.rb', + 'lib/generators/comment/USAGE', + 'init.rb', + 'install.rb' + ] s.homepage = 'http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/' s.require_paths = ['lib'] s.summary = 'Plugin/gem that provides comment functionality' diff --git a/lib/comment_methods.rb b/lib/comment_methods.rb index e5f709b..9c3ab70 100644 --- a/lib/comment_methods.rb +++ b/lib/comment_methods.rb @@ -29,7 +29,8 @@ def find_comments_by_user(user, role = 'comments') # Helper class method to look up all comments for # commentable class name and commentable id. def find_comments_for_commentable(commentable_str, commentable_id, role = 'comments') - where(['commentable_type = ? and commentable_id = ? and role = ?', commentable_str, commentable_id, role]).order('created_at DESC') + where(['commentable_type = ? and commentable_id = ? and role = ?', commentable_str, commentable_id, + role]).order('created_at DESC') end # Helper class method to look up a commentable object diff --git a/lib/commentable_methods.rb b/lib/commentable_methods.rb index 2e2940f..b572c3d 100644 --- a/lib/commentable_methods.rb +++ b/lib/commentable_methods.rb @@ -64,7 +64,9 @@ def self.find_#{method_name}_for(obj) def self.find_#{method_name}_by_user(user) commentable = self.base_class.name - Comment.where(["user_id = ? and commentable_type = ? and role = ?", user.id, commentable, "#{role}"]).order("created_at DESC") + Comment.where([ + "user_id = ? and commentable_type = ? and role = ?", user.id, commentable, "#{role}" + ]).order("created_at DESC") end def #{method_name}_ordered_by_submitted