Skip to content

Commit

Permalink
Layout/LineLength
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Jul 13, 2024
1 parent a2732ba commit cc6ace4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
13 changes: 3 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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
17 changes: 16 additions & 1 deletion acts_as_commentable.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@ Gem::Specification.new do |s|
s.description = 'Plugin/gem that provides comment functionality'
s.email = '[email protected]'
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'
Expand Down
3 changes: 2 additions & 1 deletion lib/comment_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/commentable_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc6ace4

Please sign in to comment.