Rails/HasAndBelongsToMany:
Enabled: false
+Bundler/OrderedGems:
+ Enabled: false
+
AllCops:
TargetRubyVersion: 2.3
Exclude:
def valid_otp_attempt?(user)
user.validate_and_consume_otp!(user_params[:otp_attempt]) ||
user.invalidate_otp_backup_code!(user_params[:otp_attempt])
- rescue OpenSSL::Cipher::CipherError => error
+ rescue OpenSSL::Cipher::CipherError => _error
false
end
end
def default_locale
- ENV.fetch('DEFAULT_LOCALE') {
+ ENV.fetch('DEFAULT_LOCALE') do
user_supplied_locale || I18n.default_locale
- }
+ end
end
def user_supplied_locale
I18n.with_locale(@me.user.locale || I18n.default_locale) do
mail to: @me.user.email,
- subject: I18n.t(
- :subject,
- scope: [:notification_mailer, :digest],
- count: @notifications.size
- )
+ subject: I18n.t(
+ :subject,
+ scope: [:notification_mailer, :digest],
+ count: @notifications.size
+ )
end
end
end
scope :by_domain_accounts, -> { group(:domain).select(:domain, 'COUNT(*) AS accounts_count').order('accounts_count desc') }
delegate :email,
- :current_sign_in_ip,
- :current_sign_in_at,
- :confirmed?,
- to: :user,
- prefix: true,
- allow_nil: true
+ :current_sign_in_ip,
+ :current_sign_in_at,
+ :confirmed?,
+ to: :user,
+ prefix: true,
+ allow_nil: true
def follow!(other_account)
active_relationships.where(target_account: other_account).first_or_create!(target_account: other_account)
private
def follow_mapping(query, field)
- query.pluck(field).inject({}) { |mapping, id| mapping[id] = true; mapping }
+ query.pluck(field).each_with_object({}) { |id, mapping| mapping[id] = true }
end
def avatar_styles(file)
extend ActiveSupport::Concern
included do
- scope :paginate_by_max_id, -> (limit, max_id = nil, since_id = nil) {
+ scope :paginate_by_max_id, ->(limit, max_id = nil, since_id = nil) {
query = order(arel_table[:id].desc).limit(limit)
query = query.where(arel_table[:id].lt(max_id)) unless max_id.blank?
query = query.where(arel_table[:id].gt(since_id)) unless since_id.blank?