Fix Naming/MemoizedInstanceVariableName cop (#25928)

This commit is contained in:
Matt Jankowski 2023-07-12 04:08:51 -04:00 committed by GitHub
parent 5134fc65e2
commit 2e1391fdd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 22 deletions

View File

@ -158,19 +158,6 @@ Naming/FileName:
Exclude: Exclude:
- 'config/locales/sr-Latn.rb' - 'config/locales/sr-Latn.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Naming/MemoizedInstanceVariableName:
Exclude:
- 'app/controllers/api/v1/bookmarks_controller.rb'
- 'app/controllers/api/v1/favourites_controller.rb'
- 'app/controllers/concerns/rate_limit_headers.rb'
- 'app/lib/activitypub/activity.rb'
- 'app/services/resolve_url_service.rb'
- 'app/services/search_service.rb'
- 'config/initializers/rack_attack.rb'
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer # SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64

View File

@ -21,7 +21,7 @@ class Api::V1::BookmarksController < Api::BaseController
end end
def results def results
@_results ||= account_bookmarks.joins(:status).eager_load(:status).to_a_paginated_by_id( @results ||= account_bookmarks.joins(:status).eager_load(:status).to_a_paginated_by_id(
limit_param(DEFAULT_STATUSES_LIMIT), limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id) params_slice(:max_id, :since_id, :min_id)
) )

View File

@ -21,7 +21,7 @@ class Api::V1::FavouritesController < Api::BaseController
end end
def results def results
@_results ||= account_favourites.joins(:status).eager_load(:status).to_a_paginated_by_id( @results ||= account_favourites.joins(:status).eager_load(:status).to_a_paginated_by_id(
limit_param(DEFAULT_STATUSES_LIMIT), limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id) params_slice(:max_id, :since_id, :min_id)
) )

View File

@ -61,7 +61,7 @@ module RateLimitHeaders
end end
def request_time def request_time
@_request_time ||= Time.now.utc @request_time ||= Time.now.utc
end end
def reset_period_offset def reset_period_offset

View File

@ -143,11 +143,11 @@ class ActivityPub::Activity
end end
def follow_request_from_object def follow_request_from_object
@follow_request ||= FollowRequest.find_by(target_account: @account, uri: object_uri) unless object_uri.nil? @follow_request_from_object ||= FollowRequest.find_by(target_account: @account, uri: object_uri) unless object_uri.nil?
end end
def follow_from_object def follow_from_object
@follow ||= ::Follow.find_by(target_account: @account, uri: object_uri) unless object_uri.nil? @follow_from_object ||= ::Follow.find_by(target_account: @account, uri: object_uri) unless object_uri.nil?
end end
def fetch_remote_original_status def fetch_remote_original_status

View File

@ -63,7 +63,7 @@ class ResolveURLService < BaseService
end end
def fetch_resource_service def fetch_resource_service
@_fetch_resource_service ||= FetchResourceService.new @fetch_resource_service ||= FetchResourceService.new
end end
def resource_url def resource_url

View File

@ -82,7 +82,7 @@ class SearchService < BaseService
end end
def url_resource def url_resource
@_url_resource ||= ResolveURLService.new.call(@query, on_behalf_of: @account) @url_resource ||= ResolveURLService.new.call(@query, on_behalf_of: @account)
end end
def url_resource_symbol def url_resource_symbol

View File

@ -5,9 +5,9 @@ require 'doorkeeper/grape/authorization_decorator'
class Rack::Attack class Rack::Attack
class Request class Request
def authenticated_token def authenticated_token
return @token if defined?(@token) return @authenticated_token if defined?(@authenticated_token)
@token = Doorkeeper::OAuth::Token.authenticate( @authenticated_token = Doorkeeper::OAuth::Token.authenticate(
Doorkeeper::Grape::AuthorizationDecorator.new(self), Doorkeeper::Grape::AuthorizationDecorator.new(self),
*Doorkeeper.configuration.access_token_methods *Doorkeeper.configuration.access_token_methods
) )