Commit 3db37e05 authored by Rémy Coutable's avatar Rémy Coutable

Enable the Style/TrailingCommaInArguments cop

Use the EnforcedStyleForMultiline: no_comma option.
Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent d40e1f54
...@@ -497,6 +497,11 @@ Style/TrailingCommaInLiteral: ...@@ -497,6 +497,11 @@ Style/TrailingCommaInLiteral:
Enabled: true Enabled: true
EnforcedStyleForMultiline: no_comma EnforcedStyleForMultiline: no_comma
# This cop checks for trailing comma in argument lists.
Style/TrailingCommaInArguments:
Enabled: true
EnforcedStyleForMultiline: no_comma
# Checks for %W when interpolation is not needed. # Checks for %W when interpolation is not needed.
Style/UnneededCapitalW: Style/UnneededCapitalW:
Enabled: true Enabled: true
......
...@@ -369,13 +369,6 @@ Style/SymbolProc: ...@@ -369,13 +369,6 @@ Style/SymbolProc:
Style/TernaryParentheses: Style/TernaryParentheses:
Enabled: false Enabled: false
# Offense count: 53
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArguments:
Enabled: false
# Offense count: 18 # Offense count: 18
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AllowNamedUnderscoreVariables. # Configuration parameters: AllowNamedUnderscoreVariables.
......
...@@ -33,7 +33,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController ...@@ -33,7 +33,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController
:color_scheme_id, :color_scheme_id,
:layout, :layout,
:dashboard, :dashboard,
:project_view, :project_view
) )
end end
end end
...@@ -269,7 +269,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -269,7 +269,7 @@ class Projects::IssuesController < Projects::ApplicationController
def issue_params def issue_params
params.require(:issue).permit( params.require(:issue).permit(
:title, :assignee_id, :position, :description, :confidential, :title, :assignee_id, :position, :description, :confidential,
:milestone_id, :due_date, :state_event, :task_num, :lock_version, label_ids: [], assignee_ids: [], :milestone_id, :due_date, :state_event, :task_num, :lock_version, label_ids: [], assignee_ids: []
) )
end end
......
...@@ -39,7 +39,7 @@ class DiffDiscussion < Discussion ...@@ -39,7 +39,7 @@ class DiffDiscussion < Discussion
def reply_attributes def reply_attributes
super.merge( super.merge(
original_position: original_position.to_json, original_position: original_position.to_json,
position: position.to_json, position: position.to_json
) )
end end
end end
...@@ -74,7 +74,7 @@ class Key < ActiveRecord::Base ...@@ -74,7 +74,7 @@ class Key < ActiveRecord::Base
GitlabShellWorker.perform_async( GitlabShellWorker.perform_async(
:remove_key, :remove_key,
shell_id, shell_id,
key, key
) )
end end
......
...@@ -56,7 +56,7 @@ class Namespace < ActiveRecord::Base ...@@ -56,7 +56,7 @@ class Namespace < ActiveRecord::Base
'COALESCE(SUM(ps.storage_size), 0) AS storage_size', 'COALESCE(SUM(ps.storage_size), 0) AS storage_size',
'COALESCE(SUM(ps.repository_size), 0) AS repository_size', 'COALESCE(SUM(ps.repository_size), 0) AS repository_size',
'COALESCE(SUM(ps.lfs_objects_size), 0) AS lfs_objects_size', 'COALESCE(SUM(ps.lfs_objects_size), 0) AS lfs_objects_size',
'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size', 'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size'
) )
end end
......
...@@ -37,7 +37,7 @@ class FlowdockService < Service ...@@ -37,7 +37,7 @@ class FlowdockService < Service
repo: project.repository.path_to_repo, repo: project.repository.path_to_repo,
repo_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}", repo_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}",
commit_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/%s", commit_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/%s",
diff_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/compare/%s...%s", diff_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/compare/%s...%s"
) )
end end
end end
...@@ -833,7 +833,7 @@ class Repository ...@@ -833,7 +833,7 @@ class Repository
actual_options = options.merge( actual_options = options.merge(
parents: [our_commit, their_commit], parents: [our_commit, their_commit],
tree: merge_index.write_tree(rugged), tree: merge_index.write_tree(rugged)
) )
commit_id = create_commit(actual_options) commit_id = create_commit(actual_options)
......
...@@ -39,7 +39,7 @@ class SentNotification < ActiveRecord::Base ...@@ -39,7 +39,7 @@ class SentNotification < ActiveRecord::Base
noteable_type: noteable.class.name, noteable_type: noteable.class.name,
noteable_id: noteable_id, noteable_id: noteable_id,
commit_id: commit_id, commit_id: commit_id
) )
create(attrs) create(attrs)
......
...@@ -38,7 +38,7 @@ module Boards ...@@ -38,7 +38,7 @@ module Boards
attrs.merge!( attrs.merge!(
add_label_ids: add_label_ids, add_label_ids: add_label_ids,
remove_label_ids: remove_label_ids, remove_label_ids: remove_label_ids,
state_event: issue_state, state_event: issue_state
) )
end end
......
...@@ -298,7 +298,7 @@ class NotificationService ...@@ -298,7 +298,7 @@ class NotificationService
recipients ||= NotificationRecipientService.new(pipeline.project).build_pipeline_recipients( recipients ||= NotificationRecipientService.new(pipeline.project).build_pipeline_recipients(
pipeline, pipeline,
pipeline.user, pipeline.user,
action: pipeline.status, action: pipeline.status
).map(&:notification_email) ).map(&:notification_email)
if recipients.any? if recipients.any?
......
...@@ -51,7 +51,7 @@ class SystemHooksService ...@@ -51,7 +51,7 @@ class SystemHooksService
path: model.path, path: model.path,
group_id: model.id, group_id: model.id,
owner_name: owner.respond_to?(:name) ? owner.name : nil, owner_name: owner.respond_to?(:name) ? owner.name : nil,
owner_email: owner.respond_to?(:email) ? owner.email : nil, owner_email: owner.respond_to?(:email) ? owner.email : nil
) )
when GroupMember when GroupMember
data.merge!(group_member_data(model)) data.merge!(group_member_data(model))
......
...@@ -8,7 +8,7 @@ module RepositoryCheck ...@@ -8,7 +8,7 @@ module RepositoryCheck
Project.select(:id).find_in_batches(batch_size: 100) do |batch| Project.select(:id).find_in_batches(batch_size: 100) do |batch|
Project.where(id: batch.map(&:id)).update_all( Project.where(id: batch.map(&:id)).update_all(
last_repository_check_failed: nil, last_repository_check_failed: nil,
last_repository_check_at: nil, last_repository_check_at: nil
) )
end end
end end
......
...@@ -7,7 +7,7 @@ module RepositoryCheck ...@@ -7,7 +7,7 @@ module RepositoryCheck
project = Project.find(project_id) project = Project.find(project_id)
project.update_columns( project.update_columns(
last_repository_check_failed: !check(project), last_repository_check_failed: !check(project),
last_repository_check_at: Time.now, last_repository_check_at: Time.now
) )
end end
......
...@@ -33,7 +33,7 @@ module ActiveRecord ...@@ -33,7 +33,7 @@ module ActiveRecord
affected_rows = relation.where( affected_rows = relation.where(
self.class.primary_key => id, self.class.primary_key => id,
lock_col => previous_lock_value, lock_col => previous_lock_value
).update_all( ).update_all(
attributes_for_update(attribute_names).map do |name| attributes_for_update(attribute_names).map do |name|
[name, _read_attribute(name)] [name, _read_attribute(name)]
......
...@@ -3,7 +3,7 @@ module Hamlit ...@@ -3,7 +3,7 @@ module Hamlit
def call(template) def call(template)
Engine.new( Engine.new(
generator: Temple::Generators::RailsOutputBuffer, generator: Temple::Generators::RailsOutputBuffer,
attr_quote: '"', attr_quote: '"'
).call(template.source) ).call(template.source)
end end
end end
...@@ -11,7 +11,7 @@ end ...@@ -11,7 +11,7 @@ end
ActionView::Template.register_template_handler( ActionView::Template.register_template_handler(
:haml, :haml,
Hamlit::TemplateHandler.new, Hamlit::TemplateHandler.new
) )
Hamlit::Filters.remove_filter('coffee') Hamlit::Filters.remove_filter('coffee')
......
...@@ -30,14 +30,14 @@ if app.config.serve_static_files ...@@ -30,14 +30,14 @@ if app.config.serve_static_files
settings.merge!( settings.merge!(
host: Gitlab.config.gitlab.host, host: Gitlab.config.gitlab.host,
port: Gitlab.config.gitlab.port, port: Gitlab.config.gitlab.port,
https: Gitlab.config.gitlab.https, https: Gitlab.config.gitlab.https
) )
app.config.middleware.insert_before( app.config.middleware.insert_before(
Gitlab::Middleware::Static, Gitlab::Middleware::Static,
Gitlab::Middleware::WebpackProxy, Gitlab::Middleware::WebpackProxy,
proxy_path: app.config.webpack.public_path, proxy_path: app.config.webpack.public_path,
proxy_host: dev_server.host, proxy_host: dev_server.host,
proxy_port: dev_server.port, proxy_port: dev_server.port
) )
end end
......
...@@ -101,7 +101,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps ...@@ -101,7 +101,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
create(:merge_request, create(:merge_request,
title: "Bug fix for public project", title: "Bug fix for public project",
source_project: public_project, source_project: public_project,
target_project: public_project, target_project: public_project
) )
end end
......
...@@ -24,7 +24,7 @@ module API ...@@ -24,7 +24,7 @@ module API
def present_groups(groups, options = {}) def present_groups(groups, options = {})
options = options.reverse_merge( options = options.reverse_merge(
with: Entities::Group, with: Entities::Group,
current_user: current_user, current_user: current_user
) )
groups = groups.with_statistics if options[:statistics] groups = groups.with_statistics if options[:statistics]
......
...@@ -301,7 +301,7 @@ module API ...@@ -301,7 +301,7 @@ module API
UploadedFile.new( UploadedFile.new(
file_path, file_path,
params["#{field}.name"], params["#{field}.name"],
params["#{field}.type"] || 'application/octet-stream', params["#{field}.type"] || 'application/octet-stream'
) )
end end
......
...@@ -69,7 +69,7 @@ module API ...@@ -69,7 +69,7 @@ module API
options = options.reverse_merge( options = options.reverse_merge(
with: Entities::Project, with: Entities::Project,
current_user: current_user, current_user: current_user,
simple: params[:simple], simple: params[:simple]
) )
projects = filter_projects(projects) projects = filter_projects(projects)
......
...@@ -20,7 +20,7 @@ module API ...@@ -20,7 +20,7 @@ module API
def present_groups(groups, options = {}) def present_groups(groups, options = {})
options = options.reverse_merge( options = options.reverse_merge(
with: Entities::Group, with: Entities::Group,
current_user: current_user, current_user: current_user
) )
groups = groups.with_statistics if options[:statistics] groups = groups.with_statistics if options[:statistics]
......
...@@ -88,7 +88,7 @@ module API ...@@ -88,7 +88,7 @@ module API
options = options.reverse_merge( options = options.reverse_merge(
with: ::API::V3::Entities::Project, with: ::API::V3::Entities::Project,
current_user: current_user, current_user: current_user,
simple: params[:simple], simple: params[:simple]
) )
projects = filter_projects(projects) projects = filter_projects(projects)
......
...@@ -90,7 +90,7 @@ module Gitlab ...@@ -90,7 +90,7 @@ module Gitlab
name: blob_entry[:name], name: blob_entry[:name],
data: '', data: '',
path: path, path: path,
commit_id: sha, commit_id: sha
) )
end end
end end
......
...@@ -35,7 +35,7 @@ module Gitlab ...@@ -35,7 +35,7 @@ module Gitlab
type: entry[:type], type: entry[:type],
mode: entry[:filemode].to_s(8), mode: entry[:filemode].to_s(8),
path: path ? File.join(path, entry[:name]) : entry[:name], path: path ? File.join(path, entry[:name]) : entry[:name],
commit_id: sha, commit_id: sha
) )
end end
end end
......
...@@ -34,7 +34,7 @@ module Gitlab ...@@ -34,7 +34,7 @@ module Gitlab
left_commit_id: parent_id, left_commit_id: parent_id,
right_commit_id: commit.id, right_commit_id: commit.id,
ignore_whitespace_change: options.fetch(:ignore_whitespace_change, false), ignore_whitespace_change: options.fetch(:ignore_whitespace_change, false),
paths: options.fetch(:paths, []), paths: options.fetch(:paths, [])
) )
Gitlab::Git::DiffCollection.new(stub.commit_diff(request), options) Gitlab::Git::DiffCollection.new(stub.commit_diff(request), options)
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
Gitaly::Repository.new( Gitaly::Repository.new(
path: File.join(Gitlab.config.repositories.storages[repository_storage]['path'], relative_path), path: File.join(Gitlab.config.repositories.storages[repository_storage]['path'], relative_path),
storage_name: repository_storage, storage_name: repository_storage,
relative_path: relative_path, relative_path: relative_path
) )
end end
end end
......
...@@ -39,7 +39,7 @@ module Gitlab ...@@ -39,7 +39,7 @@ module Gitlab
def adapter_options def adapter_options
opts = base_options.merge( opts = base_options.merge(
encryption: encryption, encryption: encryption
) )
opts.merge!(auth_options) if has_auth? opts.merge!(auth_options) if has_auth?
......
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
Raven.user_context( Raven.user_context(
id: current_user.id, id: current_user.id,
email: current_user.email, email: current_user.email,
username: current_user.username, username: current_user.username
) )
end end
end end
......
...@@ -165,7 +165,7 @@ module Gitlab ...@@ -165,7 +165,7 @@ module Gitlab
encoded_message, encoded_message,
secret, secret,
true, true,
{ iss: 'gitlab-workhorse', verify_iss: true, algorithm: 'HS256' }, { iss: 'gitlab-workhorse', verify_iss: true, algorithm: 'HS256' }
) )
end end
......
...@@ -33,7 +33,7 @@ describe GroupsController do ...@@ -33,7 +33,7 @@ describe GroupsController do
before do before do
create_list(:award_emoji, 3, awardable: issue_2) create_list(:award_emoji, 3, awardable: issue_2)
create_list(:award_emoji, 2, awardable: issue_1) create_list(:award_emoji, 2, awardable: issue_1)
create_list(:award_emoji, 2, :downvote, awardable: issue_2,) create_list(:award_emoji, 2, :downvote, awardable: issue_2)
sign_in(user) sign_in(user)
end end
......
...@@ -23,7 +23,7 @@ feature 'Admin uses repository checks', feature: true do ...@@ -23,7 +23,7 @@ feature 'Admin uses repository checks', feature: true do
project = create(:empty_project) project = create(:empty_project)
project.update_columns( project.update_columns(
last_repository_check_failed: true, last_repository_check_failed: true,
last_repository_check_at: Time.now, last_repository_check_at: Time.now
) )
visit_admin_project_page(project) visit_admin_project_page(project)
......
...@@ -96,7 +96,7 @@ describe 'Copy as GFM', feature: true, js: true do ...@@ -96,7 +96,7 @@ describe 'Copy as GFM', feature: true, js: true do
# issue link # issue link
"[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue)})", "[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue)})",
# issue link with note anchor # issue link with note anchor
"[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue, anchor: 'note_123')})", "[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue, anchor: 'note_123')})"
) )
verify( verify(
......
...@@ -22,7 +22,7 @@ describe 'Pipelines', :feature, :js do ...@@ -22,7 +22,7 @@ describe 'Pipelines', :feature, :js do
project: project, project: project,
ref: 'master', ref: 'master',
status: 'running', status: 'running',
sha: project.commit.id, sha: project.commit.id
) )
end end
......
...@@ -716,7 +716,7 @@ module Ci ...@@ -716,7 +716,7 @@ module Ci
expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq( expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq(
paths: ["logs/", "binaries/"], paths: ["logs/", "binaries/"],
untracked: true, untracked: true,
key: 'key', key: 'key'
) )
end end
...@@ -734,7 +734,7 @@ module Ci ...@@ -734,7 +734,7 @@ module Ci
expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq( expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq(
paths: ["logs/", "binaries/"], paths: ["logs/", "binaries/"],
untracked: true, untracked: true,
key: 'key', key: 'key'
) )
end end
...@@ -753,7 +753,7 @@ module Ci ...@@ -753,7 +753,7 @@ module Ci
expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq( expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq(
paths: ["test/"], paths: ["test/"],
untracked: false, untracked: false,
key: 'local', key: 'local'
) )
end end
end end
......
...@@ -175,7 +175,7 @@ describe Gitlab::Auth, lib: true do ...@@ -175,7 +175,7 @@ describe Gitlab::Auth, lib: true do
user = create( user = create(
:user, :user,
username: 'normal_user', username: 'normal_user',
password: 'my-secret', password: 'my-secret'
) )
expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')) expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip'))
...@@ -186,7 +186,7 @@ describe Gitlab::Auth, lib: true do ...@@ -186,7 +186,7 @@ describe Gitlab::Auth, lib: true do
user = create( user = create(
:user, :user,
username: 'oauth2', username: 'oauth2',
password: 'my-secret', password: 'my-secret'
) )
expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')) expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip'))
......
...@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::Entry::Global do ...@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::Entry::Global do
cache: { key: 'k', untracked: true, paths: ['public/'] }, cache: { key: 'k', untracked: true, paths: ['public/'] },
variables: {}, variables: {},
ignore: false, ignore: false,
after_script: ['make clean'] }, after_script: ['make clean'] }
) )
end end
end end
......
...@@ -47,7 +47,7 @@ describe Gitlab::ContributionsCalendar do ...@@ -47,7 +47,7 @@ describe Gitlab::ContributionsCalendar do
action: Event::CREATED, action: Event::CREATED,
target: @targets[project], target: @targets[project],
author: contributor, author: contributor,
created_at: day, created_at: day
) )
end end
......
...@@ -120,7 +120,7 @@ EOT ...@@ -120,7 +120,7 @@ EOT
new_mode: 0100644, new_mode: 0100644,
from_id: '357406f3075a57708d0163752905cc1576fceacc', from_id: '357406f3075a57708d0163752905cc1576fceacc',
to_id: '8e5177d718c561d36efde08bad36b43687ee6bf0', to_id: '8e5177d718c561d36efde08bad36b43687ee6bf0',
raw_chunks: raw_chunks, raw_chunks: raw_chunks
) )
) )
end end
......
...@@ -12,7 +12,7 @@ describe Gitlab::GitalyClient::Commit do ...@@ -12,7 +12,7 @@ describe Gitlab::GitalyClient::Commit do
request = Gitaly::CommitDiffRequest.new( request = Gitaly::CommitDiffRequest.new(
repository: repository_message, repository: repository_message,
left_commit_id: 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660', left_commit_id: 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660',
right_commit_id: commit.id, right_commit_id: commit.id
) )
expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request) expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request)
...@@ -27,7 +27,7 @@ describe Gitlab::GitalyClient::Commit do ...@@ -27,7 +27,7 @@ describe Gitlab::GitalyClient::Commit do
request = Gitaly::CommitDiffRequest.new( request = Gitaly::CommitDiffRequest.new(
repository: repository_message, repository: repository_message,
left_commit_id: '4b825dc642cb6eb9a060e54bf8d69288fbee4904', left_commit_id: '4b825dc642cb6eb9a060e54bf8d69288fbee4904',
right_commit_id: initial_commit.id, right_commit_id: initial_commit.id
) )
expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request) expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request)
......
...@@ -168,7 +168,7 @@ describe KubernetesService, models: true, caching: true do ...@@ -168,7 +168,7 @@ describe KubernetesService, models: true, caching: true do
{ key: 'KUBE_TOKEN', value: 'token', public: false }, { key: 'KUBE_TOKEN', value: 'token', public: false },
{ key: 'KUBE_NAMESPACE', value: 'my-project', public: true }, { key: 'KUBE_NAMESPACE', value: 'my-project', public: true },
{ key: 'KUBE_CA_PEM', value: 'CA PEM DATA', public: true }, { key: 'KUBE_CA_PEM', value: 'CA PEM DATA', public: true },
{ key: 'KUBE_CA_PEM_FILE', value: 'CA PEM DATA', public: true, file: true }, { key: 'KUBE_CA_PEM_FILE', value: 'CA PEM DATA', public: true, file: true }
) )
end end
end end
...@@ -179,7 +179,7 @@ describe KubernetesService, models: true, caching: true do ...@@ -179,7 +179,7 @@ describe KubernetesService, models: true, caching: true do
{ key: 'KUBE_URL', value: 'https://kube.domain.com', public: true }, { key: 'KUBE_URL', value: 'https://kube.domain.com', public: true },
{ key: 'KUBE_TOKEN', value: 'token', public: false }, { key: 'KUBE_TOKEN', value: 'token', public: false },
{ key: 'KUBE_CA_PEM', value: 'CA PEM DATA', public: true }, { key: 'KUBE_CA_PEM', value: 'CA PEM DATA', public: true },
{ key: 'KUBE_CA_PEM_FILE', value: 'CA PEM DATA', public: true, file: true }, { key: 'KUBE_CA_PEM_FILE', value: 'CA PEM DATA', public: true, file: true }
) )
end end
......
...@@ -35,7 +35,7 @@ describe ProjectStatistics, models: true do ...@@ -35,7 +35,7 @@ describe ProjectStatistics, models: true do
commit_count: 8.exabytes - 1, commit_count: 8.exabytes - 1,