Skip to content
Snippets Groups Projects
Commit ca0effad authored by Mohammad Aseem's avatar Mohammad Aseem
Browse files

Fix Layout/FirstHashElementIndentation offenses

Fix rubocop offenses

Changelog: other
parent 1afc6f8f
No related branches found
No related tags found
1 merge request!105916Fix Layout/FirstHashElementIndentation offenses
Showing
with 87 additions and 103 deletions
......@@ -2,22 +2,6 @@
# Cop supports --autocorrect.
Layout/FirstHashElementIndentation:
Exclude:
- 'app/components/diffs/stats_component.rb'
- 'app/controllers/admin/ci/variables_controller.rb'
- 'app/controllers/admin/system_info_controller.rb'
- 'app/controllers/concerns/milestone_actions.rb'
- 'app/controllers/concerns/render_service_results.rb'
- 'app/controllers/concerns/sourcegraph_decorator.rb'
- 'app/controllers/profiles/two_factor_auths_controller.rb'
- 'app/controllers/projects/badges_controller.rb'
- 'app/controllers/repositories/lfs_locks_api_controller.rb'
- 'app/experiments/concerns/project_commit_count.rb'
- 'app/graphql/mutations/clusters/agent_tokens/create.rb'
- 'app/graphql/mutations/notes/create/diff_note.rb'
- 'app/graphql/mutations/notes/create/image_diff_note.rb'
- 'app/graphql/mutations/notes/create/note.rb'
- 'app/graphql/mutations/todos/restore_many.rb'
- 'app/graphql/resolvers/group_packages_resolver.rb'
- 'app/helpers/avatars_helper.rb'
- 'app/helpers/breadcrumbs_helper.rb'
- 'app/helpers/broadcast_messages_helper.rb'
......
......@@ -14,14 +14,14 @@ def initialize(diff_files:)
def diff_files_data
diffs_map = @diff_files.map do |f|
{
href: "##{helpers.hexdigest(f.file_path)}",
title: f.new_path,
name: f.file_path,
path: diff_file_path_text(f),
icon: diff_file_changed_icon(f),
iconColor: diff_file_changed_icon_color(f).to_s,
added: f.added_lines,
removed: f.removed_lines
href: "##{helpers.hexdigest(f.file_path)}",
title: f.new_path,
name: f.file_path,
path: diff_file_path_text(f),
icon: diff_file_changed_icon(f),
iconColor: diff_file_changed_icon_color(f).to_s,
added: f.added_lines,
removed: f.removed_lines
}
end
......
......@@ -32,8 +32,8 @@ def variables
def render_instance_variables
render status: :ok,
json: {
variables: Ci::InstanceVariableSerializer.new.represent(variables)
}
variables: Ci::InstanceVariableSerializer.new.represent(variables)
}
end
def render_error(errors)
......
......@@ -59,11 +59,11 @@ def show
begin
disk = Sys::Filesystem.stat(mount.mount_point)
@disks.push({
bytes_total: disk.bytes_total,
bytes_used: disk.bytes_used,
disk_name: mount.name,
mount_path: disk.path
})
bytes_total: disk.bytes_total,
bytes_used: disk.bytes_used,
disk_name: mount.name,
mount_path: disk.path
})
rescue Sys::Filesystem::Error
end
end
......
......@@ -8,9 +8,9 @@ def issues
format.html { redirect_to milestone_redirect_path }
format.json do
render json: tabs_json("shared/milestones/_issues_tab", {
issues: @milestone.sorted_issues(current_user), # rubocop:disable Gitlab/ModuleWithInstanceVariables
show_project_name: Gitlab::Utils.to_boolean(params[:show_project_name])
})
issues: @milestone.sorted_issues(current_user), # rubocop:disable Gitlab/ModuleWithInstanceVariables
show_project_name: Gitlab::Utils.to_boolean(params[:show_project_name])
})
end
end
end
......@@ -20,9 +20,9 @@ def merge_requests
format.html { redirect_to milestone_redirect_path }
format.json do
render json: tabs_json("shared/milestones/_merge_requests_tab", {
merge_requests: @milestone.sorted_merge_requests(current_user).preload_milestoneish_associations, # rubocop:disable Gitlab/ModuleWithInstanceVariables
show_project_name: Gitlab::Utils.to_boolean(params[:show_project_name])
})
merge_requests: @milestone.sorted_merge_requests(current_user).preload_milestoneish_associations, # rubocop:disable Gitlab/ModuleWithInstanceVariables
show_project_name: Gitlab::Utils.to_boolean(params[:show_project_name])
})
end
end
end
......@@ -32,8 +32,8 @@ def participants
format.html { redirect_to milestone_redirect_path }
format.json do
render json: tabs_json("shared/milestones/_participants_tab", {
users: @milestone.issue_participants_visible_by_user(current_user) # rubocop:disable Gitlab/ModuleWithInstanceVariables
})
users: @milestone.issue_participants_visible_by_user(current_user) # rubocop:disable Gitlab/ModuleWithInstanceVariables
})
end
end
end
......@@ -46,10 +46,10 @@ def labels
milestone_labels = @milestone.issue_labels_visible_by_user(current_user)
render json: tabs_json("shared/milestones/_labels_tab", {
labels: milestone_labels.map do |label|
label.present(issuable_subject: @milestone.resource_parent)
end
})
labels: milestone_labels.map do |label|
label.present(issuable_subject: @milestone.resource_parent)
end
})
end
end
end
......
......@@ -5,25 +5,25 @@ module RenderServiceResults
def success_response(result)
render({
status: result[:http_status],
json: result[:body]
})
status: result[:http_status],
json: result[:body]
})
end
def continue_polling_response
render({
status: :no_content,
json: {
status: _('processing'),
message: _('Not ready yet. Try again later.')
}
})
status: :no_content,
json: {
status: _('processing'),
message: _('Not ready yet. Try again later.')
}
})
end
def error_response(result)
render({
status: result[:http_status] || :bad_request,
json: { status: result[:status], message: result[:message] }
})
status: result[:http_status] || :bad_request,
json: { status: result[:status], message: result[:message] }
})
end
end
......@@ -22,8 +22,8 @@ def push_sourcegraph_gon
return unless sourcegraph_enabled?
gon.push({
sourcegraph: { url: Gitlab::CurrentSettings.sourcegraph_url }
})
sourcegraph: { url: Gitlab::CurrentSettings.sourcegraph_url }
})
end
def sourcegraph_enabled?
......
......@@ -186,9 +186,9 @@ def setup_webauthn_registration
def u2f_registrations
current_user.u2f_registrations.map do |u2f_registration|
{
name: u2f_registration.name,
created_at: u2f_registration.created_at,
delete_path: profile_u2f_registration_path(u2f_registration)
name: u2f_registration.name,
created_at: u2f_registration.created_at,
delete_path: profile_u2f_registration_path(u2f_registration)
}
end
end
......@@ -196,9 +196,9 @@ def u2f_registrations
def webauthn_registrations
current_user.webauthn_registrations.map do |webauthn_registration|
{
name: webauthn_registration.name,
created_at: webauthn_registration.created_at,
delete_path: profile_webauthn_registration_path(webauthn_registration)
name: webauthn_registration.name,
created_at: webauthn_registration.created_at,
delete_path: profile_webauthn_registration_path(webauthn_registration)
}
end
end
......
......@@ -13,10 +13,10 @@ class Projects::BadgesController < Projects::ApplicationController
def pipeline
pipeline_status = Gitlab::Ci::Badge::Pipeline::Status
.new(project, params[:ref], opts: {
ignore_skipped: params[:ignore_skipped],
key_text: params[:key_text],
key_width: params[:key_width]
})
ignore_skipped: params[:ignore_skipped],
key_text: params[:key_text],
key_width: params[:key_width]
})
render_badge pipeline_status
end
......@@ -24,13 +24,13 @@ def pipeline
def coverage
coverage_report = Gitlab::Ci::Badge::Coverage::Report
.new(project, params[:ref], opts: {
job: params[:job],
key_text: params[:key_text],
key_width: params[:key_width],
min_good: params[:min_good],
min_acceptable: params[:min_acceptable],
min_medium: params[:min_medium]
})
job: params[:job],
key_text: params[:key_text],
key_width: params[:key_width],
min_good: params[:min_good],
min_acceptable: params[:min_acceptable],
min_medium: params[:min_medium]
})
render_badge coverage_report
end
......@@ -38,10 +38,10 @@ def coverage
def release
latest_release = Gitlab::Ci::Badge::Release::LatestRelease
.new(project, current_user, opts: {
key_text: params[:key_text],
key_width: params[:key_width],
order_by: params[:order_by]
})
key_text: params[:key_text],
key_width: params[:key_width],
order_by: params[:order_by]
})
render_badge latest_release
end
......
......@@ -54,9 +54,9 @@ def build_payload(data, process)
def error_payload(message, custom_attrs = {})
custom_attrs.merge({
message: message,
documentation_url: help_url
})
message: message,
documentation_url: help_url
})
end
def split_by_owner(locks)
......
......@@ -10,9 +10,9 @@ def commit_count_for(project, default_count: 0, max_count: nil, **exception_deta
return default_count unless root_ref
Gitlab::GitalyClient::CommitService.new(raw_repo).commit_count(root_ref, {
all: true, # include all branches
max_count: max_count # limit as an optimization
})
all: true, # include all branches
max_count: max_count # limit as an optimization
})
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(e, exception_details)
......
......@@ -49,9 +49,9 @@ def resolve(args)
payload = result.payload
{
secret: payload[:secret],
token: payload[:token],
errors: Array.wrap(result.message)
secret: payload[:secret],
token: payload[:token],
errors: Array.wrap(result.message)
}
end
......
......@@ -31,10 +31,10 @@ def ready?(**args)
def create_note_params(noteable, args)
super(noteable, args).merge({
type: 'DiffNote',
position: position(noteable, args),
merge_request_diff_head_sha: args[:position][:head_sha]
})
type: 'DiffNote',
position: position(noteable, args),
merge_request_diff_head_sha: args[:position][:head_sha]
})
end
def position(noteable, args)
......
......@@ -15,9 +15,9 @@ class ImageDiffNote < Base
def create_note_params(noteable, args)
super(noteable, args).merge({
type: 'DiffNote',
position: position(noteable, args)
})
type: 'DiffNote',
position: position(noteable, args)
})
end
def position(noteable, args)
......
......@@ -31,9 +31,9 @@ def create_note_params(noteable, args)
end
super(noteable, args).merge({
in_reply_to_discussion_id: discussion_id,
merge_request_diff_head_sha: args[:merge_request_diff_head_sha]
})
in_reply_to_discussion_id: discussion_id,
merge_request_diff_head_sha: args[:merge_request_diff_head_sha]
})
end
def authorize_discussion!(discussion)
......
......@@ -23,9 +23,9 @@ def resolve(ids:)
updated_ids = restore(todos)
{
updated_ids: updated_ids,
todos: Todo.id_in(updated_ids),
errors: errors_on_objects(todos)
updated_ids: updated_ids,
todos: Todo.id_in(updated_ids),
errors: errors_on_objects(todos)
}
end
......
......@@ -13,9 +13,9 @@ class GroupPackagesResolver < PackagesBaseResolver
default_value: :created_desc
GROUP_SORT_TO_PARAMS_MAP = SORT_TO_PARAMS_MAP.merge({
project_path_desc: { order_by: 'project_path', sort: 'desc' },
project_path_asc: { order_by: 'project_path', sort: 'asc' }
}).freeze
project_path_desc: { order_by: 'project_path', sort: 'desc' },
project_path_asc: { order_by: 'project_path', sort: 'asc' }
}).freeze
def resolve(sort:, **filters)
return unless packages_available?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment