Browse Source

Maintenance: Bump rubocop-rails from 2.13.2 to 2.14.2

Martin Gruner 3 years ago
parent
commit
46eb596125
4 changed files with 12 additions and 6 deletions
  1. 4 0
      .rubocop/default.yml
  2. 1 1
      Gemfile.lock
  3. 6 4
      app/models/karma/activity_log.rb
  4. 1 1
      lib/color_validator.rb

+ 4 - 0
.rubocop/default.yml

@@ -171,6 +171,10 @@ Rails/HasAndBelongsToMany:
 #  StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
   Enabled: false
 
+Rails/I18nLocaleTexts:
+  Description: 'Enforces use of I18n and locale files instead of locale specific strings.'
+  Enabled: false
+
 Rails/MatchRoute:
   Description: >-
                   Don't use `match` to define any routes unless there is a need to map multiple request types

+ 1 - 1
Gemfile.lock

@@ -479,7 +479,7 @@ GEM
     rubocop-performance (1.13.3)
       rubocop (>= 1.7.0, < 2.0)
       rubocop-ast (>= 0.4.0)
-    rubocop-rails (2.13.2)
+    rubocop-rails (2.14.2)
       activesupport (>= 4.2.0)
       rack (>= 1.1)
       rubocop (>= 1.7.0, < 2.0)

+ 6 - 4
app/models/karma/activity_log.rb

@@ -38,7 +38,9 @@ add karma activity log of an object
         o_id:             o_id,
         activity_id:      activity.id,
       ).find_by('created_at >= ?', Time.zone.now - activity.once_ttl.seconds)
-      return false if !force && latest_activity
+
+      # End transaction block
+      next if !force && latest_activity
 
       score_total = 0
       if last_activity
@@ -62,10 +64,10 @@ add karma activity log of an object
       if !force
         Cache.write("Karma::ActivityLog.add::#{activity.once_ttl.seconds}::#{action}::#{user.id}::#{object}::#{o_id}", true, expires_in: activity.once_ttl.seconds)
       end
-    end
 
-    # set new karma level
-    Karma::User.sync(user)
+      # set new karma level
+      Karma::User.sync(user)
+    end
 
     true
   end

+ 1 - 1
lib/color_validator.rb

@@ -10,7 +10,7 @@ class ColorValidator < ActiveModel::EachValidator
   def validate_each(record, attribute, value)
     return if color?(value)
 
-    record.errors[attribute] << (options[:message] || 'is not a color. Only Hex, RGB and HSL colors are supported.')
+    record.errors.add attribute, (options[:message] || 'is not a color. Only Hex, RGB and HSL colors are supported.')
   end
 
   def color?(value)