diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 036fa37fa6135251d7f209cc824e02006da25384..9de96aa5bc0e826c621bbcfa8b1fdc11b7b2058b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 diff --git a/app/controllers/api/v1/bookmarks_controller.rb b/app/controllers/api/v1/bookmarks_controller.rb index 0cc23184098489daaa3583d02f1644bd7faab519..498eb16f44ca207fd5feabbbaf4146e7d250d25c 100644 --- a/app/controllers/api/v1/bookmarks_controller.rb +++ b/app/controllers/api/v1/bookmarks_controller.rb @@ -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) ) diff --git a/app/controllers/api/v1/favourites_controller.rb b/app/controllers/api/v1/favourites_controller.rb index bd7f3d775ea02cb5bf4df620452c310ad6fe53c5..faf1bda96ad074c0eda6b3394b8807ac6578099c 100644 --- a/app/controllers/api/v1/favourites_controller.rb +++ b/app/controllers/api/v1/favourites_controller.rb @@ -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) ) diff --git a/app/controllers/concerns/rate_limit_headers.rb b/app/controllers/concerns/rate_limit_headers.rb index 30702f00e7311413622f7813ea4ae91f3bcc7fbe..5b83d8575ba5c47a225f8abb6d1d599d1ce785a1 100644 --- a/app/controllers/concerns/rate_limit_headers.rb +++ b/app/controllers/concerns/rate_limit_headers.rb @@ -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 diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb index 5d95962548c3939101f8ed1ee769e9d72d21724e..51384ef984657df96ad8f55a7174c29a6a5db484 100644 --- a/app/lib/activitypub/activity.rb +++ b/app/lib/activitypub/activity.rb @@ -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 diff --git a/app/services/resolve_url_service.rb b/app/services/resolve_url_service.rb index d6e528654fda594902b154fbed78c67e9c5c8e4b..19a94e77ad13bfde9fd9e5694367b7526b508169 100644 --- a/app/services/resolve_url_service.rb +++ b/app/services/resolve_url_service.rb @@ -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 diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 778ea85fb46fdfefc2f96268ff9ebdf16eb6f898..30937471bd5e564f7aa0ceb7f666ea5dcef35131 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -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 diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index da0b04af115203ecb860d1dcac905c36fd811ebd..d0af0fe9409fb08deb85f32328a5c656e6d9ad33 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -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 )