Commit ebc4ea78 authored by Andrew Newdigate's avatar Andrew Newdigate

Re-enable MethodCallWithoutArgsParentheses Cop

Re-enables and autocorrects all instances of the
Style/MethodCallWithoutArgsParentheses rule
parent 8a6e257d
......@@ -437,11 +437,6 @@ Style/LineEndConcatenation:
- 'spec/lib/gitlab/gfm/reference_rewriter_spec.rb'
- 'spec/lib/gitlab/incoming_email_spec.rb'
# Offense count: 39
# Cop supports --auto-correct.
Style/MethodCallWithoutArgsParentheses:
Enabled: false
# Offense count: 18
Style/MethodMissing:
Enabled: false
......
......@@ -4,7 +4,7 @@
- content_for :page_specific_javascripts do
= stylesheet_link_tag 'page_bundles/ide'
#ide.ide-loading{ data: ide_data() }
#ide.ide-loading{ data: ide_data }
.text-center
= icon('spinner spin 2x')
%h2.clgray= _('Loading the GitLab IDE...')
......@@ -41,7 +41,7 @@ describe 'Dropdown weight', :js do
it 'closes when the search bar is unfocused' do
filtered_search.set('weight:')
find('body').click()
find('body').click
expect(page).to have_css(js_dropdown_weight, visible: false)
end
......
......@@ -77,7 +77,7 @@ describe 'Projects > Audit Events', :js do
visit project_deploy_keys_path(project)
accept_confirm do
find('.ic-remove').click()
find('.ic-remove').click
end
wait_for_all_requests
......
......@@ -31,7 +31,7 @@ module Gitlab
end
class Converter
def on_0(_) reset() end
def on_0(_) reset end
def on_1(_) enable(STYLE_SWITCHES[:bold]) end
......@@ -177,7 +177,7 @@ module Gitlab
end
end
close_open_tags()
close_open_tags
OpenStruct.new(
html: @out.force_encoding(Encoding.default_external),
......@@ -194,7 +194,7 @@ module Gitlab
action = scanner[1]
timestamp = scanner[2]
section = scanner[3]
line = scanner.matched()[0...-5] # strips \r\033[0K
line = scanner.matched[0...-5] # strips \r\033[0K
@out << %{<div class="hidden" data-action="#{action}" data-timestamp="#{timestamp}" data-section="#{section}">#{line}</div>}
end
......@@ -209,10 +209,10 @@ module Gitlab
# sequence gets stripped (including stuff like "delete last line")
return unless indicator == '[' && terminator == 'm'
close_open_tags()
close_open_tags
if commands.empty?()
reset()
if commands.empty?
reset
return
end
......@@ -222,7 +222,7 @@ module Gitlab
end
def evaluate_command_stack(stack)
return unless command = stack.shift()
return unless command = stack.shift
if self.respond_to?("on_#{command}", true)
self.__send__("on_#{command}", stack) # rubocop:disable GitlabSecurity/PublicSend
......@@ -333,8 +333,8 @@ module Gitlab
return unless command_stack.length >= 2
return unless command_stack[0] == "5"
command_stack.shift() # ignore the "5" command
color_index = command_stack.shift().to_i
command_stack.shift # ignore the "5" command
color_index = command_stack.shift.to_i
return unless color_index >= 0
return unless color_index <= 255
......
......@@ -46,7 +46,7 @@ module Gitlab
stream.seek(offset, IO::SEEK_SET)
stream.write(data)
stream.truncate(offset + data.bytesize)
stream.flush()
stream.flush
end
def set(data)
......
......@@ -6,7 +6,7 @@ require 'logger'
describe QA::Support::Page::Logging do
include Support::StubENV
let(:page) { double().as_null_object }
let(:page) { double.as_null_object }
before do
logger = ::Logger.new $stdout
......
......@@ -19,7 +19,7 @@ module Support
allow(ENV).to receive(:[]).with(key).and_return(value)
allow(ENV).to receive(:key?).with(key).and_return(true)
allow(ENV).to receive(:fetch).with(key).and_return(value)
allow(ENV).to receive(:fetch).with(key, anything()) do |_, default_val|
allow(ENV).to receive(:fetch).with(key, anything) do |_, default_val|
value || default_val
end
end
......
......@@ -68,7 +68,7 @@ describe Projects::IssuesController do
end
context 'with page param' do
let(:last_page) { project.issues.page().total_pages }
let(:last_page) { project.issues.page.total_pages }
let!(:issue_list) { create_list(:issue, 2, project: project) }
before do
......
......@@ -158,7 +158,7 @@ describe Projects::MergeRequestsController do
end
context 'when page param' do
let(:last_page) { project.merge_requests.page().total_pages }
let(:last_page) { project.merge_requests.page.total_pages }
let!(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
it 'redirects to last_page if page number is larger than number of pages' do
......
......@@ -12,7 +12,7 @@ describe Projects::SnippetsController do
describe 'GET #index' do
context 'when page param' do
let(:last_page) { project.snippets.page().total_pages }
let(:last_page) { project.snippets.page.total_pages }
let!(:project_snippet) { create(:project_snippet, :public, project: project, author: user) }
it 'redirects to last_page if page number is larger than number of pages' do
......
......@@ -15,7 +15,7 @@ describe 'Tooltips on .timeago dates', :js do
sign_in user
visit user_activity_path(user)
wait_for_requests()
wait_for_requests
page.find('.js-timeago').hover
end
......@@ -32,7 +32,7 @@ describe 'Tooltips on .timeago dates', :js do
sign_in user
visit user_snippets_path(user)
wait_for_requests()
wait_for_requests
page.find('.js-timeago.snippet-created-ago').hover
end
......
......@@ -37,7 +37,7 @@ describe 'Dropdown assignee', :js do
end
it 'closes when the search bar is unfocused' do
find('body').click()
find('body').click
expect(page).to have_css(js_dropdown_assignee, visible: false)
end
......
......@@ -45,7 +45,7 @@ describe 'Dropdown author', :js do
end
it 'closes when the search bar is unfocused' do
find('body').click()
find('body').click
expect(page).to have_css(js_dropdown_author, visible: false)
end
......
......@@ -64,7 +64,7 @@ describe 'Dropdown emoji', :js do
end
it 'closes when the search bar is unfocused' do
find('body').click()
find('body').click
expect(page).to have_css(js_dropdown_emoji, visible: false)
end
......
......@@ -44,7 +44,7 @@ describe 'Dropdown milestone', :js do
end
it 'closes when the search bar is unfocused' do
find('body').click()
find('body').click
expect(page).to have_css(js_dropdown_milestone, visible: false)
end
......
......@@ -20,7 +20,7 @@ describe 'Project deploy keys', :js do
page.within(find('.deploy-keys')) do
expect(page).to have_selector('.deploy-key', count: 1)
accept_confirm { find('.ic-remove').click() }
accept_confirm { find('.ic-remove').click }
wait_for_requests
......
......@@ -50,7 +50,7 @@ end
def check_content_reverted(template_content)
find('.template-selectors-undo-menu .btn-info').click
expect(page).not_to have_content(template_content)
expect(find('.template-type-selector .dropdown-toggle-text')).to have_content()
expect(find('.template-type-selector .dropdown-toggle-text')).to have_content
end
def select_file_template(template_selector_selector, template_name)
......
......@@ -103,7 +103,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
end
it 'shows commit`s data', :js do
requests = inspect_requests() do
requests = inspect_requests do
visit project_job_path(project, job)
end
......@@ -214,7 +214,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
end
it 'downloads the zip file when user clicks the download button' do
requests = inspect_requests() do
requests = inspect_requests do
click_link 'Download'
end
......@@ -824,7 +824,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
before do
job.run!
visit project_job_path(project, job)
find('.js-cancel-job').click()
find('.js-cancel-job').click
end
it 'loads the page and shows all needed controls' do
......@@ -884,7 +884,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
end
it do
requests = inspect_requests() do
requests = inspect_requests do
visit download_project_job_artifacts_path(project, job2)
end
......
......@@ -54,7 +54,7 @@ describe 'Projects > Settings > Repository settings' do
project.deploy_keys << private_deploy_key
visit project_settings_repository_path(project)
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click()
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click
fill_in 'deploy_key_title', with: 'updated_deploy_key'
check 'deploy_key_deploy_keys_projects_attributes_0_can_push'
......@@ -71,14 +71,14 @@ describe 'Projects > Settings > Repository settings' do
visit project_settings_repository_path(project)
find('.js-deployKeys-tab-available_project_keys').click()
find('.js-deployKeys-tab-available_project_keys').click
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click()
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click
fill_in 'deploy_key_title', with: 'updated_deploy_key'
click_button 'Save changes'
find('.js-deployKeys-tab-available_project_keys').click()
find('.js-deployKeys-tab-available_project_keys').click
expect(page).to have_content('updated_deploy_key')
end
......@@ -87,7 +87,7 @@ describe 'Projects > Settings > Repository settings' do
project.deploy_keys << private_deploy_key
visit project_settings_repository_path(project)
accept_confirm { find('.deploy-key', text: private_deploy_key.title).find('.ic-remove').click() }
accept_confirm { find('.deploy-key', text: private_deploy_key.title).find('.ic-remove').click }
expect(page).not_to have_content(private_deploy_key.title)
end
......
......@@ -31,7 +31,7 @@ describe 'Projects > Snippets > User comments on a snippet', :js do
end
it 'should have zen mode' do
find('.js-zen-enter').click()
find('.js-zen-enter').click
expect(page).to have_selector('.fullscreen')
end
end
......@@ -6,7 +6,7 @@ describe SubmoduleHelper do
describe 'submodule links' do
let(:submodule_item) { double(id: 'hash', path: 'rack') }
let(:config) { Gitlab.config.gitlab }
let(:repo) { double() }
let(:repo) { double }
before do
self.instance_variable_set(:@repository, repo)
......
......@@ -37,7 +37,7 @@ describe Gitlab::DataBuilder::Pipeline do
context 'pipeline without variables' do
it 'has empty variables hash' do
expect(attributes[:variables]).to be_a(Array)
expect(attributes[:variables]).to be_empty()
expect(attributes[:variables]).to be_empty
end
end
......
......@@ -16,7 +16,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
"correlation_id" => 'cid'
}
end
let(:logger) { double() }
let(:logger) { double }
let(:start_payload) do
job.merge(
'message' => 'TestWorker JID-da883554ee4fe414012f5f42: start',
......
......@@ -44,7 +44,7 @@ describe ResourceEvents::MergeIntoNotesService do
create_event(created_at: time, user: user2)
create_event(created_at: 1.day.ago, label: label2)
notes = described_class.new(resource, user).execute()
notes = described_class.new(resource, user).execute
expected = [
"added #{label.to_reference} label and removed #{label2.to_reference} label",
......@@ -61,7 +61,7 @@ describe ResourceEvents::MergeIntoNotesService do
event = create_event(created_at: 1.day.ago)
notes = described_class.new(resource, user,
last_fetched_at: 2.days.ago.to_i).execute()
last_fetched_at: 2.days.ago.to_i).execute
expect(notes.count).to eq 1
expect(notes.first.discussion_id).to eq event.discussion_id
......
......@@ -384,6 +384,6 @@ module KubernetesHelpers
end
def empty_deployment_rollout_status
::Gitlab::Kubernetes::RolloutStatus.from_deployments()
::Gitlab::Kubernetes::RolloutStatus.from_deployments
end
end
......@@ -14,7 +14,7 @@ module RakeHelpers
end
def silence_progress_bar
allow_any_instance_of(ProgressBar::Output).to receive(:stream).and_return(double().as_null_object)
allow_any_instance_of(ProgressBar::Output).to receive(:stream).and_return(double.as_null_object)
end
def main_object
......
......@@ -18,7 +18,7 @@ module StubENV
allow(ENV).to receive(:[]).with(key).and_return(value)
allow(ENV).to receive(:key?).with(key).and_return(true)
allow(ENV).to receive(:fetch).with(key).and_return(value)
allow(ENV).to receive(:fetch).with(key, anything()) do |_, default_val|
allow(ENV).to receive(:fetch).with(key, anything) do |_, default_val|
value || default_val
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