]> cat aescling's git repositories - mastodon.git/commitdiff
Update ESLint and RuboCop in Code Climate (#12534)
authorYamagishi Kazutoshi <ykzts@desire.sh>
Mon, 2 Dec 2019 17:25:43 +0000 (02:25 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 2 Dec 2019 17:25:43 +0000 (18:25 +0100)
.codeclimate.yml
.rubocop.yml
app/lib/activitypub/adapter.rb
app/lib/language_detector.rb
app/models/media_attachment.rb
lib/paperclip/lazy_thumbnail.rb

index 571507a542548e760209164d6dadaa6ad7a3aef3..9817d7f1c72bdb0c655183ee03b2a8cf8dd7dce8 100644 (file)
@@ -27,10 +27,10 @@ plugins:
     enabled: true
   eslint:
     enabled: true
-    channel: eslint-5
+    channel: eslint-6
   rubocop:
     enabled: true
-    channel: rubocop-0-71
+    channel: rubocop-0-76
   sass-lint:
     enabled: true
 exclude_patterns:
index 8bd4c867f41c710243f0cb744ba538957b6320d8..9a68becbb63279e076ebe3272239f9a78376eaa6 100644 (file)
@@ -71,6 +71,9 @@ Naming/MemoizedInstanceVariableName:
 Rails:
   Enabled: true
 
+Rails/EnumHash:
+  Enabled: false
+
 Rails/HasAndBelongsToMany:
   Enabled: false
 
@@ -102,6 +105,9 @@ Style/Documentation:
 Style/DoubleNegation:
   Enabled: true
 
+Style/FormatStringToken:
+  Enabled: false
+
 Style/FrozenStringLiteralComment:
   Enabled: true
 
index 2a8f723334652590055949839a6e17654a77b437..78138fb73f8c3753ea7516195fb9c3098594aab8 100644 (file)
@@ -35,6 +35,7 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
   def serializable_hash(options = nil)
     named_contexts     = {}
     context_extensions = {}
+
     options         = serialization_options(options)
     serialized_hash = serializer.serializable_hash(options.merge(named_contexts: named_contexts, context_extensions: context_extensions))
     serialized_hash = serialized_hash.select { |k, _| options[:fields].include?(k) } if options[:fields]
index 6f9511a54192a70cbb646ec371f6d7e2102e36f2..302072bccbce087be60e5b6592dcfc84c2dcb15f 100644 (file)
@@ -44,7 +44,7 @@ class LanguageDetector
     words = text.scan(RELIABLE_CHARACTERS_RE)
 
     if words.present?
-      words.reduce(0) { |acc, elem| acc + elem.size }.to_f / text.size.to_f > 0.3
+      words.reduce(0) { |acc, elem| acc + elem.size }.to_f / text.size > 0.3
     else
       false
     end
index 1f9d92b22c4df76b215ba24bec1549167398e9ef..5d5034a52cb75c9e629df58e5c47453e1fe76351 100644 (file)
@@ -287,7 +287,7 @@ class MediaAttachment < ApplicationRecord
       width:  width,
       height: height,
       size: "#{width}x#{height}",
-      aspect: width.to_f / height.to_f,
+      aspect: width.to_f / height,
     }
   end
 
index 542c17fb20efdfab33f4f3402fa38927c39ac634..10b14860c4a8fee031c9b1e2ebb75d107c3d22bb 100644 (file)
@@ -9,8 +9,8 @@ module Paperclip
         min_side = [@current_geometry.width, @current_geometry.height].min.to_i
         options[:geometry] = "#{min_side}x#{min_side}#" if @target_geometry.square? && min_side < @target_geometry.width
       elsif options[:pixels]
-        width  = Math.sqrt(options[:pixels] * (@current_geometry.width.to_f / @current_geometry.height.to_f)).round.to_i
-        height = Math.sqrt(options[:pixels] * (@current_geometry.height.to_f / @current_geometry.width.to_f)).round.to_i
+        width  = Math.sqrt(options[:pixels] * (@current_geometry.width.to_f / @current_geometry.height)).round.to_i
+        height = Math.sqrt(options[:pixels] * (@current_geometry.height.to_f / @current_geometry.width)).round.to_i
         options[:geometry] = "#{width}x#{height}>"
       end