Fix rubocop warning (#14288)

* Fix rubocop warning

* use limit variable

* use ContextCreatingMethods option
This commit is contained in:
abcang 2020-07-15 02:05:07 +09:00 committed by GitHub
parent a8e84a18f1
commit 6a96af4d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 7 deletions

View File

@ -28,6 +28,10 @@ Layout/EmptyLineAfterMagicComment:
Layout/SpaceInsideHashLiteralBraces: Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: space EnforcedStyle: space
Lint/UselessAccessModifier:
ContextCreatingMethods:
- class_methods
Metrics/AbcSize: Metrics/AbcSize:
Max: 100 Max: 100

View File

@ -46,6 +46,7 @@ class Auth::SessionsController < Devise::SessionsController
user = User.authenticate_with_ldap(user_params) if Devise.ldap_authentication user = User.authenticate_with_ldap(user_params) if Devise.ldap_authentication
user ||= User.authenticate_with_pam(user_params) if Devise.pam_authentication user ||= User.authenticate_with_pam(user_params) if Devise.pam_authentication
user ||= User.find_for_authentication(email: user_params[:email]) user ||= User.find_for_authentication(email: user_params[:email])
user
end end
end end

View File

@ -27,7 +27,7 @@ class TagsController < ApplicationController
expires_in 0, public: true expires_in 0, public: true
limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE
@statuses = HashtagQueryService.new.call(@tag, filter_params, nil, @local).limit(PAGE_SIZE) @statuses = HashtagQueryService.new.call(@tag, filter_params, nil, @local).limit(limit)
@statuses = cache_collection(@statuses, Status) @statuses = cache_collection(@statuses, Status)
render xml: RSS::TagSerializer.render(@tag, @statuses) render xml: RSS::TagSerializer.render(@tag, @statuses)

View File

@ -45,7 +45,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
RedisLock.acquire(lock_options) do |lock| RedisLock.acquire(lock_options) do |lock|
if lock.acquired? if lock.acquired?
return if delete_arrived_first?(object_uri) || poll_vote? return if delete_arrived_first?(object_uri) || poll_vote? # rubocop:disable Lint/NonLocalExitFromIterator
@status = find_existing_status @status = find_existing_status

View File

@ -55,7 +55,7 @@ class ProofProvider::Keybase::ConfigSerializer < ActiveModel::Serializer
end end
def profile_url def profile_url
CGI.unescape(short_account_url('%{username}')) # rubocop:disable Style/FormatStringToken CGI.unescape(short_account_url('%{username}'))
end end
def check_url def check_url

View File

@ -231,6 +231,7 @@ class Request
begin begin
sock.connect_nonblock(addr_by_socket[sock]) sock.connect_nonblock(addr_by_socket[sock])
rescue Errno::EISCONN rescue Errno::EISCONN
# Do nothing
rescue => e rescue => e
sock.close sock.close
outer_e = e outer_e = e

View File

@ -11,7 +11,7 @@ module Settings
@object = object @object = object
end end
# rubocop:disable Style/MethodMissing # rubocop:disable Style/MethodMissingSuper
def method_missing(method, *args) def method_missing(method, *args)
method_name = method.to_s method_name = method.to_s
# set a value for a variable # set a value for a variable
@ -24,7 +24,7 @@ module Settings
self[method_name] self[method_name]
end end
end end
# rubocop:enable Style/MethodMissing # rubocop:enable Style/MethodMissingSuper
def respond_to_missing?(*) def respond_to_missing?(*)
true true
@ -48,7 +48,6 @@ module Settings
record.update!(value: value) record.update!(value: value)
Rails.cache.write(Setting.cache_key(key, @object), value) Rails.cache.write(Setting.cache_key(key, @object), value)
value
end end
def [](key) def [](key)

View File

@ -57,7 +57,7 @@ module Omniauthable
user = User.new(user_params_from_auth(email, auth)) user = User.new(user_params_from_auth(email, auth))
user.account.avatar_remote_url = auth.info.image if auth.info.image =~ /\A#{URI.regexp(%w(http https))}\z/ user.account.avatar_remote_url = auth.info.image if auth.info.image =~ /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/
user.skip_confirmation! user.skip_confirmation!
user.save! user.save!
user user