Browse Source

Update ESLint and RuboCop in Code Climate (#12534)

Yamagishi Kazutoshi 2 months ago
parent
commit
6be16d02cb

+ 2
- 2
.codeclimate.yml View File

@@ -27,10 +27,10 @@ plugins:
27 27
     enabled: true
28 28
   eslint:
29 29
     enabled: true
30
-    channel: eslint-5
30
+    channel: eslint-6
31 31
   rubocop:
32 32
     enabled: true
33
-    channel: rubocop-0-71
33
+    channel: rubocop-0-76
34 34
   sass-lint:
35 35
     enabled: true
36 36
 exclude_patterns:

+ 6
- 0
.rubocop.yml View File

@@ -71,6 +71,9 @@ Naming/MemoizedInstanceVariableName:
71 71
 Rails:
72 72
   Enabled: true
73 73
 
74
+Rails/EnumHash:
75
+  Enabled: false
76
+
74 77
 Rails/HasAndBelongsToMany:
75 78
   Enabled: false
76 79
 
@@ -102,6 +105,9 @@ Style/Documentation:
102 105
 Style/DoubleNegation:
103 106
   Enabled: true
104 107
 
108
+Style/FormatStringToken:
109
+  Enabled: false
110
+
105 111
 Style/FrozenStringLiteralComment:
106 112
   Enabled: true
107 113
 

+ 1
- 0
app/lib/activitypub/adapter.rb View File

@@ -35,6 +35,7 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
35 35
   def serializable_hash(options = nil)
36 36
     named_contexts     = {}
37 37
     context_extensions = {}
38
+
38 39
     options         = serialization_options(options)
39 40
     serialized_hash = serializer.serializable_hash(options.merge(named_contexts: named_contexts, context_extensions: context_extensions))
40 41
     serialized_hash = serialized_hash.select { |k, _| options[:fields].include?(k) } if options[:fields]

+ 1
- 1
app/lib/language_detector.rb View File

@@ -44,7 +44,7 @@ class LanguageDetector
44 44
     words = text.scan(RELIABLE_CHARACTERS_RE)
45 45
 
46 46
     if words.present?
47
-      words.reduce(0) { |acc, elem| acc + elem.size }.to_f / text.size.to_f > 0.3
47
+      words.reduce(0) { |acc, elem| acc + elem.size }.to_f / text.size > 0.3
48 48
     else
49 49
       false
50 50
     end

+ 1
- 1
app/models/media_attachment.rb View File

@@ -287,7 +287,7 @@ class MediaAttachment < ApplicationRecord
287 287
       width:  width,
288 288
       height: height,
289 289
       size: "#{width}x#{height}",
290
-      aspect: width.to_f / height.to_f,
290
+      aspect: width.to_f / height,
291 291
     }
292 292
   end
293 293
 

+ 2
- 2
lib/paperclip/lazy_thumbnail.rb View File

@@ -9,8 +9,8 @@ module Paperclip
9 9
         min_side = [@current_geometry.width, @current_geometry.height].min.to_i
10 10
         options[:geometry] = "#{min_side}x#{min_side}#" if @target_geometry.square? && min_side < @target_geometry.width
11 11
       elsif options[:pixels]
12
-        width  = Math.sqrt(options[:pixels] * (@current_geometry.width.to_f / @current_geometry.height.to_f)).round.to_i
13
-        height = Math.sqrt(options[:pixels] * (@current_geometry.height.to_f / @current_geometry.width.to_f)).round.to_i
12
+        width  = Math.sqrt(options[:pixels] * (@current_geometry.width.to_f / @current_geometry.height)).round.to_i
13
+        height = Math.sqrt(options[:pixels] * (@current_geometry.height.to_f / @current_geometry.width)).round.to_i
14 14
         options[:geometry] = "#{width}x#{height}>"
15 15
       end
16 16
 

Loading…
Cancel
Save