mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 22:31:36 +01:00
Update ESLint and RuboCop in Code Climate (#12534)
This commit is contained in:
parent
27d5d02925
commit
6be16d02cb
6 changed files with 13 additions and 6 deletions
|
@ -27,10 +27,10 @@ plugins:
|
||||||
enabled: true
|
enabled: true
|
||||||
eslint:
|
eslint:
|
||||||
enabled: true
|
enabled: true
|
||||||
channel: eslint-5
|
channel: eslint-6
|
||||||
rubocop:
|
rubocop:
|
||||||
enabled: true
|
enabled: true
|
||||||
channel: rubocop-0-71
|
channel: rubocop-0-76
|
||||||
sass-lint:
|
sass-lint:
|
||||||
enabled: true
|
enabled: true
|
||||||
exclude_patterns:
|
exclude_patterns:
|
||||||
|
|
|
@ -71,6 +71,9 @@ Naming/MemoizedInstanceVariableName:
|
||||||
Rails:
|
Rails:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Rails/EnumHash:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Rails/HasAndBelongsToMany:
|
Rails/HasAndBelongsToMany:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -102,6 +105,9 @@ Style/Documentation:
|
||||||
Style/DoubleNegation:
|
Style/DoubleNegation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Style/FormatStringToken:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
|
||||||
def serializable_hash(options = nil)
|
def serializable_hash(options = nil)
|
||||||
named_contexts = {}
|
named_contexts = {}
|
||||||
context_extensions = {}
|
context_extensions = {}
|
||||||
|
|
||||||
options = serialization_options(options)
|
options = serialization_options(options)
|
||||||
serialized_hash = serializer.serializable_hash(options.merge(named_contexts: named_contexts, context_extensions: context_extensions))
|
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]
|
serialized_hash = serialized_hash.select { |k, _| options[:fields].include?(k) } if options[:fields]
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LanguageDetector
|
||||||
words = text.scan(RELIABLE_CHARACTERS_RE)
|
words = text.scan(RELIABLE_CHARACTERS_RE)
|
||||||
|
|
||||||
if words.present?
|
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
|
else
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
|
@ -287,7 +287,7 @@ class MediaAttachment < ApplicationRecord
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
size: "#{width}x#{height}",
|
size: "#{width}x#{height}",
|
||||||
aspect: width.to_f / height.to_f,
|
aspect: width.to_f / height,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ module Paperclip
|
||||||
min_side = [@current_geometry.width, @current_geometry.height].min.to_i
|
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
|
options[:geometry] = "#{min_side}x#{min_side}#" if @target_geometry.square? && min_side < @target_geometry.width
|
||||||
elsif options[:pixels]
|
elsif options[:pixels]
|
||||||
width = Math.sqrt(options[:pixels] * (@current_geometry.width.to_f / @current_geometry.height.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.to_f)).round.to_i
|
height = Math.sqrt(options[:pixels] * (@current_geometry.height.to_f / @current_geometry.width)).round.to_i
|
||||||
options[:geometry] = "#{width}x#{height}>"
|
options[:geometry] = "#{width}x#{height}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue