Commit 61412231 authored by Igor Drozdov's avatar Igor Drozdov

Enable Style/NestedParenthesizedCalls cop

The cop checks for unparenthesized method calls in the arguments:

@good
method1(method2(arg))

@bad
method1(method2 arg)
parent c27e6fc5
......@@ -491,13 +491,6 @@ Style/MultilineIfModifier:
- 'app/services/ci/process_pipeline_service.rb'
- 'lib/api/commit_statuses.rb'
# Offense count: 34
# Cop supports --auto-correct.
# Configuration parameters: Whitelist.
# Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
Style/NestedParenthesizedCalls:
Enabled: false
# Offense count: 25
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinBodyLength.
......
......@@ -5,4 +5,4 @@
-# per_page: number of items to fetch per page
-# remote: data-remote
%li.page-item.disabled.d-none.d-md-block
= link_to raw(t 'views.pagination.truncate'), '#', class: 'page-link'
= link_to raw(t('views.pagination.truncate')), '#', class: 'page-link'
document.write('#{escape_javascript(stylesheet_link_tag "#{stylesheet_url 'snippets'}")}');
document.write('#{escape_javascript(render 'shared/snippets/embed')}');
document.write('#{escape_javascript(stylesheet_link_tag("#{stylesheet_url 'snippets'}"))}');
document.write('#{escape_javascript(render('shared/snippets/embed'))}');
......@@ -133,7 +133,7 @@ class IrkerWorker # rubocop:disable Scalability/IdempotentWorker
commit = commit_from_id project, hook_attrs['id']
sha = colorize_sha Commit.truncate_sha(hook_attrs['id'])
author = hook_attrs['author']['name']
files = colorize_nb_files(files_count commit)
files = colorize_nb_files(files_count(commit))
title = commit.title
sendtoirker "#{repo_name}/#{branch} #{sha} #{author} (#{files}): #{title}"
......
:plain
var target = $(".project-templates-buttons#custom-group-project-templates");
target.empty();
target.html("#{escape_javascript(render 'custom_project_templates_from_groups', groups_with_project_templates: @groups_with_project_templates)}");
target.html("#{escape_javascript(render('custom_project_templates_from_groups', groups_with_project_templates: @groups_with_project_templates))}");
target.trigger("ajax:success");
:plain
var target = $(".project-templates-buttons#custom-instance-project-templates");
target.empty();
target.html("#{escape_javascript(render 'custom_project_templates', custom_project_templates: @custom_project_templates)}");
target.html("#{escape_javascript(render('custom_project_templates', custom_project_templates: @custom_project_templates))}");
target.trigger("ajax:success");
......@@ -17,11 +17,11 @@ module Gitlab::UsageCounters
end
def count(event)
increment(redis_key event)
increment(redis_key(event))
end
def read(event)
total_count(redis_key event)
total_count(redis_key(event))
end
def totals
......
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :group_with_members, parent: :group do
after(:create) do |group, evaluator|
group.add_developer(create :user)
group.add_developer(create(:user))
end
end
......
......@@ -14,11 +14,11 @@ module Gitlab::UsageDataCounters
end
def count(event)
increment(redis_key event)
increment(redis_key(event))
end
def read(event)
total_count(redis_key event)
total_count(redis_key(event))
end
def totals
......
......@@ -36,7 +36,7 @@ module SystemCheck
sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global core.autocrlf \"#{OPTIONS['core.autocrlf']}\"")
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
end
end
......
......@@ -17,7 +17,7 @@ module SystemCheck
'Update config/gitlab.yml to match your setup'
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
fix_and_rerun
end
......
......@@ -23,7 +23,7 @@ module SystemCheck
'Update config/gitlab.yml to match your setup'
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
fix_and_rerun
end
......
......@@ -20,7 +20,7 @@ module SystemCheck
'Install the init script'
)
for_more_information(
see_installation_guide_section 'Install Init Script'
see_installation_guide_section('Install Init Script')
)
fix_and_rerun
end
......
......@@ -32,7 +32,7 @@ module SystemCheck
'Re-download the init script'
)
for_more_information(
see_installation_guide_section 'Install Init Script'
see_installation_guide_section('Install Init Script')
)
fix_and_rerun
end
......
......@@ -15,7 +15,7 @@ module SystemCheck
"sudo chmod -R u+rwX #{log_path}"
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
fix_and_rerun
end
......
......@@ -15,7 +15,7 @@ module SystemCheck
"sudo chmod -R u+rwX #{tmp_path}"
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
fix_and_rerun
end
......
......@@ -14,7 +14,7 @@ module SystemCheck
"sudo -u #{gitlab_user} mkdir #{Rails.root}/public/uploads"
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
fix_and_rerun
end
......
......@@ -19,7 +19,7 @@ module SystemCheck
"sudo chmod 700 #{uploads_fullpath}"
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
fix_and_rerun
end
......
......@@ -23,7 +23,7 @@ module SystemCheck
"sudo find #{uploads_fullpath} -type d -not -path #{uploads_fullpath} -exec chmod 0700 {} \\;"
)
for_more_information(
see_installation_guide_section 'GitLab'
see_installation_guide_section('GitLab')
)
fix_and_rerun
end
......
......@@ -105,7 +105,7 @@ module QA
return if username_or_email.nil?
response = parse_body(get Runtime::API::Request.new(@api_client, "/users?search=#{username_or_email}").url)
response = parse_body(get(Runtime::API::Request.new(@api_client, "/users?search=#{username_or_email}").url))
if response.any?
raise "GET /users?search=#{username_or_email} returned multiple results. response: #{response}" if response.size > 1
......
......@@ -23,12 +23,12 @@ describe QA::Page::Base do
it 'makes it possible to define page views' do
expect(subject.views.size).to eq 2
expect(subject.views).to all(be_an_instance_of QA::Page::View)
expect(subject.views).to all(be_an_instance_of(QA::Page::View))
end
it 'populates views objects with data about elements' do
expect(subject.elements.size).to eq 3
expect(subject.elements).to all(be_an_instance_of QA::Page::Element)
expect(subject.elements).to all(be_an_instance_of(QA::Page::Element))
expect(subject.elements.map(&:name))
.to eq [:something, :something_else, :another_element]
end
......
......@@ -196,7 +196,7 @@ describe Gitlab::Auth::CurrentUserMode, :do_not_mock_admin_mode, :request_store
subject.request_admin_mode!
subject.enable_admin_mode!(password: user.password)
expect(session).to include(expected_session_entry(be_within(1.second).of Time.now))
expect(session).to include(expected_session_entry(be_within(1.second).of(Time.now)))
end
end
......
......@@ -66,7 +66,7 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do
describe '#children' do
subject { |example| path(example).children }
it { is_expected.to all(be_an_instance_of described_class) }
it { is_expected.to all(be_an_instance_of(described_class)) }
it do
is_expected.to contain_exactly entry('path/dir_1/file_1'),
entry('path/dir_1/file_b'),
......@@ -78,7 +78,7 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do
subject { |example| path(example).files }
it { is_expected.to all(be_file) }
it { is_expected.to all(be_an_instance_of described_class) }
it { is_expected.to all(be_an_instance_of(described_class)) }
it do
is_expected.to contain_exactly entry('path/dir_1/file_1'),
entry('path/dir_1/file_b')
......@@ -90,7 +90,7 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do
subject { |example| path(example).directories }
it { is_expected.to all(be_directory) }
it { is_expected.to all(be_an_instance_of described_class) }
it { is_expected.to all(be_an_instance_of(described_class)) }
it { is_expected.to contain_exactly entry('path/dir_1/subdir/') }
end
......@@ -98,7 +98,7 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do
subject { |example| path(example).directories(parent: true) }
it { is_expected.to all(be_directory) }
it { is_expected.to all(be_an_instance_of described_class) }
it { is_expected.to all(be_an_instance_of(described_class)) }
it do
is_expected.to contain_exactly entry('path/dir_1/subdir/'),
entry('path/')
......
......@@ -69,7 +69,7 @@ describe Gitlab::Email::Message::RepositoryPush do
describe '#diffs' do
subject { message.diffs }
it { is_expected.to all(be_an_instance_of Gitlab::Diff::File) }
it { is_expected.to all(be_an_instance_of(Gitlab::Diff::File)) }
end
describe '#diffs_count' do
......
......@@ -74,7 +74,7 @@ describe Gitlab::Gfm::UploadsRewriter do
end
it 'throw an error' do
expect { rewriter.rewrite(new_project) }.to raise_error(an_instance_of(StandardError).and having_attributes(message: "Invalid path"))
expect { rewriter.rewrite(new_project) }.to raise_error(an_instance_of(StandardError).and(having_attributes(message: "Invalid path")))
end
end
......
......@@ -230,7 +230,7 @@ describe Notify do
is_expected.to have_referable_subject(issue, reply: true)
is_expected.to have_body_text(status)
is_expected.to have_body_text(current_user_sanitized)
is_expected.to have_body_text(project_issue_path project, issue)
is_expected.to have_body_text(project_issue_path(project, issue))
end
end
end
......
......@@ -910,13 +910,13 @@ describe API::MergeRequests do
get api("/projects/#{project.id}/merge_requests/#{merge_request.reload.iid}", user)
expect(json_response['merged_by']['id']).to eq(merge_request.metrics.merged_by_id)
expect(Time.parse json_response['merged_at']).to be_like_time(merge_request.metrics.merged_at)
expect(Time.parse(json_response['merged_at'])).to be_like_time(merge_request.metrics.merged_at)
expect(json_response['closed_by']['id']).to eq(merge_request.metrics.latest_closed_by_id)
expect(Time.parse json_response['closed_at']).to be_like_time(merge_request.metrics.latest_closed_at)
expect(Time.parse(json_response['closed_at'])).to be_like_time(merge_request.metrics.latest_closed_at)
expect(json_response['pipeline']['id']).to eq(merge_request.metrics.pipeline_id)
expect(Time.parse json_response['latest_build_started_at']).to be_like_time(merge_request.metrics.latest_build_started_at)
expect(Time.parse json_response['latest_build_finished_at']).to be_like_time(merge_request.metrics.latest_build_finished_at)
expect(Time.parse json_response['first_deployed_to_production_at']).to be_like_time(merge_request.metrics.first_deployed_to_production_at)
expect(Time.parse(json_response['latest_build_started_at'])).to be_like_time(merge_request.metrics.latest_build_started_at)
expect(Time.parse(json_response['latest_build_finished_at'])).to be_like_time(merge_request.metrics.latest_build_finished_at)
expect(Time.parse(json_response['first_deployed_to_production_at'])).to be_like_time(merge_request.metrics.first_deployed_to_production_at)
end
end
......
......@@ -27,6 +27,6 @@ describe Projects::GroupLinks::CreateService, '#execute' do
end
it 'returns error if user is not allowed to share with a group' do
expect { subject.execute(create :group) }.not_to change { project.project_group_links.count }
expect { subject.execute(create(:group)) }.not_to change { project.project_group_links.count }
end
end
......@@ -160,7 +160,7 @@ describe Releases::CreateService do
context 'when no milestone is passed in' do
it 'creates a release without a milestone tied to it' do
expect(params.key? :milestones).to be_falsey
expect(params.key?(:milestones)).to be_falsey
service.execute
release = project.releases.last
......
......@@ -94,7 +94,7 @@ describe WikiPages::UpdateService do
end
it 'reports the error' do
expect(service.execute page).to be_invalid
expect(service.execute(page)).to be_invalid
.and have_attributes(errors: be_present)
end
end
......
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