diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2019-01-24 15:43:02 +0200 |
---|---|---|
committer | Andrew Newdigate <andrew@gitlab.com> | 2019-01-29 21:05:30 +0200 |
commit | ff0b2cc61fff18186572084790bb0a054090b917 (patch) | |
tree | 88e3afefb751249389afdb627a23ceb7f26bfc7a | |
parent | 96516f7ef32c16d8b85d4be3d8d0252f81341c99 (diff) | |
download | gitlab-ce-ff0b2cc61fff18186572084790bb0a054090b917.tar.gz |
Re-enable MethodCallWithoutArgsParentheses Cop
Re-enables and autocorrects all instances of the
Style/MethodCallWithoutArgsParentheses rule
26 files changed, 42 insertions, 47 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 91810d84c50..c42d11a860e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 diff --git a/app/views/ide/_show.html.haml b/app/views/ide/_show.html.haml index b24d6e27536..057225d021f 100644 --- a/app/views/ide/_show.html.haml +++ b/app/views/ide/_show.html.haml @@ -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...') diff --git a/lib/gitlab/ci/ansi2html.rb b/lib/gitlab/ci/ansi2html.rb index 974b5ad6877..4dcb3869d4f 100644 --- a/lib/gitlab/ci/ansi2html.rb +++ b/lib/gitlab/ci/ansi2html.rb @@ -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 diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb index 0f23b95ba15..e61fb50a303 100644 --- a/lib/gitlab/ci/trace/stream.rb +++ b/lib/gitlab/ci/trace/stream.rb @@ -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) diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index 2666dd3b03b..f289ee3c2bb 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -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 diff --git a/qa/spec/support/stub_env.rb b/qa/spec/support/stub_env.rb index 044804cd599..4788e0ab46c 100644 --- a/qa/spec/support/stub_env.rb +++ b/qa/spec/support/stub_env.rb @@ -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 diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 8ea5b4ea09c..c2afff6b732 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -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 diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 01a27f0429b..ca5ff9b1e3b 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -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 diff --git a/spec/controllers/projects/snippets_controller_spec.rb b/spec/controllers/projects/snippets_controller_spec.rb index 75c9839dd9b..8d9cb2c8ac0 100644 --- a/spec/controllers/projects/snippets_controller_spec.rb +++ b/spec/controllers/projects/snippets_controller_spec.rb @@ -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 diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb index 0db8093411b..f44bd55ecf6 100644 --- a/spec/features/dashboard/datetime_on_tooltips_spec.rb +++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb @@ -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 diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 00c88c61538..e0b1e286dee 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -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 diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index 50d819a6161..bedc61b9eed 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -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 diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index 2ba0fc08c2c..f36d4e8f23f 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -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 diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index e651e83ada3..b330eafe1d1 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -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 diff --git a/spec/features/projects/deploy_keys_spec.rb b/spec/features/projects/deploy_keys_spec.rb index e12532e97fa..1fa9babaff5 100644 --- a/spec/features/projects/deploy_keys_spec.rb +++ b/spec/features/projects/deploy_keys_spec.rb @@ -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 diff --git a/spec/features/projects/files/undo_template_spec.rb b/spec/features/projects/files/undo_template_spec.rb index 5de0bc009fb..fa785ed10ef 100644 --- a/spec/features/projects/files/undo_template_spec.rb +++ b/spec/features/projects/files/undo_template_spec.rb @@ -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) diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 8230396a4cc..24830b2bd3e 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -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 diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 1982136b89d..1259ad45791 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -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 diff --git a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb index d82e350e0f7..9c1ef78b0ca 100644 --- a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb +++ b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb @@ -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 diff --git a/spec/helpers/submodule_helper_spec.rb b/spec/helpers/submodule_helper_spec.rb index 8662cadc7a0..ea48c69e0ae 100644 --- a/spec/helpers/submodule_helper_spec.rb +++ b/spec/helpers/submodule_helper_spec.rb @@ -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) diff --git a/spec/lib/gitlab/data_builder/pipeline_spec.rb b/spec/lib/gitlab/data_builder/pipeline_spec.rb index 98f1696badb..9ef987a0826 100644 --- a/spec/lib/gitlab/data_builder/pipeline_spec.rb +++ b/spec/lib/gitlab/data_builder/pipeline_spec.rb @@ -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 diff --git a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb index a9d15f1d522..7bc4599e20f 100644 --- a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb +++ b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb @@ -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', diff --git a/spec/services/resource_events/merge_into_notes_service_spec.rb b/spec/services/resource_events/merge_into_notes_service_spec.rb index 14c43b46c15..72467091791 100644 --- a/spec/services/resource_events/merge_into_notes_service_spec.rb +++ b/spec/services/resource_events/merge_into_notes_service_spec.rb @@ -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 diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index 6930b809048..9dc89b483b2 100644 --- a/spec/support/helpers/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb @@ -369,6 +369,6 @@ module KubernetesHelpers end def empty_deployment_rollout_status - ::Gitlab::Kubernetes::RolloutStatus.from_deployments() + ::Gitlab::Kubernetes::RolloutStatus.from_deployments end end diff --git a/spec/support/helpers/rake_helpers.rb b/spec/support/helpers/rake_helpers.rb index acd9cce6a67..7d8d7750bf3 100644 --- a/spec/support/helpers/rake_helpers.rb +++ b/spec/support/helpers/rake_helpers.rb @@ -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 diff --git a/spec/support/helpers/stub_env.rb b/spec/support/helpers/stub_env.rb index 36b90fc68d6..1c2f474a015 100644 --- a/spec/support/helpers/stub_env.rb +++ b/spec/support/helpers/stub_env.rb @@ -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 |