diff options
author | gfyoung <gfyoung17@gmail.com> | 2018-09-13 22:42:05 -0700 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2018-09-18 21:22:45 -0700 |
commit | 73322a0e551bbbc42d429b15e7ad9fd375ab761d (patch) | |
tree | cfb28cb2ef99f11dbb055a81db283b8269e2e1ab | |
parent | 2dac058de25dc6ed03d0ed6f8b099aa17cdc1cab (diff) | |
download | gitlab-ce-repo-forks/gitlab-ce-frozen-string-app-controller.tar.gz |
Enable frozen string in app/controllers/**/*.rbrepo-forks/gitlab-ce-frozen-string-app-controller
Enables frozen string for the following:
* app/controllers/*.rb
* app/controllers/admin/**/*.rb
* app/controllers/boards/**/*.rb
* app/controllers/ci/**/*.rb
* app/controllers/concerns/**/*.rb
Partially addresses #47424.
105 files changed, 221 insertions, 9 deletions
diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb index 51547ed7eaf..68e14f0c2e5 100644 --- a/app/controllers/abuse_reports_controller.rb +++ b/app/controllers/abuse_reports_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AbuseReportsController < ApplicationController before_action :set_user, only: [:new] diff --git a/app/controllers/admin/abuse_reports_controller.rb b/app/controllers/admin/abuse_reports_controller.rb index 68a49f0749f..d5537023b26 100644 --- a/app/controllers/admin/abuse_reports_controller.rb +++ b/app/controllers/admin/abuse_reports_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::AbuseReportsController < Admin::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def index diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/appearances_controller.rb index 9aaec905734..fdd3b4126ff 100644 --- a/app/controllers/admin/appearances_controller.rb +++ b/app/controllers/admin/appearances_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::AppearancesController < Admin::ApplicationController before_action :set_appearance, except: :create diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index a4648b33cfa..ef182b981f1 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Provides a base class for Admin controllers to subclass # # Automatically sets the layout and ensures an administrator is logged in diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 869213d61f1..faee2880c67 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::ApplicationSettingsController < Admin::ApplicationController before_action :set_application_setting diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index daa21d1be93..00d2cc01192 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::ApplicationsController < Admin::ApplicationController include OauthApplications diff --git a/app/controllers/admin/background_jobs_controller.rb b/app/controllers/admin/background_jobs_controller.rb index 5f90ad7137d..7701f2e645b 100644 --- a/app/controllers/admin/background_jobs_controller.rb +++ b/app/controllers/admin/background_jobs_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::BackgroundJobsController < Admin::ApplicationController def show ps_output, _ = Gitlab::Popen.popen(%W(ps ww -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index b2fbbfc3e64..a91d9a534cd 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::BroadcastMessagesController < Admin::ApplicationController include BroadcastMessagesHelper diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 5dc3e6c2990..b5fb5511638 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::DashboardController < Admin::ApplicationController include CountHelper diff --git a/app/controllers/admin/deploy_keys_controller.rb b/app/controllers/admin/deploy_keys_controller.rb index 5c2025c1988..49ce275ad14 100644 --- a/app/controllers/admin/deploy_keys_controller.rb +++ b/app/controllers/admin/deploy_keys_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::DeployKeysController < Admin::ApplicationController before_action :deploy_keys, only: [:index] before_action :deploy_key, only: [:destroy, :edit, :update] diff --git a/app/controllers/admin/gitaly_servers_controller.rb b/app/controllers/admin/gitaly_servers_controller.rb index 11c4dfe3d8d..0a5566bfe70 100644 --- a/app/controllers/admin/gitaly_servers_controller.rb +++ b/app/controllers/admin/gitaly_servers_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::GitalyServersController < Admin::ApplicationController def index @gitaly_servers = Gitaly::Server.all diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 2a47f01c6ad..46e85e1424f 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::GroupsController < Admin::ApplicationController include MembersPresentation diff --git a/app/controllers/admin/health_check_controller.rb b/app/controllers/admin/health_check_controller.rb index 61247b280b3..44864f9c7d0 100644 --- a/app/controllers/admin/health_check_controller.rb +++ b/app/controllers/admin/health_check_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::HealthCheckController < Admin::ApplicationController def show @errors = HealthCheck::Utils.process_checks(['standard']) diff --git a/app/controllers/admin/hook_logs_controller.rb b/app/controllers/admin/hook_logs_controller.rb index 3017f96c26f..8301b3aa880 100644 --- a/app/controllers/admin/hook_logs_controller.rb +++ b/app/controllers/admin/hook_logs_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::HookLogsController < Admin::ApplicationController include HooksExecution diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb index a98c355c7ba..d0abdec50ae 100644 --- a/app/controllers/admin/hooks_controller.rb +++ b/app/controllers/admin/hooks_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::HooksController < Admin::ApplicationController include HooksExecution diff --git a/app/controllers/admin/identities_controller.rb b/app/controllers/admin/identities_controller.rb index 57ad7389a23..b51c2f678ca 100644 --- a/app/controllers/admin/identities_controller.rb +++ b/app/controllers/admin/identities_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::IdentitiesController < Admin::ApplicationController before_action :user before_action :identity, except: [:index, :new, :create] diff --git a/app/controllers/admin/impersonation_tokens_controller.rb b/app/controllers/admin/impersonation_tokens_controller.rb index 9ebba88ef16..f5825ecb19a 100644 --- a/app/controllers/admin/impersonation_tokens_controller.rb +++ b/app/controllers/admin/impersonation_tokens_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::ImpersonationTokensController < Admin::ApplicationController before_action :user diff --git a/app/controllers/admin/impersonations_controller.rb b/app/controllers/admin/impersonations_controller.rb index d2f947d2c66..08d7e3b4fa2 100644 --- a/app/controllers/admin/impersonations_controller.rb +++ b/app/controllers/admin/impersonations_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::ImpersonationsController < Admin::ApplicationController skip_before_action :authenticate_admin! before_action :authenticate_impersonator! diff --git a/app/controllers/admin/jobs_controller.rb b/app/controllers/admin/jobs_controller.rb index 788693c62c4..0c1afdc3d3b 100644 --- a/app/controllers/admin/jobs_controller.rb +++ b/app/controllers/admin/jobs_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::JobsController < Admin::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def index diff --git a/app/controllers/admin/keys_controller.rb b/app/controllers/admin/keys_controller.rb index 0400a3b2f3b..4e9262ccc96 100644 --- a/app/controllers/admin/keys_controller.rb +++ b/app/controllers/admin/keys_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::KeysController < Admin::ApplicationController before_action :user, only: [:show, :destroy] diff --git a/app/controllers/admin/labels_controller.rb b/app/controllers/admin/labels_controller.rb index 7eb8f758807..aa5eae7a474 100644 --- a/app/controllers/admin/labels_controller.rb +++ b/app/controllers/admin/labels_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::LabelsController < Admin::ApplicationController before_action :set_label, only: [:show, :edit, :update, :destroy] diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb index 7248edb64e1..06b0e6a15a3 100644 --- a/app/controllers/admin/logs_controller.rb +++ b/app/controllers/admin/logs_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::LogsController < Admin::ApplicationController before_action :loggers diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 5cb08c9787b..550f29a58d2 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::ProjectsController < Admin::ApplicationController include MembersPresentation diff --git a/app/controllers/admin/requests_profiles_controller.rb b/app/controllers/admin/requests_profiles_controller.rb index a478176e138..64d74ae4231 100644 --- a/app/controllers/admin/requests_profiles_controller.rb +++ b/app/controllers/admin/requests_profiles_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::RequestsProfilesController < Admin::ApplicationController def index @profile_token = Gitlab::RequestProfiler.profile_token diff --git a/app/controllers/admin/runner_projects_controller.rb b/app/controllers/admin/runner_projects_controller.rb index 51d5799cd89..774ce04d079 100644 --- a/app/controllers/admin/runner_projects_controller.rb +++ b/app/controllers/admin/runner_projects_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::RunnerProjectsController < Admin::ApplicationController before_action :project, only: [:create] diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 911603bac17..0b6ff491c66 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::RunnersController < Admin::ApplicationController before_action :runner, except: :index diff --git a/app/controllers/admin/spam_logs_controller.rb b/app/controllers/admin/spam_logs_controller.rb index 8df35d25303..18d22c95b61 100644 --- a/app/controllers/admin/spam_logs_controller.rb +++ b/app/controllers/admin/spam_logs_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::SpamLogsController < Admin::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def index diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb index 99039724521..244fc2b31bb 100644 --- a/app/controllers/admin/system_info_controller.rb +++ b/app/controllers/admin/system_info_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::SystemInfoController < Admin::ApplicationController EXCLUDED_MOUNT_OPTIONS = [ 'nobrowse', diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 85bdc85c55b..b783c0e2a6f 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Admin::UsersController < Admin::ApplicationController before_action :user, except: [:index, :new, :create] diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7e2b2cf3ad3..838527aaa41 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'gon' require 'fogbugz' diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index 9e30b982b06..3766b64a091 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AutocompleteController < ApplicationController skip_before_action :authenticate_user!, only: [:users, :award_emojis] diff --git a/app/controllers/boards/application_controller.rb b/app/controllers/boards/application_controller.rb index b2675025fc0..eab908ba5ed 100644 --- a/app/controllers/boards/application_controller.rb +++ b/app/controllers/boards/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards class ApplicationController < ::ApplicationController respond_to :json diff --git a/app/controllers/boards/issues_controller.rb b/app/controllers/boards/issues_controller.rb index 071906f1e91..4f3d737e3ce 100644 --- a/app/controllers/boards/issues_controller.rb +++ b/app/controllers/boards/issues_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards class IssuesController < Boards::ApplicationController include BoardsResponses diff --git a/app/controllers/boards/lists_controller.rb b/app/controllers/boards/lists_controller.rb index e8b5934f2a9..ccd02144671 100644 --- a/app/controllers/boards/lists_controller.rb +++ b/app/controllers/boards/lists_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards class ListsController < Boards::ApplicationController include BoardsResponses diff --git a/app/controllers/ci/lints_controller.rb b/app/controllers/ci/lints_controller.rb index 738a6a5173e..99ce24bd435 100644 --- a/app/controllers/ci/lints_controller.rb +++ b/app/controllers/ci/lints_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class LintsController < ::ApplicationController before_action :authenticate_user! diff --git a/app/controllers/concerns/accepts_pending_invitations.rb b/app/controllers/concerns/accepts_pending_invitations.rb index 6e8aef52b52..cb66c1a055d 100644 --- a/app/controllers/concerns/accepts_pending_invitations.rb +++ b/app/controllers/concerns/accepts_pending_invitations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module AcceptsPendingInvitations extend ActiveSupport::Concern diff --git a/app/controllers/concerns/authenticates_with_two_factor.rb b/app/controllers/concerns/authenticates_with_two_factor.rb index 961f121548b..5507328f8ae 100644 --- a/app/controllers/concerns/authenticates_with_two_factor.rb +++ b/app/controllers/concerns/authenticates_with_two_factor.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # == AuthenticatesWithTwoFactor # # Controller concern to handle two-factor authentication diff --git a/app/controllers/concerns/boards_responses.rb b/app/controllers/concerns/boards_responses.rb index da830ec2cb1..b7e4f9b81f1 100644 --- a/app/controllers/concerns/boards_responses.rb +++ b/app/controllers/concerns/boards_responses.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BoardsResponses include Gitlab::Utils::StrongMemoize diff --git a/app/controllers/concerns/checks_collaboration.rb b/app/controllers/concerns/checks_collaboration.rb index 81367663a06..1fa82f7dcd4 100644 --- a/app/controllers/concerns/checks_collaboration.rb +++ b/app/controllers/concerns/checks_collaboration.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ChecksCollaboration def can_collaborate_with_project?(project, ref: nil) return true if can?(current_user, :push_code, project) diff --git a/app/controllers/concerns/continue_params.rb b/app/controllers/concerns/continue_params.rb index 8b7355974df..f0e6adf4dec 100644 --- a/app/controllers/concerns/continue_params.rb +++ b/app/controllers/concerns/continue_params.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ContinueParams include InternalRedirect extend ActiveSupport::Concern diff --git a/app/controllers/concerns/controller_with_cross_project_access_check.rb b/app/controllers/concerns/controller_with_cross_project_access_check.rb index a45c3384578..3f72f092683 100644 --- a/app/controllers/concerns/controller_with_cross_project_access_check.rb +++ b/app/controllers/concerns/controller_with_cross_project_access_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ControllerWithCrossProjectAccessCheck extend ActiveSupport::Concern diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index 709c8aaf337..b3777fd2b0f 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module CreatesCommit extend ActiveSupport::Concern include Gitlab::Utils::StrongMemoize @@ -65,7 +67,7 @@ module CreatesCommit flash[:notice] = nil else target = different_project? ? "project" : "branch" - flash[:notice] << " You can now submit a merge request to get this change into the original #{target}." + flash[:notice] = flash[:notice] + " You can now submit a merge request to get this change into the original #{target}." end end end diff --git a/app/controllers/concerns/cycle_analytics_params.rb b/app/controllers/concerns/cycle_analytics_params.rb index 1ab107168c0..c1ef848e1e7 100644 --- a/app/controllers/concerns/cycle_analytics_params.rb +++ b/app/controllers/concerns/cycle_analytics_params.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module CycleAnalyticsParams extend ActiveSupport::Concern diff --git a/app/controllers/concerns/diff_for_path.rb b/app/controllers/concerns/diff_for_path.rb index d5388c4cd20..6be7a2a18a2 100644 --- a/app/controllers/concerns/diff_for_path.rb +++ b/app/controllers/concerns/diff_for_path.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module DiffForPath extend ActiveSupport::Concern diff --git a/app/controllers/concerns/enforces_two_factor_authentication.rb b/app/controllers/concerns/enforces_two_factor_authentication.rb index 69e5cbed343..71bdef8ce03 100644 --- a/app/controllers/concerns/enforces_two_factor_authentication.rb +++ b/app/controllers/concerns/enforces_two_factor_authentication.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # == EnforcesTwoFactorAuthentication # # Controller concern to enforce two-factor authentication requirements diff --git a/app/controllers/concerns/group_tree.rb b/app/controllers/concerns/group_tree.rb index c363cad0ffa..4f56346832c 100644 --- a/app/controllers/concerns/group_tree.rb +++ b/app/controllers/concerns/group_tree.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module GroupTree # rubocop:disable Gitlab/ModuleWithInstanceVariables # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/controllers/concerns/hooks_execution.rb b/app/controllers/concerns/hooks_execution.rb index a22e46b4860..e8add1f4055 100644 --- a/app/controllers/concerns/hooks_execution.rb +++ b/app/controllers/concerns/hooks_execution.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module HooksExecution extend ActiveSupport::Concern diff --git a/app/controllers/concerns/internal_redirect.rb b/app/controllers/concerns/internal_redirect.rb index 10b9852e329..4d3b5681757 100644 --- a/app/controllers/concerns/internal_redirect.rb +++ b/app/controllers/concerns/internal_redirect.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module InternalRedirect extend ActiveSupport::Concern diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index e723107bd7f..07e01e903ea 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module IssuableActions extend ActiveSupport::Concern diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index d29154d5c60..5217b4be928 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module IssuableCollections extend ActiveSupport::Concern include CookiesHelper diff --git a/app/controllers/concerns/issues_action.rb b/app/controllers/concerns/issues_action.rb index 9d58656773d..a75590457d6 100644 --- a/app/controllers/concerns/issues_action.rb +++ b/app/controllers/concerns/issues_action.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module IssuesAction extend ActiveSupport::Concern include IssuableCollections diff --git a/app/controllers/concerns/issues_calendar.rb b/app/controllers/concerns/issues_calendar.rb index 76e1d1ff4e8..1fdfde4c869 100644 --- a/app/controllers/concerns/issues_calendar.rb +++ b/app/controllers/concerns/issues_calendar.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module IssuesCalendar extend ActiveSupport::Concern diff --git a/app/controllers/concerns/lfs_request.rb b/app/controllers/concerns/lfs_request.rb index 4584ff782a3..9576eb14fdd 100644 --- a/app/controllers/concerns/lfs_request.rb +++ b/app/controllers/concerns/lfs_request.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This concern assumes: # - a `#project` accessor # - a `#user` accessor diff --git a/app/controllers/concerns/members_presentation.rb b/app/controllers/concerns/members_presentation.rb index e146e7574aa..c6c3598a976 100644 --- a/app/controllers/concerns/members_presentation.rb +++ b/app/controllers/concerns/members_presentation.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MembersPresentation extend ActiveSupport::Concern diff --git a/app/controllers/concerns/membership_actions.rb b/app/controllers/concerns/membership_actions.rb index 94a352c0bcc..ca713192c9e 100644 --- a/app/controllers/concerns/membership_actions.rb +++ b/app/controllers/concerns/membership_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MembershipActions include MembersPresentation extend ActiveSupport::Concern diff --git a/app/controllers/concerns/merge_requests_action.rb b/app/controllers/concerns/merge_requests_action.rb index b70db99b157..285f2c3a8a0 100644 --- a/app/controllers/concerns/merge_requests_action.rb +++ b/app/controllers/concerns/merge_requests_action.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MergeRequestsAction extend ActiveSupport::Concern include IssuableCollections diff --git a/app/controllers/concerns/milestone_actions.rb b/app/controllers/concerns/milestone_actions.rb index d92cf8b4894..eccbe35577b 100644 --- a/app/controllers/concerns/milestone_actions.rb +++ b/app/controllers/concerns/milestone_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module MilestoneActions extend ActiveSupport::Concern diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb index b63f2eb85f0..9422a06387b 100644 --- a/app/controllers/concerns/notes_actions.rb +++ b/app/controllers/concerns/notes_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module NotesActions include RendersNotes include Gitlab::Utils::StrongMemoize diff --git a/app/controllers/concerns/oauth_applications.rb b/app/controllers/concerns/oauth_applications.rb index f0a68f23566..d97e22df472 100644 --- a/app/controllers/concerns/oauth_applications.rb +++ b/app/controllers/concerns/oauth_applications.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module OauthApplications extend ActiveSupport::Concern diff --git a/app/controllers/concerns/params_backward_compatibility.rb b/app/controllers/concerns/params_backward_compatibility.rb index b0e3d9c7b34..c972d6e3161 100644 --- a/app/controllers/concerns/params_backward_compatibility.rb +++ b/app/controllers/concerns/params_backward_compatibility.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ParamsBackwardCompatibility private diff --git a/app/controllers/concerns/preview_markdown.rb b/app/controllers/concerns/preview_markdown.rb index 99123fcb3b0..c61b9fabe9e 100644 --- a/app/controllers/concerns/preview_markdown.rb +++ b/app/controllers/concerns/preview_markdown.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreviewMarkdown extend ActiveSupport::Concern diff --git a/app/controllers/concerns/renders_blob.rb b/app/controllers/concerns/renders_blob.rb index ba7adcfea86..b8026c7a01d 100644 --- a/app/controllers/concerns/renders_blob.rb +++ b/app/controllers/concerns/renders_blob.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RendersBlob extend ActiveSupport::Concern diff --git a/app/controllers/concerns/renders_commits.rb b/app/controllers/concerns/renders_commits.rb index b1c9b1e532f..f48e0586211 100644 --- a/app/controllers/concerns/renders_commits.rb +++ b/app/controllers/concerns/renders_commits.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RendersCommits def limited_commits(commits) if commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE diff --git a/app/controllers/concerns/renders_member_access.rb b/app/controllers/concerns/renders_member_access.rb index c5b77dacb26..955ac1a1bc8 100644 --- a/app/controllers/concerns/renders_member_access.rb +++ b/app/controllers/concerns/renders_member_access.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RendersMemberAccess def prepare_groups_for_rendering(groups) preload_max_member_access_for_collection(Group, groups) diff --git a/app/controllers/concerns/renders_notes.rb b/app/controllers/concerns/renders_notes.rb index c5f23e33424..ce36da6b715 100644 --- a/app/controllers/concerns/renders_notes.rb +++ b/app/controllers/concerns/renders_notes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RendersNotes # rubocop:disable Gitlab/ModuleWithInstanceVariables def prepare_notes_for_rendering(notes, noteable = nil) diff --git a/app/controllers/concerns/repository_settings_redirect.rb b/app/controllers/concerns/repository_settings_redirect.rb index f3db3cd563b..0f18735c29e 100644 --- a/app/controllers/concerns/repository_settings_redirect.rb +++ b/app/controllers/concerns/repository_settings_redirect.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RepositorySettingsRedirect extend ActiveSupport::Concern diff --git a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb index 88d1b34bb06..426f224d26b 100644 --- a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb +++ b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RequiresWhitelistedMonitoringClient extend ActiveSupport::Concern diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb index 0931bdf4c04..88939b002b2 100644 --- a/app/controllers/concerns/routable_actions.rb +++ b/app/controllers/concerns/routable_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RoutableActions extend ActiveSupport::Concern diff --git a/app/controllers/concerns/send_file_upload.rb b/app/controllers/concerns/send_file_upload.rb index 382ec91f771..0bb7b7efed0 100644 --- a/app/controllers/concerns/send_file_upload.rb +++ b/app/controllers/concerns/send_file_upload.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SendFileUpload def send_upload(file_upload, send_params: {}, redirect_params: {}, attachment: nil, disposition: 'attachment') if attachment diff --git a/app/controllers/concerns/service_params.rb b/app/controllers/concerns/service_params.rb index c1acb50b76c..8bd93a349ef 100644 --- a/app/controllers/concerns/service_params.rb +++ b/app/controllers/concerns/service_params.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ServiceParams extend ActiveSupport::Concern diff --git a/app/controllers/concerns/snippets_actions.rb b/app/controllers/concerns/snippets_actions.rb index 120614739aa..8c22490700c 100644 --- a/app/controllers/concerns/snippets_actions.rb +++ b/app/controllers/concerns/snippets_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SnippetsActions extend ActiveSupport::Concern diff --git a/app/controllers/concerns/spammable_actions.rb b/app/controllers/concerns/spammable_actions.rb index 922aa58a00f..c3a1b12af84 100644 --- a/app/controllers/concerns/spammable_actions.rb +++ b/app/controllers/concerns/spammable_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SpammableActions extend ActiveSupport::Concern diff --git a/app/controllers/concerns/todos_actions.rb b/app/controllers/concerns/todos_actions.rb index c0acdb3498d..78b65f7961b 100644 --- a/app/controllers/concerns/todos_actions.rb +++ b/app/controllers/concerns/todos_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module TodosActions extend ActiveSupport::Concern diff --git a/app/controllers/concerns/toggle_award_emoji.rb b/app/controllers/concerns/toggle_award_emoji.rb index ae0b815f85e..97b343f8b1a 100644 --- a/app/controllers/concerns/toggle_award_emoji.rb +++ b/app/controllers/concerns/toggle_award_emoji.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ToggleAwardEmoji extend ActiveSupport::Concern diff --git a/app/controllers/concerns/toggle_subscription_action.rb b/app/controllers/concerns/toggle_subscription_action.rb index 776583579e8..e613bfaeef2 100644 --- a/app/controllers/concerns/toggle_subscription_action.rb +++ b/app/controllers/concerns/toggle_subscription_action.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ToggleSubscriptionAction extend ActiveSupport::Concern diff --git a/app/controllers/concerns/uploads_actions.rb b/app/controllers/concerns/uploads_actions.rb index 56772df21d7..7a1c7abfb8f 100644 --- a/app/controllers/concerns/uploads_actions.rb +++ b/app/controllers/concerns/uploads_actions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module UploadsActions extend ActiveSupport::Concern diff --git a/app/controllers/concerns/with_performance_bar.rb b/app/controllers/concerns/with_performance_bar.rb index 6a8b1a4de7b..c12839c7bbd 100644 --- a/app/controllers/concerns/with_performance_bar.rb +++ b/app/controllers/concerns/with_performance_bar.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WithPerformanceBar extend ActiveSupport::Concern diff --git a/app/controllers/concerns/workhorse_request.rb b/app/controllers/concerns/workhorse_request.rb index 43c0f1b173c..028f10e866a 100644 --- a/app/controllers/concerns/workhorse_request.rb +++ b/app/controllers/concerns/workhorse_request.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WorkhorseRequest extend ActiveSupport::Concern diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index 7bc46a6ccc0..2c4aab67448 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ConfirmationsController < Devise::ConfirmationsController include AcceptsPendingInvitations @@ -20,7 +22,7 @@ class ConfirmationsController < Devise::ConfirmationsController after_sign_in(resource) else Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}") - flash[:notice] += " Please sign in." + flash[:notice] = flash[:notice] + " Please sign in." new_session_path(:user, anchor: 'login-pane') end end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index ff133001b84..241753a505a 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DashboardController < Dashboard::ApplicationController include IssuesAction include MergeRequestsAction diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb index 0a1cf169aca..a1ec144410b 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GraphqlController < ApplicationController # Unauthenticated users have access to the API for public data skip_before_action :authenticate_user! diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 8b46eedae79..062c8c4e9e1 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GroupsController < Groups::ApplicationController include API::Helpers::RelatedResourcesHelpers include IssuesAction diff --git a/app/controllers/health_check_controller.rb b/app/controllers/health_check_controller.rb index c3d18991fd4..a2abed7ba4e 100644 --- a/app/controllers/health_check_controller.rb +++ b/app/controllers/health_check_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class HealthCheckController < HealthCheck::HealthCheckController include RequiresWhitelistedMonitoringClient end diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 3fedd5bfb29..ab4bc911e17 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class HealthController < ActionController::Base protect_from_forgery with: :exception, except: :storage_check, prepend: true include RequiresWhitelistedMonitoringClient diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index a394521698c..e5a1fc9d6ff 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class HelpController < ApplicationController skip_before_action :authenticate_user! diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb index 96bb2237d90..eeeebe430a7 100644 --- a/app/controllers/ide_controller.rb +++ b/app/controllers/ide_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class IdeController < ApplicationController layout 'fullscreen' diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 025d8270b7c..315d1375e02 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class InvitesController < ApplicationController before_action :member skip_before_action :authenticate_user!, only: :decline @@ -50,9 +52,9 @@ class InvitesController < ApplicationController def authenticate_user! return if current_user - notice = "To accept this invitation, sign in" - notice << " or create an account" if Gitlab::CurrentSettings.allow_signup? - notice << "." + notice = ["To accept this invitation, sign in"] + notice << "or create an account" if Gitlab::CurrentSettings.allow_signup? + notice = notice.join(' ') + "." store_location_for :user, request.fullpath redirect_to new_user_session_path, notice: notice diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb index d172aee5436..f9008a5b67e 100644 --- a/app/controllers/jwt_controller.rb +++ b/app/controllers/jwt_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class JwtController < ApplicationController skip_before_action :authenticate_user! skip_before_action :verify_authenticity_token diff --git a/app/controllers/koding_controller.rb b/app/controllers/koding_controller.rb index 745abf3c0f5..72aa9d4f17f 100644 --- a/app/controllers/koding_controller.rb +++ b/app/controllers/koding_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class KodingController < ApplicationController before_action :check_integration! layout 'koding' diff --git a/app/controllers/metrics_controller.rb b/app/controllers/metrics_controller.rb index 0400ffcfee5..7353be478e1 100644 --- a/app/controllers/metrics_controller.rb +++ b/app/controllers/metrics_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MetricsController < ActionController::Base include RequiresWhitelistedMonitoringClient diff --git a/app/controllers/notification_settings_controller.rb b/app/controllers/notification_settings_controller.rb index 461f26561f1..84dce74ace8 100644 --- a/app/controllers/notification_settings_controller.rb +++ b/app/controllers/notification_settings_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class NotificationSettingsController < ApplicationController before_action :authenticate_user! diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 1547d4b5972..30be50d4595 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class OmniauthCallbacksController < Devise::OmniauthCallbacksController include AuthenticatesWithTwoFactor include Devise::Controllers::Rememberable @@ -135,14 +137,13 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def handle_signup_error label = Gitlab::Auth::OAuth::Provider.label_for(oauth['provider']) - message = "Signing in using your #{label} account without a pre-existing GitLab account is not allowed." + message = ["Signing in using your #{label} account without a pre-existing GitLab account is not allowed."] if Gitlab::CurrentSettings.allow_signup? - message << " Create a GitLab account first, and then connect it to your #{label} account." + message << "Create a GitLab account first, and then connect it to your #{label} account." end - flash[:notice] = message - + flash[:notice] = message.join(' ') redirect_to new_user_session_path end diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index a1bcf206b65..2912a22411e 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class PasswordsController < Devise::PasswordsController skip_before_action :require_no_authentication, only: [:edit, :update] diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index a43d47797f1..15248d2d08f 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProfilesController < Profiles::ApplicationController include ActionView::Helpers::SanitizeHelper diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 64d9b16a041..7352c5e9bec 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectsController < Projects::ApplicationController include API::Helpers::RelatedResourcesHelpers include IssuableCollections diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index e6d6965036e..8b8d87524a8 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RegistrationsController < Devise::RegistrationsController include Recaptcha::Verify include AcceptsPendingInvitations diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 651b82f04f4..ebf70f25bda 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # RootController # # This controller exists solely to handle requests to `root_url`. When a user is diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index a928758f325..1b22907c10f 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SearchController < ApplicationController include ControllerWithCrossProjectAccessCheck include SearchHelper diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb index 93a71103a09..2b76921ebd8 100644 --- a/app/controllers/sent_notifications_controller.rb +++ b/app/controllers/sent_notifications_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SentNotificationsController < ApplicationController skip_before_action :authenticate_user! diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 9f2e66dea90..643eb75c83c 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SessionsController < Devise::SessionsController include InternalRedirect include AuthenticatesWithTwoFactor diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 19d865900e9..694c3a59e2b 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SnippetsController < ApplicationController include RendersNotes include ToggleAwardEmoji diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 3d227b0a955..fa5d84633b5 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UploadsController < ApplicationController include UploadsActions diff --git a/app/controllers/user_callouts_controller.rb b/app/controllers/user_callouts_controller.rb index b8d2deba93b..ebf1dd8ca02 100644 --- a/app/controllers/user_callouts_controller.rb +++ b/app/controllers/user_callouts_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UserCalloutsController < ApplicationController def create if ensure_callout.persisted? diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2f65f4a7403..e509098d778 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UsersController < ApplicationController include RoutableActions include RendersMemberAccess diff --git a/changelogs/unreleased/frozen-string-app-controller.yml b/changelogs/unreleased/frozen-string-app-controller.yml new file mode 100644 index 00000000000..95fea4eae63 --- /dev/null +++ b/changelogs/unreleased/frozen-string-app-controller.yml @@ -0,0 +1,5 @@ +--- +title: Enable frozen string in app/controllers/**/*.rb +merge_request: gfyoung +author: +type: performance |