diff options
author | gfyoung <gfyoung17@gmail.com> | 2018-09-23 22:44:14 +0300 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2018-09-23 22:48:02 +0300 |
commit | be42c05054bda2417fdd26e86e0f4c80c9d0ccb6 (patch) | |
tree | 50c21744e03193fa6ee2458d3904b127ac4317ef | |
parent | 4c8d2232ca3e4b97a313e9ac4d96dee2b3de9e84 (diff) |
Enable more frozen string in app/controllers/
Enables frozen string for the following:
* app/controllers/dashboard/**/*.rb
* app/controllers/explore/**/*.rb
* app/controllers/google_api/**/*.rb
* app/controllers/groups/**/*.rb
* app/controllers/import/**/*.rb
* app/controllers/instance_statistics/**/*.rb
* app/controllers/ldap/**/*.rb
* app/controllers/oauth/**/*.rb
* app/controllers/profiles/**/*.rb
Partially addresses #47424.
52 files changed, 108 insertions, 1 deletions
diff --git a/app/controllers/dashboard/application_controller.rb b/app/controllers/dashboard/application_controller.rb index 9fb5c525425..cee0753a021 100644 --- a/app/controllers/dashboard/application_controller.rb +++ b/app/controllers/dashboard/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Dashboard::ApplicationController < ApplicationController include ControllerWithCrossProjectAccessCheck diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb index 79f563bef86..f82cde8e10a 100644 --- a/app/controllers/dashboard/groups_controller.rb +++ b/app/controllers/dashboard/groups_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Dashboard::GroupsController < Dashboard::ApplicationController include GroupTree diff --git a/app/controllers/dashboard/labels_controller.rb b/app/controllers/dashboard/labels_controller.rb index 9dcb3a0eb6d..89d87c2d5c8 100644 --- a/app/controllers/dashboard/labels_controller.rb +++ b/app/controllers/dashboard/labels_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Dashboard::LabelsController < Dashboard::ApplicationController def index respond_to do |format| diff --git a/app/controllers/dashboard/milestones_controller.rb b/app/controllers/dashboard/milestones_controller.rb index 78f7f6d4e23..6e17bc212e4 100644 --- a/app/controllers/dashboard/milestones_controller.rb +++ b/app/controllers/dashboard/milestones_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Dashboard::MilestonesController < Dashboard::ApplicationController include MilestoneActions diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index e8f796f17ca..e9686ed8d06 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Dashboard::ProjectsController < Dashboard::ApplicationController include ParamsBackwardCompatibility include RendersMemberAccess diff --git a/app/controllers/dashboard/snippets_controller.rb b/app/controllers/dashboard/snippets_controller.rb index 0ba97e4fd59..161c22046f9 100644 --- a/app/controllers/dashboard/snippets_controller.rb +++ b/app/controllers/dashboard/snippets_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Dashboard::SnippetsController < Dashboard::ApplicationController skip_cross_project_access_check :index diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 231a23427f7..b82caf30a91 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Dashboard::TodosController < Dashboard::ApplicationController include ActionView::Helpers::NumberHelper diff --git a/app/controllers/explore/application_controller.rb b/app/controllers/explore/application_controller.rb index baf54520b9c..8eee3742d89 100644 --- a/app/controllers/explore/application_controller.rb +++ b/app/controllers/explore/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Explore::ApplicationController < ApplicationController skip_before_action :authenticate_user! diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb index fa0a0f68fbc..67db797b80a 100644 --- a/app/controllers/explore/groups_controller.rb +++ b/app/controllers/explore/groups_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Explore::GroupsController < Explore::ApplicationController include GroupTree diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb index 03a2ee07fea..7ecbc32cf4e 100644 --- a/app/controllers/explore/projects_controller.rb +++ b/app/controllers/explore/projects_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Explore::ProjectsController < Explore::ApplicationController include ParamsBackwardCompatibility include RendersMemberAccess diff --git a/app/controllers/explore/snippets_controller.rb b/app/controllers/explore/snippets_controller.rb index d3f0e033068..76ed142c939 100644 --- a/app/controllers/explore/snippets_controller.rb +++ b/app/controllers/explore/snippets_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Explore::SnippetsController < Explore::ApplicationController def index @snippets = SnippetsFinder.new(current_user).execute diff --git a/app/controllers/google_api/authorizations_controller.rb b/app/controllers/google_api/authorizations_controller.rb index 5551057ff55..dd9f5af61b3 100644 --- a/app/controllers/google_api/authorizations_controller.rb +++ b/app/controllers/google_api/authorizations_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module GoogleApi class AuthorizationsController < ApplicationController def callback diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb index 62213561898..5f92333c2c3 100644 --- a/app/controllers/groups/application_controller.rb +++ b/app/controllers/groups/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::ApplicationController < ApplicationController include RoutableActions include ControllerWithCrossProjectAccessCheck diff --git a/app/controllers/groups/avatars_controller.rb b/app/controllers/groups/avatars_controller.rb index 35a61b359c8..8e4dc2bb6e9 100644 --- a/app/controllers/groups/avatars_controller.rb +++ b/app/controllers/groups/avatars_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::AvatarsController < Groups::ApplicationController before_action :authorize_admin_group! diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb index e892d1f8dbf..8d259b4052e 100644 --- a/app/controllers/groups/boards_controller.rb +++ b/app/controllers/groups/boards_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::BoardsController < Groups::ApplicationController include BoardsResponses diff --git a/app/controllers/groups/children_controller.rb b/app/controllers/groups/children_controller.rb index 0e8125d6113..d549f793ad7 100644 --- a/app/controllers/groups/children_controller.rb +++ b/app/controllers/groups/children_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class ChildrenController < Groups::ApplicationController before_action :group diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 7dc51f4c357..0bc082246a1 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::GroupMembersController < Groups::ApplicationController include MembershipActions include MembersPresentation diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb index 059cf160fa2..129a197ec9d 100644 --- a/app/controllers/groups/labels_controller.rb +++ b/app/controllers/groups/labels_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::LabelsController < Groups::ApplicationController include ToggleSubscriptionAction diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index 6bdc0f79ef2..a7cee426cf1 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::MilestonesController < Groups::ApplicationController include MilestoneActions diff --git a/app/controllers/groups/runners_controller.rb b/app/controllers/groups/runners_controller.rb index 1036b4e6ed3..dd8fbf7a029 100644 --- a/app/controllers/groups/runners_controller.rb +++ b/app/controllers/groups/runners_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::RunnersController < Groups::ApplicationController # Proper policies should be implemented per # https://gitlab.com/gitlab-org/gitlab-ce/issues/45894 diff --git a/app/controllers/groups/settings/ci_cd_controller.rb b/app/controllers/groups/settings/ci_cd_controller.rb index 4bf6a2a3ad1..6d9a225b771 100644 --- a/app/controllers/groups/settings/ci_cd_controller.rb +++ b/app/controllers/groups/settings/ci_cd_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups module Settings class CiCdController < Groups::ApplicationController diff --git a/app/controllers/groups/shared_projects_controller.rb b/app/controllers/groups/shared_projects_controller.rb index 7dec1f5f402..30b7bfc70ae 100644 --- a/app/controllers/groups/shared_projects_controller.rb +++ b/app/controllers/groups/shared_projects_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class SharedProjectsController < Groups::ApplicationController respond_to :json diff --git a/app/controllers/groups/uploads_controller.rb b/app/controllers/groups/uploads_controller.rb index 74760194a1f..7e5cdae0ce3 100644 --- a/app/controllers/groups/uploads_controller.rb +++ b/app/controllers/groups/uploads_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Groups::UploadsController < Groups::ApplicationController include UploadsActions include WorkhorseRequest diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb index 4d8a20de017..4f641de0357 100644 --- a/app/controllers/groups/variables_controller.rb +++ b/app/controllers/groups/variables_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class VariablesController < Groups::ApplicationController before_action :authorize_admin_build! diff --git a/app/controllers/import/base_controller.rb b/app/controllers/import/base_controller.rb index 14b8c6e4137..042b6b1264f 100644 --- a/app/controllers/import/base_controller.rb +++ b/app/controllers/import/base_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::BaseController < ApplicationController private diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb index f885e04b198..1b30b4dda36 100644 --- a/app/controllers/import/bitbucket_controller.rb +++ b/app/controllers/import/bitbucket_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::BitbucketController < Import::BaseController before_action :verify_bitbucket_import_enabled before_action :bitbucket_auth, except: :callback diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb index df96d181153..5a439e6de78 100644 --- a/app/controllers/import/fogbugz_controller.rb +++ b/app/controllers/import/fogbugz_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::FogbugzController < Import::BaseController before_action :verify_fogbugz_import_enabled before_action :user_map, only: [:new_user_map, :create_user_map] diff --git a/app/controllers/import/gitea_controller.rb b/app/controllers/import/gitea_controller.rb index fbd851c64a7..382c684a408 100644 --- a/app/controllers/import/gitea_controller.rb +++ b/app/controllers/import/gitea_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::GiteaController < Import::GithubController def new if session[access_token_key].present? && session[host_key].present? diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb index f8b43b4fde5..1dfa814cdd5 100644 --- a/app/controllers/import/github_controller.rb +++ b/app/controllers/import/github_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::GithubController < Import::BaseController before_action :verify_import_enabled before_action :provider_auth, only: [:status, :jobs, :create] diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb index bdc402b0a77..498de0b07b8 100644 --- a/app/controllers/import/gitlab_controller.rb +++ b/app/controllers/import/gitlab_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::GitlabController < Import::BaseController MAX_PROJECT_PAGES = 15 PER_PAGE_PROJECTS = 100 diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb index f21c38a4c27..354fba5d204 100644 --- a/app/controllers/import/gitlab_projects_controller.rb +++ b/app/controllers/import/gitlab_projects_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::GitlabProjectsController < Import::BaseController before_action :whitelist_query_limiting, only: [:create] before_action :verify_gitlab_project_import_enabled diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb index e9387d0ad14..331f06c3dd6 100644 --- a/app/controllers/import/google_code_controller.rb +++ b/app/controllers/import/google_code_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::GoogleCodeController < Import::BaseController before_action :verify_google_code_import_enabled before_action :user_map, only: [:new_user_map, :create_user_map] diff --git a/app/controllers/import/manifest_controller.rb b/app/controllers/import/manifest_controller.rb index 4ed9dca2475..320cd45b925 100644 --- a/app/controllers/import/manifest_controller.rb +++ b/app/controllers/import/manifest_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Import::ManifestController < Import::BaseController before_action :whitelist_query_limiting, only: [:create] before_action :verify_import_enabled diff --git a/app/controllers/ldap/omniauth_callbacks_controller.rb b/app/controllers/ldap/omniauth_callbacks_controller.rb index fb24edb8602..5e872804448 100644 --- a/app/controllers/ldap/omniauth_callbacks_controller.rb +++ b/app/controllers/ldap/omniauth_callbacks_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Ldap::OmniauthCallbacksController < OmniauthCallbacksController extend ::Gitlab::Utils::Override diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb index 9e700f648f4..b50f140dc80 100644 --- a/app/controllers/oauth/applications_controller.rb +++ b/app/controllers/oauth/applications_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Oauth::ApplicationsController < Doorkeeper::ApplicationsController include Gitlab::GonHelper include Gitlab::Allowable diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb index 05190103767..894a6a431e3 100644 --- a/app/controllers/oauth/authorizations_controller.rb +++ b/app/controllers/oauth/authorizations_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController layout 'profile' diff --git a/app/controllers/oauth/authorized_applications_controller.rb b/app/controllers/oauth/authorized_applications_controller.rb index 656107d2b26..a59ade559b3 100644 --- a/app/controllers/oauth/authorized_applications_controller.rb +++ b/app/controllers/oauth/authorized_applications_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController include PageLayoutHelper diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/profiles/accounts_controller.rb index fd9cb9fca3e..cb3180f4196 100644 --- a/app/controllers/profiles/accounts_controller.rb +++ b/app/controllers/profiles/accounts_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::AccountsController < Profiles::ApplicationController include AuthHelper diff --git a/app/controllers/profiles/active_sessions_controller.rb b/app/controllers/profiles/active_sessions_controller.rb index f1e77d68acd..efe7ede5efa 100644 --- a/app/controllers/profiles/active_sessions_controller.rb +++ b/app/controllers/profiles/active_sessions_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::ActiveSessionsController < Profiles::ApplicationController def index @sessions = ActiveSession.list(current_user) diff --git a/app/controllers/profiles/application_controller.rb b/app/controllers/profiles/application_controller.rb index c8be288b9a0..52b046ef64f 100644 --- a/app/controllers/profiles/application_controller.rb +++ b/app/controllers/profiles/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::ApplicationController < ApplicationController layout 'profile' end diff --git a/app/controllers/profiles/avatars_controller.rb b/app/controllers/profiles/avatars_controller.rb index 4f030ded80f..3378a09628c 100644 --- a/app/controllers/profiles/avatars_controller.rb +++ b/app/controllers/profiles/avatars_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::AvatarsController < Profiles::ApplicationController def destroy @user = current_user diff --git a/app/controllers/profiles/chat_names_controller.rb b/app/controllers/profiles/chat_names_controller.rb index a186c5f36a8..2e78b9e6dc7 100644 --- a/app/controllers/profiles/chat_names_controller.rb +++ b/app/controllers/profiles/chat_names_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::ChatNamesController < Profiles::ApplicationController before_action :chat_name_token, only: [:new] before_action :chat_name_params, only: [:new, :create, :deny] diff --git a/app/controllers/profiles/emails_controller.rb b/app/controllers/profiles/emails_controller.rb index a39824ec9c8..503eda250b4 100644 --- a/app/controllers/profiles/emails_controller.rb +++ b/app/controllers/profiles/emails_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::EmailsController < Profiles::ApplicationController before_action :find_email, only: [:destroy, :resend_confirmation_instructions] diff --git a/app/controllers/profiles/gpg_keys_controller.rb b/app/controllers/profiles/gpg_keys_controller.rb index c32507756e8..8c34a66c374 100644 --- a/app/controllers/profiles/gpg_keys_controller.rb +++ b/app/controllers/profiles/gpg_keys_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::GpgKeysController < Profiles::ApplicationController before_action :set_gpg_key, only: [:destroy, :revoke] diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb index 6035258667e..01801c31327 100644 --- a/app/controllers/profiles/keys_controller.rb +++ b/app/controllers/profiles/keys_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::KeysController < Profiles::ApplicationController skip_before_action :authenticate_user!, only: [:get_keys] diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 00bd2040b9a..b719b70c56e 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::NotificationsController < Profiles::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def show diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb index b8ccc6e3c99..a0391d677c4 100644 --- a/app/controllers/profiles/passwords_controller.rb +++ b/app/controllers/profiles/passwords_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::PasswordsController < Profiles::ApplicationController skip_before_action :check_password_expiration, only: [:new, :create] skip_before_action :check_two_factor_requirement, only: [:new, :create] diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb index b357741e3fb..4b6ec2697b7 100644 --- a/app/controllers/profiles/personal_access_tokens_controller.rb +++ b/app/controllers/profiles/personal_access_tokens_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::PersonalAccessTokensController < Profiles::ApplicationController def index set_index_vars diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index ed0f98179eb..37ac11dc6a1 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::PreferencesController < Profiles::ApplicationController before_action :user diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb index 29ff18a1219..ba94196b2f9 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/profiles/two_factor_auths_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::TwoFactorAuthsController < Profiles::ApplicationController skip_before_action :check_two_factor_requirement @@ -30,7 +32,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController unless two_factor_grace_period_expired? grace_period_deadline = current_user.otp_grace_period_started_at + two_factor_grace_period.hours - flash.now[:alert] << " You need to do this before #{l(grace_period_deadline)}." + flash.now[:alert] = flash.now[:alert] + " You need to do this before #{l(grace_period_deadline)}." end end diff --git a/app/controllers/profiles/u2f_registrations_controller.rb b/app/controllers/profiles/u2f_registrations_controller.rb index e3d7737f44a..e6a154fb6aa 100644 --- a/app/controllers/profiles/u2f_registrations_controller.rb +++ b/app/controllers/profiles/u2f_registrations_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Profiles::U2fRegistrationsController < Profiles::ApplicationController def destroy u2f_registration = current_user.u2f_registrations.find(params[:id]) diff --git a/changelogs/unreleased/frozen-string-app-controller-more.yml b/changelogs/unreleased/frozen-string-app-controller-more.yml new file mode 100644 index 00000000000..ea2c81e7afc --- /dev/null +++ b/changelogs/unreleased/frozen-string-app-controller-more.yml @@ -0,0 +1,5 @@ +--- +title: Enable more frozen string in app/controllers/ +merge_request: +author: gfyoung +type: performance |