Commit b79b2a5d authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ee-update-rubocop' into 'master'

EE: Update rubocop

See merge request gitlab-org/gitlab-ee!6376
parents d8f0ada5 76459138
...@@ -199,12 +199,6 @@ Naming/HeredocDelimiterCase: ...@@ -199,12 +199,6 @@ Naming/HeredocDelimiterCase:
Naming/HeredocDelimiterNaming: Naming/HeredocDelimiterNaming:
Enabled: false Enabled: false
# Offense count: 27
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect.
Performance/HashEachMethods:
Enabled: false
# Offense count: 1 # Offense count: 1
Performance/UnfreezeString: Performance/UnfreezeString:
Exclude: Exclude:
......
...@@ -363,9 +363,9 @@ group :development, :test do ...@@ -363,9 +363,9 @@ group :development, :test do
gem 'spring', '~> 2.0.0' gem 'spring', '~> 2.0.0'
gem 'spring-commands-rspec', '~> 1.0.4' gem 'spring-commands-rspec', '~> 1.0.4'
gem 'gitlab-styles', '~> 2.3', require: false gem 'gitlab-styles', '~> 2.4', require: false
# Pin these dependencies, otherwise a new rule could break the CI pipelines # Pin these dependencies, otherwise a new rule could break the CI pipelines
gem 'rubocop', '~> 0.52.1' gem 'rubocop', '~> 0.54.0'
gem 'rubocop-rspec', '~> 1.22.1' gem 'rubocop-rspec', '~> 1.22.1'
gem 'scss_lint', '~> 0.56.0', require: false gem 'scss_lint', '~> 0.56.0', require: false
......
...@@ -337,8 +337,8 @@ GEM ...@@ -337,8 +337,8 @@ GEM
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab-license (1.0.0) gitlab-license (1.0.0)
gitlab-markup (1.6.4) gitlab-markup (1.6.4)
gitlab-styles (2.3.2) gitlab-styles (2.4.1)
rubocop (~> 0.51) rubocop (~> 0.54.0)
rubocop-gitlab-security (~> 0.1.0) rubocop-gitlab-security (~> 0.1.0)
rubocop-rspec (~> 1.19) rubocop-rspec (~> 1.19)
gitlab_omniauth-ldap (2.0.4) gitlab_omniauth-ldap (2.0.4)
...@@ -805,16 +805,16 @@ GEM ...@@ -805,16 +805,16 @@ GEM
pg pg
rails rails
sqlite3 sqlite3
rubocop (0.52.1) rubocop (0.54.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0) parser (>= 2.5)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-gitlab-security (0.1.1) rubocop-gitlab-security (0.1.1)
rubocop (>= 0.51) rubocop (>= 0.51)
rubocop-rspec (1.22.1) rubocop-rspec (1.22.2)
rubocop (>= 0.52.1) rubocop (>= 0.52.1)
ruby-enum (0.7.2) ruby-enum (0.7.2)
i18n i18n
...@@ -1078,7 +1078,7 @@ DEPENDENCIES ...@@ -1078,7 +1078,7 @@ DEPENDENCIES
gitlab-gollum-rugged_adapter (~> 0.4.4) gitlab-gollum-rugged_adapter (~> 0.4.4)
gitlab-license (~> 1.0) gitlab-license (~> 1.0)
gitlab-markup (~> 1.6.4) gitlab-markup (~> 1.6.4)
gitlab-styles (~> 2.3) gitlab-styles (~> 2.4)
gitlab_omniauth-ldap (~> 2.0.4) gitlab_omniauth-ldap (~> 2.0.4)
gon (~> 6.2) gon (~> 6.2)
google-api-client (~> 0.19.8) google-api-client (~> 0.19.8)
...@@ -1180,7 +1180,7 @@ DEPENDENCIES ...@@ -1180,7 +1180,7 @@ DEPENDENCIES
rspec-retry (~> 0.4.5) rspec-retry (~> 0.4.5)
rspec-set (~> 0.1.3) rspec-set (~> 0.1.3)
rspec_profiling (~> 0.0.5) rspec_profiling (~> 0.0.5)
rubocop (~> 0.52.1) rubocop (~> 0.54.0)
rubocop-rspec (~> 1.22.1) rubocop-rspec (~> 1.22.1)
ruby-fogbugz (~> 0.2.1) ruby-fogbugz (~> 0.2.1)
ruby-prof (~> 0.17.0) ruby-prof (~> 0.17.0)
......
...@@ -340,8 +340,8 @@ GEM ...@@ -340,8 +340,8 @@ GEM
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab-license (1.0.0) gitlab-license (1.0.0)
gitlab-markup (1.6.4) gitlab-markup (1.6.4)
gitlab-styles (2.3.2) gitlab-styles (2.4.1)
rubocop (~> 0.51) rubocop (~> 0.54.0)
rubocop-gitlab-security (~> 0.1.0) rubocop-gitlab-security (~> 0.1.0)
rubocop-rspec (~> 1.19) rubocop-rspec (~> 1.19)
gitlab_omniauth-ldap (2.0.4) gitlab_omniauth-ldap (2.0.4)
...@@ -814,16 +814,16 @@ GEM ...@@ -814,16 +814,16 @@ GEM
pg pg
rails rails
sqlite3 sqlite3
rubocop (0.52.1) rubocop (0.54.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0) parser (>= 2.5)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-gitlab-security (0.1.1) rubocop-gitlab-security (0.1.1)
rubocop (>= 0.51) rubocop (>= 0.51)
rubocop-rspec (1.22.1) rubocop-rspec (1.22.2)
rubocop (>= 0.52.1) rubocop (>= 0.52.1)
ruby-enum (0.7.2) ruby-enum (0.7.2)
i18n i18n
...@@ -1088,7 +1088,7 @@ DEPENDENCIES ...@@ -1088,7 +1088,7 @@ DEPENDENCIES
gitlab-gollum-rugged_adapter (~> 0.4.4) gitlab-gollum-rugged_adapter (~> 0.4.4)
gitlab-license (~> 1.0) gitlab-license (~> 1.0)
gitlab-markup (~> 1.6.4) gitlab-markup (~> 1.6.4)
gitlab-styles (~> 2.3) gitlab-styles (~> 2.4)
gitlab_omniauth-ldap (~> 2.0.4) gitlab_omniauth-ldap (~> 2.0.4)
gon (~> 6.2) gon (~> 6.2)
google-api-client (~> 0.19.8) google-api-client (~> 0.19.8)
...@@ -1191,7 +1191,7 @@ DEPENDENCIES ...@@ -1191,7 +1191,7 @@ DEPENDENCIES
rspec-retry (~> 0.4.5) rspec-retry (~> 0.4.5)
rspec-set (~> 0.1.3) rspec-set (~> 0.1.3)
rspec_profiling (~> 0.0.5) rspec_profiling (~> 0.0.5)
rubocop (~> 0.52.1) rubocop (~> 0.54.0)
rubocop-rspec (~> 1.22.1) rubocop-rspec (~> 1.22.1)
ruby-fogbugz (~> 0.2.1) ruby-fogbugz (~> 0.2.1)
ruby-prof (~> 0.17.0) ruby-prof (~> 0.17.0)
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# Add your own tasks in files placed in lib/tasks ending in .rake, # Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__) require File.expand_path('config/application', __dir__)
relative_url_conf = File.expand_path('../config/initializers/relative_url', __FILE__) relative_url_conf = File.expand_path('config/initializers/relative_url', __dir__)
require relative_url_conf if File.exist?("#{relative_url_conf}.rb") require relative_url_conf if File.exist?("#{relative_url_conf}.rb")
Gitlab::Application.load_tasks Gitlab::Application.load_tasks
......
...@@ -22,7 +22,7 @@ class Admin::DeployKeysController < Admin::ApplicationController ...@@ -22,7 +22,7 @@ class Admin::DeployKeysController < Admin::ApplicationController
end end
def update def update
if deploy_key.update_attributes(update_params) if deploy_key.update(update_params)
flash[:notice] = 'Deploy key was successfully updated.' flash[:notice] = 'Deploy key was successfully updated.'
redirect_to admin_deploy_keys_path redirect_to admin_deploy_keys_path
else else
...@@ -34,7 +34,7 @@ class Admin::DeployKeysController < Admin::ApplicationController ...@@ -34,7 +34,7 @@ class Admin::DeployKeysController < Admin::ApplicationController
deploy_key.destroy deploy_key.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to admin_deploy_keys_path, status: 302 } format.html { redirect_to admin_deploy_keys_path, status: :found }
format.json { head :ok } format.json { head :ok }
end end
end end
......
...@@ -41,7 +41,7 @@ class Admin::GroupsController < Admin::ApplicationController ...@@ -41,7 +41,7 @@ class Admin::GroupsController < Admin::ApplicationController
end end
def update def update
if @group.update_attributes(group_params) if @group.update(group_params)
redirect_to [:admin, @group], notice: 'Group was successfully updated.' redirect_to [:admin, @group], notice: 'Group was successfully updated.'
else else
render "edit" render "edit"
......
...@@ -23,7 +23,7 @@ class Admin::HooksController < Admin::ApplicationController ...@@ -23,7 +23,7 @@ class Admin::HooksController < Admin::ApplicationController
end end
def update def update
if hook.update_attributes(hook_params) if hook.update(hook_params)
flash[:notice] = 'System hook was successfully updated.' flash[:notice] = 'System hook was successfully updated.'
redirect_to admin_hooks_path redirect_to admin_hooks_path
else else
...@@ -34,7 +34,7 @@ class Admin::HooksController < Admin::ApplicationController ...@@ -34,7 +34,7 @@ class Admin::HooksController < Admin::ApplicationController
def destroy def destroy
hook.destroy hook.destroy
redirect_to admin_hooks_path, status: 302 redirect_to admin_hooks_path, status: :found
end end
def test def test
......
...@@ -25,7 +25,7 @@ class Admin::IdentitiesController < Admin::ApplicationController ...@@ -25,7 +25,7 @@ class Admin::IdentitiesController < Admin::ApplicationController
end end
def update def update
if @identity.update_attributes(identity_params) if @identity.update(identity_params)
RepairLdapBlockedUserService.new(@user).execute RepairLdapBlockedUserService.new(@user).execute
redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully updated.' redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully updated.'
else else
......
...@@ -11,7 +11,7 @@ class Admin::ImpersonationsController < Admin::ApplicationController ...@@ -11,7 +11,7 @@ class Admin::ImpersonationsController < Admin::ApplicationController
session[:impersonator_id] = nil session[:impersonator_id] = nil
redirect_to admin_user_path(original_user), status: 302 redirect_to admin_user_path(original_user), status: :found
end end
private private
......
...@@ -20,6 +20,6 @@ class Admin::JobsController < Admin::ApplicationController ...@@ -20,6 +20,6 @@ class Admin::JobsController < Admin::ApplicationController
def cancel_all def cancel_all
Ci::Build.running_or_pending.each(&:cancel) Ci::Build.running_or_pending.each(&:cancel)
redirect_to admin_jobs_path, status: 303 redirect_to admin_jobs_path, status: :see_other
end end
end end
...@@ -16,7 +16,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController ...@@ -16,7 +16,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController
runner = rp.runner runner = rp.runner
rp.destroy rp.destroy
redirect_to admin_runner_path(runner), status: 302 redirect_to admin_runner_path(runner), status: :found
end end
private private
......
...@@ -28,7 +28,7 @@ class Admin::RunnersController < Admin::ApplicationController ...@@ -28,7 +28,7 @@ class Admin::RunnersController < Admin::ApplicationController
def destroy def destroy
@runner.destroy @runner.destroy
redirect_to admin_runners_path, status: 302 redirect_to admin_runners_path, status: :found
end end
def resume def resume
......
...@@ -16,7 +16,7 @@ class Admin::ServicesController < Admin::ApplicationController ...@@ -16,7 +16,7 @@ class Admin::ServicesController < Admin::ApplicationController
end end
def update def update
if service.update_attributes(service_params[:service]) if service.update(service_params[:service])
PropagateServiceTemplateWorker.perform_async(service.id) if service.active? PropagateServiceTemplateWorker.perform_async(service.id) if service.active?
redirect_to admin_application_settings_services_path, redirect_to admin_application_settings_services_path,
......
...@@ -165,7 +165,7 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -165,7 +165,7 @@ class Admin::UsersController < Admin::ApplicationController
format.json { head :ok } format.json { head :ok }
else else
format.html { redirect_back_or_admin_user(alert: 'There was an error removing the e-mail.') } format.html { redirect_back_or_admin_user(alert: 'There was an error removing the e-mail.') }
format.json { render json: 'There was an error removing the e-mail.', status: 400 } format.json { render json: 'There was an error removing the e-mail.', status: :bad_request }
end end
end end
end end
......
...@@ -128,7 +128,7 @@ module IssuableActions ...@@ -128,7 +128,7 @@ module IssuableActions
errors: [ errors: [
"Someone edited this #{issuable.human_class_name} at the same time you did. Please refresh your browser and make sure your changes will not unintentionally remove theirs." "Someone edited this #{issuable.human_class_name} at the same time you did. Please refresh your browser and make sure your changes will not unintentionally remove theirs."
] ]
}, status: 409 }, status: :conflict
end end
end end
end end
......
...@@ -28,7 +28,7 @@ module LfsRequest ...@@ -28,7 +28,7 @@ module LfsRequest
message: 'Git LFS is not enabled on this GitLab server, contact your admin.', message: 'Git LFS is not enabled on this GitLab server, contact your admin.',
documentation_url: help_url documentation_url: help_url
}, },
status: 501 status: :not_implemented
) )
end end
......
...@@ -7,6 +7,6 @@ class Groups::AvatarsController < Groups::ApplicationController ...@@ -7,6 +7,6 @@ class Groups::AvatarsController < Groups::ApplicationController
@group.remove_avatar! @group.remove_avatar!
@group.save @group.save
redirect_to edit_group_path(@group), status: 302 redirect_to edit_group_path(@group), status: :found
end end
end end
...@@ -23,7 +23,7 @@ class Groups::RunnersController < Groups::ApplicationController ...@@ -23,7 +23,7 @@ class Groups::RunnersController < Groups::ApplicationController
def destroy def destroy
@runner.destroy @runner.destroy
redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), status: 302 redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), status: :found
end end
def resume def resume
......
...@@ -41,7 +41,7 @@ class JwtController < ApplicationController ...@@ -41,7 +41,7 @@ class JwtController < ApplicationController
"You must use a personal access token with 'api' scope for Git over HTTP.\n" \ "You must use a personal access token with 'api' scope for Git over HTTP.\n" \
"You can generate one at #{profile_personal_access_tokens_url}" } "You can generate one at #{profile_personal_access_tokens_url}" }
] ]
}, status: 401 }, status: :unauthorized
end end
def render_unauthorized def render_unauthorized
...@@ -50,7 +50,7 @@ class JwtController < ApplicationController ...@@ -50,7 +50,7 @@ class JwtController < ApplicationController
{ code: 'UNAUTHORIZED', { code: 'UNAUTHORIZED',
message: 'HTTP Basic: Access denied' } message: 'HTTP Basic: Access denied' }
] ]
}, status: 401 }, status: :unauthorized
end end
def auth_params def auth_params
......
...@@ -5,14 +5,14 @@ class NotificationSettingsController < ApplicationController ...@@ -5,14 +5,14 @@ class NotificationSettingsController < ApplicationController
return render_404 unless can_read?(resource) return render_404 unless can_read?(resource)
@notification_setting = current_user.notification_settings_for(resource) @notification_setting = current_user.notification_settings_for(resource)
@saved = @notification_setting.update_attributes(notification_setting_params) @saved = @notification_setting.update(notification_setting_params)
render_response render_response
end end
def update def update
@notification_setting = current_user.notification_settings.find(params[:id]) @notification_setting = current_user.notification_settings.find(params[:id])
@saved = @notification_setting.update_attributes(notification_setting_params) @saved = @notification_setting.update(notification_setting_params)
render_response render_response
end end
......
...@@ -7,7 +7,7 @@ class Profiles::ActiveSessionsController < Profiles::ApplicationController ...@@ -7,7 +7,7 @@ class Profiles::ActiveSessionsController < Profiles::ApplicationController
ActiveSession.destroy(current_user, params[:id]) ActiveSession.destroy(current_user, params[:id])
respond_to do |format| respond_to do |format|
format.html { redirect_to profile_active_sessions_url, status: 302 } format.html { redirect_to profile_active_sessions_url, status: :found }
format.js { head :ok } format.js { head :ok }
end end
end end
......
...@@ -4,6 +4,6 @@ class Profiles::AvatarsController < Profiles::ApplicationController ...@@ -4,6 +4,6 @@ class Profiles::AvatarsController < Profiles::ApplicationController
Users::UpdateService.new(current_user, user: @user).execute { |user| user.remove_avatar! } Users::UpdateService.new(current_user, user: @user).execute { |user| user.remove_avatar! }
redirect_to profile_path, status: 302 redirect_to profile_path, status: :found
end end
end end
...@@ -39,7 +39,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController ...@@ -39,7 +39,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController
flash[:alert] = "Could not delete chat nickname #{@chat_name.chat_name}." flash[:alert] = "Could not delete chat nickname #{@chat_name.chat_name}."
end end
redirect_to profile_chat_names_path, status: 302 redirect_to profile_chat_names_path, status: :found
end end
private private
......
...@@ -19,7 +19,7 @@ class Profiles::EmailsController < Profiles::ApplicationController ...@@ -19,7 +19,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
Emails::DestroyService.new(current_user, user: current_user).execute(@email) Emails::DestroyService.new(current_user, user: current_user).execute(@email)
respond_to do |format| respond_to do |format|
format.html { redirect_to profile_emails_url, status: 302 } format.html { redirect_to profile_emails_url, status: :found }
format.js { head :ok } format.js { head :ok }
end end
end end
......
...@@ -21,7 +21,7 @@ class Profiles::GpgKeysController < Profiles::ApplicationController ...@@ -21,7 +21,7 @@ class Profiles::GpgKeysController < Profiles::ApplicationController
@gpg_key.destroy @gpg_key.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to profile_gpg_keys_url, status: 302 } format.html { redirect_to profile_gpg_keys_url, status: :found }
format.js { head :ok } format.js { head :ok }
end end
end end
...@@ -30,7 +30,7 @@ class Profiles::GpgKeysController < Profiles::ApplicationController ...@@ -30,7 +30,7 @@ class Profiles::GpgKeysController < Profiles::ApplicationController
@gpg_key.revoke @gpg_key.revoke
respond_to do |format| respond_to do |format|
format.html { redirect_to profile_gpg_keys_url, status: 302 } format.html { redirect_to profile_gpg_keys_url, status: :found }
format.js { head :ok } format.js { head :ok }
end end
end end
......
...@@ -26,7 +26,7 @@ class Profiles::KeysController < Profiles::ApplicationController ...@@ -26,7 +26,7 @@ class Profiles::KeysController < Profiles::ApplicationController
Keys::DestroyService.new(current_user).execute(@key) Keys::DestroyService.new(current_user).execute(@key)
respond_to do |format| respond_to do |format|
format.html { redirect_to profile_keys_url, status: 302 } format.html { redirect_to profile_keys_url, status: :found }
format.js { head :ok } format.js { head :ok }
end end
end end
......
...@@ -78,7 +78,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController ...@@ -78,7 +78,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
def destroy def destroy
current_user.disable_two_factor! current_user.disable_two_factor!
redirect_to profile_account_path, status: 302 redirect_to profile_account_path, status: :found
end end
def skip def skip
......
...@@ -62,7 +62,7 @@ class Projects::ApplicationController < ApplicationController ...@@ -62,7 +62,7 @@ class Projects::ApplicationController < ApplicationController
def require_non_empty_project def require_non_empty_project
# Be sure to return status code 303 to avoid a double DELETE: # Be sure to return status code 303 to avoid a double DELETE:
# http://api.rubyonrails.org/classes/ActionController/Redirecting.html # http://api.rubyonrails.org/classes/ActionController/Redirecting.html
redirect_to project_path(@project), status: 303 if @project.empty_repo? redirect_to project_path(@project), status: :see_other if @project.empty_repo?
end end
def require_branch_head def require_branch_head
......
...@@ -21,6 +21,6 @@ class Projects::AvatarsController < Projects::ApplicationController ...@@ -21,6 +21,6 @@ class Projects::AvatarsController < Projects::ApplicationController
@project.save @project.save
redirect_to edit_project_path(@project), status: 302 redirect_to edit_project_path(@project), status: :found
end end
end end
...@@ -98,7 +98,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -98,7 +98,7 @@ class Projects::BranchesController < Projects::ApplicationController
flash_type = result[:status] == :error ? :alert : :notice flash_type = result[:status] == :error ? :alert : :notice
flash[flash_type] = result[:message] flash[flash_type] = result[:message]
redirect_to project_branches_path(@project), status: 303 redirect_to project_branches_path(@project), status: :see_other
end end
format.js { render nothing: true, status: result[:return_code] } format.js { render nothing: true, status: result[:return_code] }
......
...@@ -64,7 +64,7 @@ class Projects::ClustersController < Projects::ApplicationController ...@@ -64,7 +64,7 @@ class Projects::ClustersController < Projects::ApplicationController
def destroy def destroy
if cluster.destroy if cluster.destroy
flash[:notice] = _('Kubernetes cluster integration was successfully removed.') flash[:notice] = _('Kubernetes cluster integration was successfully removed.')
redirect_to project_clusters_path(project), status: 302 redirect_to project_clusters_path(project), status: :found
else else
flash[:notice] = _('Kubernetes cluster integration was not removed.') flash[:notice] = _('Kubernetes cluster integration was not removed.')
render :show render :show
......
...@@ -37,7 +37,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -37,7 +37,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
end end
def update def update
if deploy_key.update_attributes(update_params) if deploy_key.update(update_params)
flash[:notice] = 'Deploy key was successfully updated.' flash[:notice] = 'Deploy key was successfully updated.'
redirect_to_repository_settings(@project) redirect_to_repository_settings(@project)
else else
......
...@@ -118,7 +118,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -118,7 +118,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
set_workhorse_internal_api_content_type set_workhorse_internal_api_content_type
render json: Gitlab::Workhorse.terminal_websocket(terminal) render json: Gitlab::Workhorse.terminal_websocket(terminal)
else else
render text: 'Not found', status: 404 render text: 'Not found', status: :not_found
end end
end end
......
...@@ -54,7 +54,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController ...@@ -54,7 +54,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController
end end
send_challenges send_challenges
render plain: "HTTP Basic: Access denied\n", status: 401 render plain: "HTTP Basic: Access denied\n", status: :unauthorized
rescue Gitlab::Auth::MissingPersonalAccessTokenError rescue Gitlab::Auth::MissingPersonalAccessTokenError
render_missing_personal_access_token render_missing_personal_access_token
end end
...@@ -84,7 +84,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController ...@@ -84,7 +84,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController
render plain: "HTTP Basic: Access denied\n" \ render plain: "HTTP Basic: Access denied\n" \
"You must use a personal access token with 'api' scope for Git over HTTP.\n" \ "You must use a personal access token with 'api' scope for Git over HTTP.\n" \
"You can generate one at #{profile_personal_access_tokens_url}", "You can generate one at #{profile_personal_access_tokens_url}",
status: 401 status: :unauthorized
end end
def repository def repository
......
...@@ -25,7 +25,7 @@ class Projects::GroupLinksController < Projects::ApplicationController ...@@ -25,7 +25,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
def update def update
@group_link = @project.project_group_links.find(params[:id]) @group_link = @project.project_group_links.find(params[:id])
@group_link.update_attributes(group_link_params) @group_link.update(group_link_params)
end end
def destroy def destroy
...@@ -35,7 +35,7 @@ class Projects::GroupLinksController < Projects::ApplicationController ...@@ -35,7 +35,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to project_project_members_path(project), status: 302 redirect_to project_project_members_path(project), status: :found
end end
format.js { head :ok } format.js { head :ok }
end end
......
...@@ -29,7 +29,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -29,7 +29,7 @@ class Projects::HooksController < Projects::ApplicationController
end end
def update def update
if hook.update_attributes(hook_params) if hook.update(hook_params)
flash[:notice] = 'Hook was successfully updated.' flash[:notice] = 'Hook was successfully updated.'
redirect_to project_settings_integrations_path(@project) redirect_to project_settings_integrations_path(@project)
else else
...@@ -48,7 +48,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -48,7 +48,7 @@ class Projects::HooksController < Projects::ApplicationController
def destroy def destroy
hook.destroy hook.destroy
redirect_to project_settings_integrations_path(@project), status: 302 redirect_to project_settings_integrations_path(@project), status: :found
end end
private private
......
...@@ -12,7 +12,7 @@ class Projects::ImportsController < Projects::ApplicationController ...@@ -12,7 +12,7 @@ class Projects::ImportsController < Projects::ApplicationController
end end
def create def create
if @project.update_attributes(safe_import_params) if @project.update(safe_import_params)
@project.reload.import_schedule @project.reload.import_schedule
end end
......
...@@ -39,7 +39,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -39,7 +39,7 @@ class Projects::LabelsController < Projects::ApplicationController
else else
respond_to do |format| respond_to do |format|
format.html { render :new } format.html { render :new }
format.json { render json: { message: @label.errors.messages }, status: 400 } format.json { render json: { message: @label.errors.messages }, status: :bad_request }
end end
end end
end end
...@@ -115,7 +115,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -115,7 +115,7 @@ class Projects::LabelsController < Projects::ApplicationController
flash[:notice] = "#{@label.title} promoted to <a href=\"#{group_labels_path(@project.group)}\">group label</a>.".html_safe flash[:notice] = "#{@label.title} promoted to <a href=\"#{group_labels_path(@project.group)}\">group label</a>.".html_safe
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to(project_labels_path(@project), status: 303) redirect_to(project_labels_path(@project), status: :see_other)
end end
format.json do format.json do
render json: { url: project_labels_path(@project) } render json: { url: project_labels_path(@project) }
......
...@@ -30,7 +30,7 @@ class Projects::LfsApiController < Projects::GitHttpClientController ...@@ -30,7 +30,7 @@ class Projects::LfsApiController < Projects::GitHttpClientController
message: 'Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.', message: 'Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.',
documentation_url: "#{Gitlab.config.gitlab.url}/help" documentation_url: "#{Gitlab.config.gitlab.url}/help"
}, },
status: 501 status: :not_implemented
) )
end end
......
...@@ -28,7 +28,7 @@ class Projects::LfsStorageController < Projects::GitHttpClientController ...@@ -28,7 +28,7 @@ class Projects::LfsStorageController < Projects::GitHttpClientController
if store_file!(oid, size) if store_file!(oid, size)
head 200 head 200
else else
render plain: 'Unprocessable entity', status: 422 render plain: 'Unprocessable entity', status: :unprocessable_entity
end end
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
render_lfs_forbidden render_lfs_forbidden
......
...@@ -231,7 +231,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -231,7 +231,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
def rebase def rebase
RebaseWorker.perform_async(@merge_request.id, current_user.id) RebaseWorker.perform_async(@merge_request.id, current_user.id)
render nothing: true, status: 200 render nothing: true, status: :ok
end end
protected protected
......
...@@ -96,7 +96,7 @@ class Projects::MilestonesController < Projects::ApplicationController ...@@ -96,7 +96,7 @@ class Projects::MilestonesController < Projects::ApplicationController
Milestones::DestroyService.new(project, current_user).execute(milestone) Milestones::DestroyService.new(project, current_user).execute(milestone)
respond_to do |format| respond_to do |format|
format.html { redirect_to namespace_project_milestones_path, status: 303 } format.html { redirect_to namespace_project_milestones_path, status: :see_other }
format.js { head :ok } format.js { head :ok }
end end
end end
......
...@@ -15,7 +15,7 @@ class Projects::MirrorsController < Projects::ApplicationController ...@@ -15,7 +15,7 @@ class Projects::MirrorsController < Projects::ApplicationController
end end
def update def update
if project.update_attributes(mirror_params) if project.update(mirror_params)
flash[:notice] = 'Mirroring settings were successfully updated.' flash[:notice] = 'Mirroring settings were successfully updated.'
else else
flash[:alert] = project.errors.full_messages.join(', ').html_safe flash[:alert] = project.errors.full_messages.join(', ').html_safe
......
...@@ -64,7 +64,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController ...@@ -64,7 +64,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
def destroy def destroy
if schedule.destroy if schedule.destroy
redirect_to pipeline_schedules_path(@project), status: 302 redirect_to pipeline_schedules_path(@project), status: :found
else else
redirect_to pipeline_schedules_path(@project), redirect_to pipeline_schedules_path(@project),
status: :forbidden, status: :forbidden,
......
...@@ -14,7 +14,7 @@ class Projects::ReleasesController < Projects::ApplicationController ...@@ -14,7 +14,7 @@ class Projects::ReleasesController < Projects::ApplicationController
# it exists only to save a description to each Tag. # it exists only to save a description to each Tag.
# If description is empty we should destroy the existing record. # If description is empty we should destroy the existing record.
if release_params[:description].present? if release_params[:description].present?
release.update_attributes(release_params) release.update(release_params)
else else
release.destroy release.destroy
end end
......
...@@ -24,7 +24,7 @@ class Projects::RepositoriesController < Projects::ApplicationController ...@@ -24,7 +24,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
send_git_archive @repository, ref: @ref, format: params[:format], append_sha: append_sha send_git_archive @repository, ref: @ref, format: params[:format], append_sha: append_sha
rescue => ex rescue => ex
logger.error("#{self.class.name}: #{ex}") logger.error("#{self.class.name}: #{ex}")
return git_not_found! git_not_found!
end end
def assign_archive_vars def assign_archive_vars
......
...@@ -21,6 +21,6 @@ class Projects::RunnerProjectsController < Projects::ApplicationController ...@@ -21,6 +21,6 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
runner_project = project.runner_projects.find(params[:id]) runner_project = project.runner_projects.find(params[:id])
runner_project.destroy runner_project.destroy
redirect_to project_runners_path(project), status: 302 redirect_to project_runners_path(project), status: :found
end end
end end
...@@ -24,7 +24,7 @@ class Projects::RunnersController < Projects::ApplicationController ...@@ -24,7 +24,7 @@ class Projects::RunnersController < Projects::ApplicationController
@runner.destroy @runner.destroy
end end
redirect_to project_runners_path(@project), status: 302 redirect_to project_runners_path(@project), status: :found
end end
def resume def resume
......
...@@ -34,7 +34,7 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -34,7 +34,7 @@ class Projects::ServicesController < Projects::ApplicationController
private private
def service_test_response def service_test_response
if @service.update_attributes(service_params[:service]) if @service.update(service_params[:service])
data = @service.test_data(project, current_user) data = @service.test_data(project, current_user)
outcome = @service.test(data) outcome = @service.test(data)
......
...@@ -82,7 +82,7 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -82,7 +82,7 @@ class Projects::SnippetsController < Projects::ApplicationController
@snippet.destroy @snippet.destroy
redirect_to project_snippets_path(@project), status: 302 redirect_to project_snippets_path(@project), status: :found
end end
protected protected
......
...@@ -50,7 +50,7 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -50,7 +50,7 @@ class Projects::TagsController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
if result[:status] == :success if result[:status] == :success
format.html do format.html do
redirect_to project_tags_path(@project), status: 303 redirect_to project_tags_path(@project), status: :see_other
end end
format.js format.js
......
...@@ -14,6 +14,6 @@ class Projects::TemplatesController < Projects::ApplicationController ...@@ -14,6 +14,6 @@ class Projects::TemplatesController < Projects::ApplicationController
def get_template_class def get_template_class
template_types = { issue: Gitlab::Template::IssueTemplate, merge_request: Gitlab::Template::MergeRequestTemplate }.with_indifferent_access template_types = { issue: Gitlab::Template::IssueTemplate, merge_request: Gitlab::Template::MergeRequestTemplate }.with_indifferent_access
@template_type = template_types[params[:template_type]] @template_type = template_types[params[:template_type]]
render json: [], status: 404 unless @template_type render json: [], status: :not_found unless @template_type
end end
end end
...@@ -50,7 +50,7 @@ class Projects::TriggersController < Projects::ApplicationController ...@@ -50,7 +50,7 @@ class Projects::TriggersController < Projects::ApplicationController
flash[:alert] = "Could not remove the trigger." flash[:alert] = "Could not remove the trigger."
end end
redirect_to project_settings_ci_cd_path(@project), status: 302 redirect_to project_settings_ci_cd_path(@project), status: :found
end end
private private
......
...@@ -120,7 +120,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -120,7 +120,7 @@ class Projects::WikisController < Projects::ApplicationController
rescue ProjectWiki::CouldNotCreateWikiError rescue ProjectWiki::CouldNotCreateWikiError
flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." flash[:notice] = "Could not create Wiki Repository at this time. Please try again later."
redirect_to project_path(@project) redirect_to project_path(@project)
return false false
end end
def wiki_params def wiki_params
...@@ -129,7 +129,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -129,7 +129,7 @@ class Projects::WikisController < Projects::ApplicationController
def build_page(args) def build_page(args)
WikiPage.new(@project_wiki).tap do |page| WikiPage.new(@project_wiki).tap do |page|
page.update_attributes(args) page.update_attributes(args) # rubocop:disable Rails/ActiveRecordAliases
end end
end end
end end
...@@ -135,7 +135,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -135,7 +135,7 @@ class ProjectsController < Projects::ApplicationController
::Projects::DestroyService.new(@project, current_user, {}).async_execute ::Projects::DestroyService.new(@project, current_user, {}).async_execute
flash[:notice] = _("Project '%{project_name}' is in the process of being deleted.") % { project_name: @project.full_name } flash[:notice] = _("Project '%{project_name}' is in the process of being deleted.") % { project_name: @project.full_name }
redirect_to dashboard_projects_path, status: 302 redirect_to dashboard_projects_path, status: :found
rescue Projects::DestroyService::DestroyError => ex rescue Projects::DestroyService::DestroyError => ex
redirect_to edit_project_path(@project), status: 302, alert: ex.message redirect_to edit_project_path(@project), status: 302, alert: ex.message
end end
......
...@@ -33,8 +33,8 @@ class SessionsController < Devise::SessionsController ...@@ -33,8 +33,8 @@ class SessionsController < Devise::SessionsController
super do |resource| super do |resource|
# User has successfully signed in, so clear any unused reset token # User has successfully signed in, so clear any unused reset token
if resource.reset_password_token.present? if resource.reset_password_token.present?
resource.update_attributes(reset_password_token: nil, resource.update(reset_password_token: nil,
reset_password_sent_at: nil) reset_password_sent_at: nil)
end end
# hide the signed-in notification # hide the signed-in notification
......
...@@ -13,7 +13,7 @@ module Sherlock ...@@ -13,7 +13,7 @@ module Sherlock
def destroy_all def destroy_all
Gitlab::Sherlock.collection.clear Gitlab::Sherlock.collection.clear
redirect_to :back, status: 302 redirect_to :back, status: :found
end end
end end
end end
...@@ -89,7 +89,7 @@ class SnippetsController < ApplicationController ...@@ -89,7 +89,7 @@ class SnippetsController < ApplicationController
@snippet.destroy @snippet.destroy
redirect_to snippets_path, status: 302 redirect_to snippets_path, status: :found
end end
protected protected
......
...@@ -375,7 +375,7 @@ module Ci ...@@ -375,7 +375,7 @@ module Ci
def update_coverage def update_coverage
coverage = trace.extract_coverage(coverage_regex) coverage = trace.extract_coverage(coverage_regex)
update_attributes(coverage: coverage) if coverage.present? update(coverage: coverage) if coverage.present?
end end
def parse_trace_sections! def parse_trace_sections!
......
...@@ -23,7 +23,7 @@ module ProtectedRef ...@@ -23,7 +23,7 @@ module ProtectedRef
# If we don't `protected_branch` or `protected_tag` would be empty and # If we don't `protected_branch` or `protected_tag` would be empty and
# `project` cannot be delegated to it, which in turn would cause validations # `project` cannot be delegated to it, which in turn would cause validations
# to fail. # to fail.
has_many :"#{type}_access_levels", inverse_of: self.model_name.singular # rubocop:disable Cop/ActiveRecordDependent has_many :"#{type}_access_levels", inverse_of: self.model_name.singular
validates :"#{type}_access_levels", length: { is: 1, message: "are restricted to a single instance per #{self.model_name.human}." } validates :"#{type}_access_levels", length: { is: 1, message: "are restricted to a single instance per #{self.model_name.human}." }
......
...@@ -11,8 +11,8 @@ module Network ...@@ -11,8 +11,8 @@ module Network
@parent_spaces = [] @parent_spaces = []
end end
def method_missing(m, *args, &block) def method_missing(msg, *args, &block)
@commit.__send__(m, *args, &block) # rubocop:disable GitlabSecurity/PublicSend @commit.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
end end
def space def space
......
...@@ -117,7 +117,7 @@ class ProjectWiki ...@@ -117,7 +117,7 @@ class ProjectWiki
update_project_activity update_project_activity
rescue Gitlab::Git::Wiki::DuplicatePageError => e rescue Gitlab::Git::Wiki::DuplicatePageError => e
@error_message = "Duplicate page: #{e.message}" @error_message = "Duplicate page: #{e.message}"
return false false
end end
def update_page(page, content:, title: nil, format: :markdown, message: nil) def update_page(page, content:, title: nil, format: :markdown, message: nil)
......
...@@ -59,7 +59,7 @@ class RemoteMirror < ActiveRecord::Base ...@@ -59,7 +59,7 @@ class RemoteMirror < ActiveRecord::Base
Gitlab::Metrics.add_event(:remote_mirrors_finished, path: remote_mirror.project.full_path) Gitlab::Metrics.add_event(:remote_mirrors_finished, path: remote_mirror.project.full_path)
timestamp = Time.now timestamp = Time.now
remote_mirror.update_attributes!( remote_mirror.update!(
last_update_at: timestamp, last_successful_update_at: timestamp, last_error: nil last_update_at: timestamp, last_successful_update_at: timestamp, last_error: nil
) )
end end
......
...@@ -469,12 +469,12 @@ class Repository ...@@ -469,12 +469,12 @@ class Repository
expire_branches_cache expire_branches_cache
end end
def method_missing(m, *args, &block) def method_missing(msg, *args, &block)
if m == :lookup && !block_given? if msg == :lookup && !block_given?
lookup_cache[m] ||= {} lookup_cache[msg] ||= {}
lookup_cache[m][args.join(":")] ||= raw_repository.__send__(m, *args, &block) # rubocop:disable GitlabSecurity/PublicSend lookup_cache[msg][args.join(":")] ||= raw_repository.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
else else
raw_repository.__send__(m, *args, &block) # rubocop:disable GitlabSecurity/PublicSend raw_repository.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
end end
end end
......
...@@ -514,7 +514,7 @@ class User < ActiveRecord::Base ...@@ -514,7 +514,7 @@ class User < ActiveRecord::Base
def disable_two_factor! def disable_two_factor!
transaction do transaction do
update_attributes( update(
otp_required_for_login: false, otp_required_for_login: false,
encrypted_otp_secret: nil, encrypted_otp_secret: nil,
encrypted_otp_secret_iv: nil, encrypted_otp_secret_iv: nil,
...@@ -1075,7 +1075,7 @@ class User < ActiveRecord::Base ...@@ -1075,7 +1075,7 @@ class User < ActiveRecord::Base
return @global_notification_setting if defined?(@global_notification_setting) return @global_notification_setting if defined?(@global_notification_setting)
@global_notification_setting = notification_settings.find_or_initialize_by(source: nil) @global_notification_setting = notification_settings.find_or_initialize_by(source: nil)
@global_notification_setting.update_attributes(level: NotificationSetting.levels[DEFAULT_NOTIFICATION_LEVEL]) unless @global_notification_setting.persisted? @global_notification_setting.update(level: NotificationSetting.levels[DEFAULT_NOTIFICATION_LEVEL]) unless @global_notification_setting.persisted?
@global_notification_setting @global_notification_setting
end end
...@@ -1355,8 +1355,8 @@ class User < ActiveRecord::Base ...@@ -1355,8 +1355,8 @@ class User < ActiveRecord::Base
end end
end end
def self.unique_internal(scope, username, email_pattern, &b) def self.unique_internal(scope, username, email_pattern, &block)
scope.first || create_unique_internal(scope, username, email_pattern, &b) scope.first || create_unique_internal(scope, username, email_pattern, &block)
end end
def self.create_unique_internal(scope, username, email_pattern, &creation_block) def self.create_unique_internal(scope, username, email_pattern, &creation_block)
......
# rubocop:disable Rails/ActiveRecordAliases
class WikiPage class WikiPage
PageChangedError = Class.new(StandardError) PageChangedError = Class.new(StandardError)
PageRenameError = Class.new(StandardError) PageRenameError = Class.new(StandardError)
......
...@@ -3,7 +3,7 @@ module Badges ...@@ -3,7 +3,7 @@ module Badges
# returns the updated badge # returns the updated badge
def execute(badge) def execute(badge)
if params.present? if params.present?
badge.update_attributes(params) badge.update(params)
end end
badge badge
......
...@@ -13,8 +13,6 @@ module Commits ...@@ -13,8 +13,6 @@ module Commits
# rubocop:disable GitlabSecurity/PublicSend # rubocop:disable GitlabSecurity/PublicSend
message = @commit.public_send(:"#{action}_message", current_user) message = @commit.public_send(:"#{action}_message", current_user)
# rubocop:disable GitlabSecurity/PublicSend
repository.public_send( repository.public_send(
action, action,
current_user, current_user,
......
...@@ -132,7 +132,7 @@ class IssuableBaseService < BaseService ...@@ -132,7 +132,7 @@ class IssuableBaseService < BaseService
def create_issuable(issuable, attributes, label_ids:) def create_issuable(issuable, attributes, label_ids:)
issuable.with_transaction_returning_status do issuable.with_transaction_returning_status do
if issuable.save if issuable.save
issuable.update_attributes(label_ids: label_ids) issuable.update(label_ids: label_ids)
end end
end end
end end
......
...@@ -8,7 +8,7 @@ module Members ...@@ -8,7 +8,7 @@ module Members
old_access_level = member.human_access old_access_level = member.human_access
if member.update_attributes(params) if member.update(params)
after_execute(action: permission, old_access_level: old_access_level, member: member) after_execute(action: permission, old_access_level: old_access_level, member: member)
end end
......
...@@ -26,7 +26,7 @@ module MergeRequests ...@@ -26,7 +26,7 @@ module MergeRequests
Gitlab::GitLogger.info("#{log_prefix} rebased to #{rebase_sha}") Gitlab::GitLogger.info("#{log_prefix} rebased to #{rebase_sha}")
merge_request.update_attributes(rebase_commit_sha: rebase_sha) merge_request.update(rebase_commit_sha: rebase_sha)
Gitlab::GitLogger.info("#{log_prefix} rebase SHA saved: #{rebase_sha}") Gitlab::GitLogger.info("#{log_prefix} rebase SHA saved: #{rebase_sha}")
......
...@@ -11,7 +11,7 @@ module Milestones ...@@ -11,7 +11,7 @@ module Milestones
end end
if params.present? if params.present?
milestone.update_attributes(params.except(:state_event)) milestone.update(params.except(:state_event))
end end
milestone milestone
......
...@@ -5,7 +5,7 @@ module Notes ...@@ -5,7 +5,7 @@ module Notes
old_mentioned_users = note.mentioned_users.to_a old_mentioned_users = note.mentioned_users.to_a
note.update_attributes(params.merge(updated_by: current_user)) note.update(params.merge(updated_by: current_user))
note.create_new_cross_references!(current_user) note.create_new_cross_references!(current_user)
if note.previous_changes.include?('note') if note.previous_changes.include?('note')
......
...@@ -10,16 +10,16 @@ module NotificationRecipientService ...@@ -10,16 +10,16 @@ module NotificationRecipientService
NotificationRecipient.new(user, *args).notifiable? NotificationRecipient.new(user, *args).notifiable?
end end
def self.build_recipients(*a) def self.build_recipients(*args)
Builder::Default.new(*a).notification_recipients Builder::Default.new(*args).notification_recipients
end end
def self.build_new_note_recipients(*a) def self.build_new_note_recipients(*args)
Builder::NewNote.new(*a).notification_recipients Builder::NewNote.new(*args).notification_recipients
end end
def self.build_merge_request_unmergeable_recipients(*a) def self.build_merge_request_unmergeable_recipients(*args)
Builder::MergeRequestUnmergeable.new(*a).notification_recipients Builder::MergeRequestUnmergeable.new(*args).notification_recipients
end end
module Builder module Builder
...@@ -44,7 +44,6 @@ module NotificationRecipientService ...@@ -44,7 +44,6 @@ module NotificationRecipientService
raise 'abstract' raise 'abstract'
end end
# rubocop:disable Rails/Delegate
def project def project
target.project target.project
end end
......
...@@ -125,7 +125,7 @@ module Projects ...@@ -125,7 +125,7 @@ module Projects
# It's possible that the project was destroyed, but some after_commit # It's possible that the project was destroyed, but some after_commit
# hook failed and caused us to end up here. A destroyed model will be a frozen hash, # hook failed and caused us to end up here. A destroyed model will be a frozen hash,
# which cannot be altered. # which cannot be altered.
project.update_attributes(delete_error: message, pending_delete: false) unless project.destroyed? project.update(delete_error: message, pending_delete: false) unless project.destroyed?
log_error("Deletion failed on #{project.full_path} with the following message: #{message}") log_error("Deletion failed on #{project.full_path} with the following message: #{message}")
end end
......
...@@ -37,7 +37,7 @@ module Projects ...@@ -37,7 +37,7 @@ module Projects
return new_project unless new_project.persisted? return new_project unless new_project.persisted?
builds_access_level = @project.project_feature.builds_access_level builds_access_level = @project.project_feature.builds_access_level
new_project.project_feature.update_attributes(builds_access_level: builds_access_level) new_project.project_feature.update(builds_access_level: builds_access_level)
link_fork_network(new_project) link_fork_network(new_project)
......
...@@ -22,7 +22,7 @@ module Projects ...@@ -22,7 +22,7 @@ module Projects
private private
def download_and_save_file(file, sanitized_uri) def download_and_save_file(file, sanitized_uri)
IO.copy_stream(open(sanitized_uri.sanitized_url, headers(sanitized_uri)), file) IO.copy_stream(open(sanitized_uri.sanitized_url, headers(sanitized_uri)), file) # rubocop:disable Security/Open
end end
def headers(sanitized_uri) def headers(sanitized_uri)
......
...@@ -24,7 +24,7 @@ module Projects ...@@ -24,7 +24,7 @@ module Projects
# If the block added errors, don't try to save the project # If the block added errors, don't try to save the project
return validation_failed! if project.errors.any? return validation_failed! if project.errors.any?
if project.update_attributes(params.except(:default_branch)) if project.update(params.except(:default_branch))
if project.previous_changes.include?('path') if project.previous_changes.include?('path')
project.rename_repo project.rename_repo
else else
......
...@@ -7,7 +7,7 @@ class UpdateReleaseService < BaseService ...@@ -7,7 +7,7 @@ class UpdateReleaseService < BaseService
release = project.releases.find_by(tag: tag_name) release = project.releases.find_by(tag: tag_name)
if release if release
release.update_attributes(description: release_description) release.update(description: release_description)
success(release) success(release)
else else
......
...@@ -15,14 +15,14 @@ class EmailReceiverWorker ...@@ -15,14 +15,14 @@ class EmailReceiverWorker
private private
def handle_failure(raw, e) def handle_failure(raw, error)
Rails.logger.warn("Email can not be processed: #{e}\n\n#{raw}") Rails.logger.warn("Email can not be processed: #{error}\n\n#{raw}")
return unless raw.present? return unless raw.present?
can_retry = false can_retry = false
reason = reason =
case e case error
when Gitlab::Email::UnknownIncomingEmail when Gitlab::Email::UnknownIncomingEmail
"We couldn't figure out what the email is for. Please create your issue or comment through the web interface." "We couldn't figure out what the email is for. Please create your issue or comment through the web interface."
when Gitlab::Email::SentNotificationNotFoundError when Gitlab::Email::SentNotificationNotFoundError
...@@ -42,7 +42,7 @@ class EmailReceiverWorker ...@@ -42,7 +42,7 @@ class EmailReceiverWorker
"The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member." "The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member."
when Gitlab::Email::InvalidRecordError when Gitlab::Email::InvalidRecordError
can_retry = true can_retry = true
e.message error.message
end end
if reason if reason
......
# frozen_string_literal: true # frozen_string_literal: true
# rubocop:disable Metrics/LineLength
# rubocop:disable Style/Documentation
module ObjectStorage module ObjectStorage
class MigrateUploadsWorker class MigrateUploadsWorker
......
require File.expand_path('../boot', __FILE__) require File.expand_path('boot', __dir__)
require 'rails/all' require 'rails/all'
...@@ -239,7 +239,7 @@ module Gitlab ...@@ -239,7 +239,7 @@ module Gitlab
next unless name.include?('namespace_project') next unless name.include?('namespace_project')
define_method(name.sub('namespace_project', 'project')) do |project, *args| define_method(name.sub('namespace_project', 'project')) do |project, *args|
send(name, project&.namespace, project, *args) # rubocop:disable GitlabSecurity/PublicSend send(name, project&.namespace, project, *args)
end end
end end
end end
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
if %w[1 true].include?(ENV["RAILS5"]) if %w[1 true].include?(ENV["RAILS5"])
require_relative 'application' require_relative 'application'
else else
require File.expand_path('../application', __FILE__) require File.expand_path('application', __dir__)
end end
# Initialize the rails application # Initialize the rails application
......
...@@ -17,7 +17,7 @@ module ActiveRecord ...@@ -17,7 +17,7 @@ module ActiveRecord
lock_col = self.class.locking_column lock_col = self.class.locking_column
previous_lock_value = send(lock_col).to_i # rubocop:disable GitlabSecurity/PublicSend previous_lock_value = send(lock_col).to_i
# This line is added as a patch # This line is added as a patch
previous_lock_value = nil if previous_lock_value == '0' || previous_lock_value == 0 previous_lock_value = nil if previous_lock_value == '0' || previous_lock_value == 0
...@@ -47,7 +47,7 @@ module ActiveRecord ...@@ -47,7 +47,7 @@ module ActiveRecord
# If something went wrong, revert the version. # If something went wrong, revert the version.
rescue Exception rescue Exception
send(lock_col + '=', previous_lock_value) # rubocop:disable GitlabSecurity/PublicSend send(lock_col + '=', previous_lock_value)
raise raise
end end
end end
......
...@@ -47,7 +47,7 @@ class Admin::LicensesController < Admin::ApplicationController ...@@ -47,7 +47,7 @@ class Admin::LicensesController < Admin::ApplicationController
flash[:alert] = "The license was removed. GitLab now no longer has a valid license." flash[:alert] = "The license was removed. GitLab now no longer has a valid license."
end end
redirect_to admin_license_path, status: 302 redirect_to admin_license_path, status: :found
end end
private private
......
...@@ -8,7 +8,7 @@ class Admin::PushRulesController < Admin::ApplicationController ...@@ -8,7 +8,7 @@ class Admin::PushRulesController < Admin::ApplicationController
end end
def update def update
@push_rule.update_attributes(push_rule_params) @push_rule.update(push_rule_params)
if @push_rule.valid? if @push_rule.valid?
redirect_to admin_push_rule_path, notice: 'Push Rule updated successfully.' redirect_to admin_push_rule_path, notice: 'Push Rule updated successfully.'
......
...@@ -48,7 +48,7 @@ module EE ...@@ -48,7 +48,7 @@ module EE
respond_to do |format| respond_to do |format|
format.json { head :ok } format.json { head :ok }
format.html { redirect_to boards_path, status: 302 } format.html { redirect_to boards_path, status: :found }
end end
end end
......
...@@ -44,7 +44,7 @@ module EE ...@@ -44,7 +44,7 @@ module EE
end end
def render_bad_geo_auth(message) def render_bad_geo_auth(message)
render plain: "Geo JWT authentication failed: #{message}", status: 401 render plain: "Geo JWT authentication failed: #{message}", status: :unauthorized
end end
end end
end end
......
...@@ -48,7 +48,6 @@ module EE ...@@ -48,7 +48,6 @@ module EE
.find_by!(iid: params[:id]) .find_by!(iid: params[:id])
super super
end end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def define_edit_vars def define_edit_vars
super super
......
...@@ -13,20 +13,20 @@ module EE ...@@ -13,20 +13,20 @@ module EE
if lookup.error.present? if lookup.error.present?
# Failed to read keys # Failed to read keys
render json: { message: lookup.error }, status: 400 render json: { message: lookup.error }, status: :bad_request
elsif lookup.known_hosts.nil? elsif lookup.known_hosts.nil?
# Still working, come back later # Still working, come back later
render body: nil, status: 204 render body: nil, status: :no_content
else else
render json: lookup render json: lookup
end end
rescue ArgumentError => err rescue ArgumentError => err
render json: { message: err.message }, status: 400 render json: { message: err.message }, status: :bad_request
end end
override :update override :update
def update def update
if project.update_attributes(safe_mirror_params) if project.update(safe_mirror_params)
if project.mirror? if project.mirror?
project.force_import_job! project.force_import_job!
......
...@@ -67,7 +67,7 @@ module EE ...@@ -67,7 +67,7 @@ module EE
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to edit_project_service_path(project, ::PrometheusService), status: 303 redirect_to edit_project_service_path(project, ::PrometheusService), status: :see_other
end end
format.json do format.json do
head :ok head :ok
......
...@@ -17,7 +17,7 @@ class Groups::AnalyticsController < Groups::ApplicationController ...@@ -17,7 +17,7 @@ class Groups::AnalyticsController < Groups::ApplicationController
format.json do format.json do
render json: GroupAnalyticsSerializer render json: GroupAnalyticsSerializer
.new(events: event_totals) .new(events: event_totals)
.represent(users), status: 200 .represent(users), status: :ok
end end
end end
end end
......
...@@ -44,7 +44,7 @@ class Groups::HooksController < Groups::ApplicationController ...@@ -44,7 +44,7 @@ class Groups::HooksController < Groups::ApplicationController
def destroy def destroy
hook.destroy hook.destroy
redirect_to group_hooks_path(@group), status: 302 redirect_to group_hooks_path(@group), status: :found
end end
private private
......
...@@ -25,7 +25,7 @@ class Projects::PathLocksController < Projects::ApplicationController ...@@ -25,7 +25,7 @@ class Projects::PathLocksController < Projects::ApplicationController
head :ok head :ok
rescue PathLocks::UnlockService::AccessDenied, PathLocks::LockService::AccessDenied rescue PathLocks::UnlockService::AccessDenied, PathLocks::LockService::AccessDenied
return access_denied! access_denied!
end end
def destroy def destroy
...@@ -39,7 +39,7 @@ class Projects::PathLocksController < Projects::ApplicationController ...@@ -39,7 +39,7 @@ class Projects::PathLocksController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to project_locks_path(@project), status: 302 redirect_to project_locks_path(@project), status: :found
end end
format.js format.js
end end
......
...@@ -11,7 +11,7 @@ class Projects::PushRulesController < Projects::ApplicationController ...@@ -11,7 +11,7 @@ class Projects::PushRulesController < Projects::ApplicationController
def update def update
@push_rule = project.push_rule @push_rule = project.push_rule
@push_rule.update_attributes(push_rule_params) @push_rule.update(push_rule_params)
if @push_rule.valid? if @push_rule.valid?
flash[:notice] = 'Push Rules updated successfully.' flash[:notice] = 'Push Rules updated successfully.'
......
...@@ -19,7 +19,7 @@ module PushRulesHelper ...@@ -19,7 +19,7 @@ module PushRulesHelper
if push_rule.global? if push_rule.global?
messages << s_("ProjectSettings|This setting will be applied to all projects unless overridden by an admin.") messages << s_("ProjectSettings|This setting will be applied to all projects unless overridden by an admin.")
else else
enabled_globally = PushRule.global&.public_send(rule) # rubocop:disable GitlabSecurity/PublicSend enabled_globally = PushRule.global&.public_send(rule)
enabled_in_project = push_rule.public_send(rule) # rubocop:disable GitlabSecurity/PublicSend enabled_in_project = push_rule.public_send(rule) # rubocop:disable GitlabSecurity/PublicSend
if enabled_globally if enabled_globally
......
...@@ -88,7 +88,7 @@ class Burndown ...@@ -88,7 +88,7 @@ class Burndown
# reopened. # reopened.
internal_clause = internal_clause =
::Issue ::Issue
.joins("LEFT OUTER JOIN events e ON issues.id = e.target_id AND e.target_type = 'Issue' AND e.action = #{Event::CLOSED}") # rubocop:disable GitlabSecurity/SqlInjection .joins("LEFT OUTER JOIN events e ON issues.id = e.target_id AND e.target_type = 'Issue' AND e.action = #{Event::CLOSED}")
.where(milestone: @milestone) .where(milestone: @milestone)
.where("state = 'closed' OR (state = 'opened' AND e.action = #{Event::CLOSED})") # rubocop:disable GitlabSecurity/SqlInjection .where("state = 'closed' OR (state = 'opened' AND e.action = #{Event::CLOSED})") # rubocop:disable GitlabSecurity/SqlInjection
......
...@@ -11,7 +11,7 @@ module EE ...@@ -11,7 +11,7 @@ module EE
# If we don't `protected_branch` or `protected_tag` would be empty and # If we don't `protected_branch` or `protected_tag` would be empty and
# `project` cannot be delegated to it, which in turn would cause validations # `project` cannot be delegated to it, which in turn would cause validations
# to fail. # to fail.
has_many :"#{type}_access_levels", inverse_of: self.model_name.singular # rubocop:disable Cop/ActiveRecordDependent has_many :"#{type}_access_levels", inverse_of: self.model_name.singular
accepts_nested_attributes_for :"#{type}_access_levels", allow_destroy: true accepts_nested_attributes_for :"#{type}_access_levels", allow_destroy: true
......
...@@ -11,7 +11,7 @@ module CiCd ...@@ -11,7 +11,7 @@ module CiCd
private private
def update_project def update_project
project.update_attributes( project.update(
mirror: true, mirror: true,
mirror_trigger_builds: true, mirror_trigger_builds: true,
mirror_overwrites_diverged_branches: true, mirror_overwrites_diverged_branches: true,
...@@ -21,7 +21,7 @@ module CiCd ...@@ -21,7 +21,7 @@ module CiCd
end end
def disable_project_features def disable_project_features
project.project_feature.update_attributes( project.project_feature.update(
issues_access_level: ProjectFeature::DISABLED, issues_access_level: ProjectFeature::DISABLED,
merge_requests_access_level: ProjectFeature::DISABLED, merge_requests_access_level: ProjectFeature::DISABLED,
wiki_access_level: ProjectFeature::DISABLED, wiki_access_level: ProjectFeature::DISABLED,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment