diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 56f040259..7fe5ee343 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -668,11 +668,6 @@ Style/RedundantBegin: - 'app/controllers/graphql_controller.rb' - 'app/models/legislation/annotation.rb' -# Offense count: 55 -# Cop supports --auto-correct. -Style/RedundantParentheses: - Enabled: false - # Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index 63ec8cf52..70541a3a0 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -1,7 +1,7 @@ class Admin::SettingsController < Admin::BaseController def index - all_settings = (Setting.all).group_by { |s| s.type } + all_settings = Setting.all.group_by { |s| s.type } @settings = all_settings['common'] @feature_flags = all_settings['feature'] @banner_styles = all_settings['banner-style'] diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb index 352fce266..ebbe05b12 100644 --- a/app/controllers/legislation/annotations_controller.rb +++ b/app/controllers/legislation/annotations_controller.rb @@ -30,7 +30,7 @@ class Legislation::AnnotationsController < ApplicationController def create if !@process.allegations_phase.open? || @draft_version.final_version? - render(json: {}, status: :not_found) && (return) + render(json: {}, status: :not_found) && return end existing_annotation = @draft_version.annotations.where( diff --git a/app/helpers/proposals_helper.rb b/app/helpers/proposals_helper.rb index d40f7950c..64936302e 100644 --- a/app/helpers/proposals_helper.rb +++ b/app/helpers/proposals_helper.rb @@ -12,8 +12,8 @@ module ProposalsHelper percentage = (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success) case percentage when 0 then "0%" - when 0..(0.1) then "0.1%" - when (0.1)..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1) + when 0..0.1 then "0.1%" + when 0.1..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1) else "100%" end end diff --git a/app/models/concerns/graphqlable.rb b/app/models/concerns/graphqlable.rb index 228810579..c8b47cece 100644 --- a/app/models/concerns/graphqlable.rb +++ b/app/models/concerns/graphqlable.rb @@ -24,7 +24,7 @@ module Graphqlable end def graphql_type_description - (model_name.human).to_s + model_name.human.to_s end end diff --git a/spec/features/admin/organizations_spec.rb b/spec/features/admin/organizations_spec.rb index 814aa9df2..58375f569 100644 --- a/spec/features/admin/organizations_spec.rb +++ b/spec/features/admin/organizations_spec.rb @@ -95,7 +95,7 @@ feature 'Admin::Organizations' do click_on 'Verify' end expect(current_path).to eq(admin_organizations_path) - expect(page).to have_content ('Verified') + expect(page).to have_content 'Verified' expect(organization.reload.verified?).to eq(true) end @@ -108,18 +108,18 @@ feature 'Admin::Organizations' do click_on "Verified" within("#organization_#{organization.id}") do - expect(page).to have_content ('Verified') + expect(page).to have_content 'Verified' expect(page).to_not have_link('Verify') expect(page).to have_link('Reject') click_on 'Reject' end expect(current_path).to eq(admin_organizations_path) - expect(page).to_not have_content (organization.name) + expect(page).to_not have_content organization.name click_on 'Rejected' - expect(page).to have_content ('Rejected') - expect(page).to have_content (organization.name) + expect(page).to have_content 'Rejected' + expect(page).to have_content organization.name expect(organization.reload.rejected?).to eq(true) end @@ -137,10 +137,10 @@ feature 'Admin::Organizations' do click_on 'Verify' end expect(current_path).to eq(admin_organizations_path) - expect(page).to_not have_content (organization.name) + expect(page).to_not have_content organization.name click_on('Verified') - expect(page).to have_content (organization.name) + expect(page).to have_content organization.name expect(organization.reload.verified?).to eq(true) end diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 820ebb520..afc564496 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -264,7 +264,7 @@ feature 'Budget Investments' do fill_in "budget_investment_title", with: "search" within("div#js-suggest") do - expect(page).to have_content ("You are seeing 5 of 6 investments containing the term 'search'") + expect(page).to have_content "You are seeing 5 of 6 investments containing the term 'search'" end end @@ -279,7 +279,7 @@ feature 'Budget Investments' do fill_in "budget_investment_title", with: "item" within('div#js-suggest') do - expect(page).to_not have_content ('You are seeing') + expect(page).to_not have_content 'You are seeing' end end @@ -294,7 +294,7 @@ feature 'Budget Investments' do fill_in "budget_investment_title", with: "search" within('div#js-suggest') do - expect(page).to_not have_content ('You are seeing') + expect(page).to_not have_content 'You are seeing' end end end diff --git a/spec/features/campaigns_spec.rb b/spec/features/campaigns_spec.rb index 6dba2ff09..6e9897a6f 100644 --- a/spec/features/campaigns_spec.rb +++ b/spec/features/campaigns_spec.rb @@ -27,7 +27,7 @@ feature 'Email campaigns' do visit admin_stats_path expect(page).to have_content "#{@campaign1.name} (1)" - expect(page).to_not have_content (@campaign2.name).to_s + expect(page).to_not have_content @campaign2.name.to_s end end \ No newline at end of file diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 749c7a373..a50363489 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -879,7 +879,7 @@ feature 'Debates' do check "debate_terms_of_service" within('div#js-suggest') do - expect(page).to have_content ("You are seeing 5 of 6 debates containing the term 'debate'") + expect(page).to have_content "You are seeing 5 of 6 debates containing the term 'debate'" end end @@ -895,7 +895,7 @@ feature 'Debates' do check "debate_terms_of_service" within('div#js-suggest') do - expect(page).to_not have_content ('You are seeing') + expect(page).to_not have_content 'You are seeing' end end end diff --git a/spec/features/management/managed_users_spec.rb b/spec/features/management/managed_users_spec.rb index ef3c539d9..68b9777a3 100644 --- a/spec/features/management/managed_users_spec.rb +++ b/spec/features/management/managed_users_spec.rb @@ -24,9 +24,9 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s - expect(page).to have_content (user.email).to_s - expect(page).to have_content (user.document_number).to_s + expect(page).to have_content user.username.to_s + expect(page).to have_content user.email.to_s + expect(page).to have_content user.document_number.to_s end end @@ -45,9 +45,9 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s - expect(page).to have_content (user.email).to_s - expect(page).to have_content (user.document_number).to_s + expect(page).to have_content user.username.to_s + expect(page).to have_content user.email.to_s + expect(page).to have_content user.document_number.to_s end end @@ -78,9 +78,9 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s - expect(page).to have_content (user.email).to_s - expect(page).to have_content (user.document_number).to_s + expect(page).to have_content user.username.to_s + expect(page).to have_content user.email.to_s + expect(page).to have_content user.document_number.to_s end end @@ -106,9 +106,9 @@ feature 'Managed User' do user = User.last within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s - expect(page).to have_content (user.email).to_s - expect(page).to have_content (user.document_number).to_s + expect(page).to have_content user.username.to_s + expect(page).to have_content user.email.to_s + expect(page).to have_content user.document_number.to_s end end @@ -134,8 +134,8 @@ feature 'Managed User' do user = User.last within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s - expect(page).to have_content (user.document_number).to_s + expect(page).to have_content user.username.to_s + expect(page).to have_content user.document_number.to_s end end end @@ -151,14 +151,14 @@ feature 'Managed User' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s + expect(page).to have_content user.username.to_s click_link "Change user" end expect(page).to have_content "User session signed out successfully." expect(page).to_not have_content "Identified as" - expect(page).to_not have_content (user.username).to_s + expect(page).to_not have_content user.username.to_s expect(current_path).to eq(management_root_path) end diff --git a/spec/features/management/proposals_spec.rb b/spec/features/management/proposals_spec.rb index 349a4f904..ed24de172 100644 --- a/spec/features/management/proposals_spec.rb +++ b/spec/features/management/proposals_spec.rb @@ -16,9 +16,9 @@ feature 'Proposals' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s - expect(page).to have_content (user.email).to_s - expect(page).to have_content (user.document_number).to_s + expect(page).to have_content user.username.to_s + expect(page).to have_content user.email.to_s + expect(page).to have_content user.document_number.to_s end fill_in 'proposal_title', with: 'Help refugees' @@ -119,9 +119,9 @@ feature 'Proposals' do within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content (user.username).to_s - expect(page).to have_content (user.email).to_s - expect(page).to have_content (user.document_number).to_s + expect(page).to have_content user.username.to_s + expect(page).to have_content user.email.to_s + expect(page).to have_content user.document_number.to_s end within(".proposals-list") do diff --git a/spec/features/management/users_spec.rb b/spec/features/management/users_spec.rb index f50728bfc..8060f33cb 100644 --- a/spec/features/management/users_spec.rb +++ b/spec/features/management/users_spec.rb @@ -29,7 +29,7 @@ feature 'Users' do expect(user).to be_level_three_verified expect(user).to be_residence_verified expect(user).to_not be_confirmed - expect(user.date_of_birth).to have_content (Date.new(1980, 12, 31)) + expect(user.date_of_birth).to have_content Date.new(1980, 12, 31) sent_token = /.*confirmation_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1] visit user_confirmation_path(confirmation_token: sent_token) @@ -69,7 +69,7 @@ feature 'Users' do expect(user).to be_level_three_verified expect(user).to be_residence_verified expect(user).to be_confirmed - expect(user.date_of_birth).to have_content (Date.new(1980, 12, 31)) + expect(user.date_of_birth).to have_content Date.new(1980, 12, 31) end scenario 'Delete a level 2 user account from document verification page', :js do diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index d297a294b..1fa57890e 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -1390,7 +1390,7 @@ feature 'Proposals' do check "proposal_terms_of_service" within('div#js-suggest') do - expect(page).to have_content ("You are seeing 5 of 6 proposals containing the term 'search'") + expect(page).to have_content "You are seeing 5 of 6 proposals containing the term 'search'" end end @@ -1406,7 +1406,7 @@ feature 'Proposals' do check "proposal_terms_of_service" within('div#js-suggest') do - expect(page).to_not have_content ('You are seeing') + expect(page).to_not have_content 'You are seeing' end end end diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index c363f3bdc..35ebd85d8 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -103,7 +103,7 @@ describe Budget::Investment do let(:investment) { create(:budget_investment) } it "returns the proposal id" do - expect(investment.code).to include((investment.id).to_s) + expect(investment.code).to include(investment.id.to_s) end it "returns the administrator id when assigned" do diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index 8d24f9945..5ab801cd0 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -687,12 +687,12 @@ describe Debate do describe "#last_week" do it "should return debates created this week" do debate = create(:debate) - expect(Debate.last_week.all).to include (debate) + expect(Debate.last_week.all).to include debate end it "should not show debates created more than a week ago" do debate = create(:debate, created_at: 8.days.ago) - expect(Debate.last_week.all).to_not include (debate) + expect(Debate.last_week.all).to_not include debate end end diff --git a/spec/models/residence_spec.rb b/spec/models/residence_spec.rb index 9ba93b2c7..2dd6760a0 100644 --- a/spec/models/residence_spec.rb +++ b/spec/models/residence_spec.rb @@ -27,7 +27,7 @@ describe Verification::Residence do it "should validate user has allowed age" do residence = Verification::Residence.new("date_of_birth(3i)" => "1", "date_of_birth(2i)" => "1", - "date_of_birth(1i)" => (5.years.ago.year).to_s) + "date_of_birth(1i)" => 5.years.ago.year.to_s) expect(residence).to_not be_valid expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate") end