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:
- '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.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64

View File

@ -21,7 +21,7 @@ class Api::V1::BookmarksController < Api::BaseController
end
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),
params_slice(:max_id, :since_id, :min_id)
)

View File

@ -21,7 +21,7 @@ class Api::V1::FavouritesController < Api::BaseController
end
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),
params_slice(:max_id, :since_id, :min_id)
)

View File

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

View File

@ -143,11 +143,11 @@ class ActivityPub::Activity
end
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
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
def fetch_remote_original_status

View File

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

View File

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

View File

@ -5,9 +5,9 @@ require 'doorkeeper/grape/authorization_decorator'
class Rack::Attack
class Request
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.configuration.access_token_methods
)