diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index ab236de9d..dd02bef99 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -52,6 +52,9 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: true +Layout/ExtraSpacing: + Enabled: true + Layout/SpaceAroundEqualsInParameterDefault: Enabled: true diff --git a/app/models/ahoy/data_source.rb b/app/models/ahoy/data_source.rb index 05fbca93b..e1430c5e8 100644 --- a/app/models/ahoy/data_source.rb +++ b/app/models/ahoy/data_source.rb @@ -8,7 +8,7 @@ module Ahoy # Name is the name of the collection and will be showed in the # chart def add(name, collection) - collections.push data: collection, name: name + collections.push data: collection, name: name collection.each_key { |key| add_key key } end diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 6409d6cbc..2e53e2e7f 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -154,7 +154,7 @@ class Budget results = results.search_by_title_or_id(params[:title_or_id].strip) if params[:title_or_id] results = advanced_filters(params, results) if params[:advanced_filters].present? - results = results.send(current_filter) if current_filter.present? + results = results.send(current_filter) if current_filter.present? results.includes(:heading, :group, :budget, administrator: :user, valuators: :user) end diff --git a/app/models/budget/investment/change_log.rb b/app/models/budget/investment/change_log.rb index 34dbd500e..fa57a00dc 100644 --- a/app/models/budget/investment/change_log.rb +++ b/app/models/budget/investment/change_log.rb @@ -5,5 +5,5 @@ class Budget::Investment::ChangeLog < ApplicationRecord validates :new_value, presence: true validates :field, presence: true - scope :by_investment, ->(investment_id) { where(investment_id: investment_id) } + scope :by_investment, ->(investment_id) { where(investment_id: investment_id) } end diff --git a/app/models/local_census_record.rb b/app/models/local_census_record.rb index bac884ecb..a14a8fb92 100644 --- a/app/models/local_census_record.rb +++ b/app/models/local_census_record.rb @@ -7,7 +7,7 @@ class LocalCensusRecord < ApplicationRecord validates :postal_code, presence: true validates :document_number, uniqueness: { scope: :document_type } - scope :search, -> (terms) { where("document_number ILIKE ?", "%#{terms}%") } + scope :search, -> (terms) { where("document_number ILIKE ?", "%#{terms}%") } private diff --git a/app/models/poll.rb b/app/models/poll.rb index 0a06ada44..2fb7ed115 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -46,7 +46,7 @@ class Poll < ApplicationRecord scope :published, -> { where("published = ?", true) } scope :by_geozone_id, ->(geozone_id) { where(geozones: { id: geozone_id }.joins(:geozones)) } scope :public_for_api, -> { all } - scope :not_budget, -> { where(budget_id: nil) } + scope :not_budget, -> { where(budget_id: nil) } scope :created_by_admin, -> { where(related_type: nil) } def self.sort_for_list diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb index 9612e7930..a59e0145b 100644 --- a/app/models/proposal_notification.rb +++ b/app/models/proposal_notification.rb @@ -10,9 +10,9 @@ class ProposalNotification < ApplicationRecord validates :proposal, presence: true validate :minimum_interval - scope :public_for_api, -> { where(proposal_id: Proposal.public_for_api.pluck(:id)) } - scope :sort_by_created_at, -> { reorder(created_at: :desc) } - scope :sort_by_moderated, -> { reorder(moderated: :desc) } + scope :public_for_api, -> { where(proposal_id: Proposal.public_for_api.pluck(:id)) } + scope :sort_by_created_at, -> { reorder(created_at: :desc) } + scope :sort_by_moderated, -> { reorder(moderated: :desc) } scope :moderated, -> { where(moderated: true) } scope :not_moderated, -> { where(moderated: false) } diff --git a/app/models/site_customization/page.rb b/app/models/site_customization/page.rb index 11ced8f07..bb923b107 100644 --- a/app/models/site_customization/page.rb +++ b/app/models/site_customization/page.rb @@ -18,7 +18,7 @@ class SiteCustomization::Page < ApplicationRecord scope :sort_desc, -> { order("id DESC") } scope :with_more_info_flag, -> { where(status: "published", more_info_flag: true).sort_asc } scope :with_same_locale, -> { joins(:translations).locale } - scope :locale, -> { where("site_customization_page_translations.locale": I18n.locale) } + scope :locale, -> { where("site_customization_page_translations.locale": I18n.locale) } def url "/#{slug}" diff --git a/app/models/votation_set_answer.rb b/app/models/votation_set_answer.rb index bcce7df69..f115b82b7 100644 --- a/app/models/votation_set_answer.rb +++ b/app/models/votation_set_answer.rb @@ -1,6 +1,6 @@ class VotationSetAnswer < ApplicationRecord belongs_to :votation_type - belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" + belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" scope :by_author, -> (author) { where(author: author) } end diff --git a/spec/factories/budgets.rb b/spec/factories/budgets.rb index 177a55b43..751bdc4dc 100644 --- a/spec/factories/budgets.rb +++ b/spec/factories/budgets.rb @@ -98,7 +98,7 @@ FactoryBot.define do unfeasibility_explanation { "" } skip_map { "1" } terms_of_service { "1" } - incompatible { false } + incompatible { false } trait :with_confidence_score do before(:save) { |i| i.calculate_confidence_score } diff --git a/spec/features/admin/download_settings_spec.rb b/spec/features/admin/download_settings_spec.rb index a676b513a..4a67e25ce 100644 --- a/spec/features/admin/download_settings_spec.rb +++ b/spec/features/admin/download_settings_spec.rb @@ -247,7 +247,7 @@ describe "Admin download settings" do end context "Download budgets" do - let(:budget_finished) { create(:budget, :finished) } + let(:budget_finished) { create(:budget, :finished) } let(:heading) { create(:budget_heading, budget: budget_finished, price: 1000) } let(:investment1) do diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb index e8cc5009c..f8354696f 100644 --- a/spec/features/admin/poll/polls_spec.rb +++ b/spec/features/admin/poll/polls_spec.rb @@ -145,7 +145,7 @@ describe "Admin polls" do expect(Poll::Question::Answer.count). to eq(0) end - scenario "Can't destroy poll with votes", :js do + scenario "Can't destroy poll with votes", :js do poll = create(:poll) create(:poll_question, poll: poll) create(:poll_voter, :from_booth, :valid_document, poll: poll) diff --git a/spec/features/budgets/groups_spec.rb b/spec/features/budgets/groups_spec.rb index c3e8eaec6..c8f68b0d8 100644 --- a/spec/features/budgets/groups_spec.rb +++ b/spec/features/budgets/groups_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" describe "Budget Groups" do let(:budget) { create(:budget, slug: "budget_slug") } - let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) } + let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) } context "Load" do scenario "finds group using budget slug and group slug" do diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 4f9217432..901e37383 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -1899,7 +1899,7 @@ describe "Budget Investments" do end scenario "Display only investment's related to the current heading", :js do - heading_2 = create(:budget_heading, name: "Madrid", group: group) + heading_2 = create(:budget_heading, name: "Madrid", group: group) investment1 = create(:budget_investment, heading: heading) investment2 = create(:budget_investment, heading: heading) @@ -1923,7 +1923,7 @@ describe "Budget Investments" do end scenario "Do not display investment's, since they're all related to other heading", :js do - heading_2 = create(:budget_heading, name: "Madrid", group: group) + heading_2 = create(:budget_heading, name: "Madrid", group: group) investment1 = create(:budget_investment, heading: heading_2) investment2 = create(:budget_investment, heading: heading_2) diff --git a/spec/features/dashboard/polls_spec.rb b/spec/features/dashboard/polls_spec.rb index fbdc7ed2f..024624d17 100644 --- a/spec/features/dashboard/polls_spec.rb +++ b/spec/features/dashboard/polls_spec.rb @@ -164,7 +164,7 @@ describe "Polls" do expect(page).not_to have_content(poll.name) end - scenario "Can't destroy poll with responses", :js do + scenario "Can't destroy poll with responses", :js do poll = create(:poll, related: proposal) create(:poll_question, poll: poll) create(:poll_voter, poll: poll) diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb index d42fc3181..afe7af76b 100644 --- a/spec/i18n_spec.rb +++ b/spec/i18n_spec.rb @@ -60,7 +60,7 @@ describe "I18n" do end it "returns a String to avoid exception 'undefined method for Fixnum'" do - keys = { zero: "No comments" } + keys = { zero: "No comments" } I18n.backend.store_translations(:en, { test_plural: keys }) result = I18n.t("test_plural", count: 1) @@ -69,7 +69,7 @@ describe "I18n" do end it "returns the number not pluralized for missing translations" do - keys = { zero: "No comments" } + keys = { zero: "No comments" } I18n.backend.store_translations(:en, { test_plural: keys }) expect(I18n.t("test_plural", count: 1).pluralize).to eq "1" diff --git a/spec/models/abilities/administrator_spec.rb b/spec/models/abilities/administrator_spec.rb index 295ed838c..83aba1814 100644 --- a/spec/models/abilities/administrator_spec.rb +++ b/spec/models/abilities/administrator_spec.rb @@ -74,7 +74,7 @@ describe Abilities::Administrator do it { should be_able_to(:create, Budget::ValuatorAssignment) } it { should be_able_to(:admin_update, Budget::Investment) } - it { should be_able_to(:hide, Budget::Investment) } + it { should be_able_to(:hide, Budget::Investment) } it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, :valuating))) } it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, :finished))) } diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb index 4a109391c..b9b5693d6 100644 --- a/spec/models/abilities/common_spec.rb +++ b/spec/models/abilities/common_spec.rb @@ -32,7 +32,7 @@ describe Abilities::Common do let(:ballot_in_selecting_budget) { create(:budget_ballot, budget: selecting_budget) } let(:ballot_in_balloting_budget) { create(:budget_ballot, budget: balloting_budget) } - let(:current_poll) { create(:poll) } + let(:current_poll) { create(:poll) } let(:expired_poll) { create(:poll, :expired) } let(:expired_poll_from_own_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [geozone]) } let(:expired_poll_from_other_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [create(:geozone)]) } diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index 1b6d19a56..4f87927d0 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -1206,7 +1206,7 @@ describe Budget::Investment do end describe "scoped_filter" do - let(:budget) { create(:budget, :balloting) } + let(:budget) { create(:budget, :balloting) } let(:investment) { create(:budget_investment, budget: budget) } describe "with without_admin filter" do diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index beaae319b..e75660a53 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -858,7 +858,7 @@ describe Proposal do describe "selected" do let!(:not_selected_proposal) { create(:proposal) } - let!(:selected_proposal) { create(:proposal, :selected) } + let!(:selected_proposal) { create(:proposal, :selected) } it "selected? is true" do expect(not_selected_proposal.selected?).to be false @@ -916,7 +916,7 @@ describe Proposal do end describe "#recommendations" do - let(:user) { create(:user) } + let(:user) { create(:user) } it "does not return any proposals when user has not interests" do create(:proposal) diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb index 9b27275f6..d714e5b4e 100644 --- a/spec/shared/features/nested_documentable.rb +++ b/spec/shared/features/nested_documentable.rb @@ -11,7 +11,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na else let!(:documentable) { create(documentable_factory_name, author: user) } end - let!(:user_to_login) { send(login_as_name) } + let!(:user_to_login) { send(login_as_name) } before do create(:administrator, user: administrator) diff --git a/spec/shared/models/sanitizable.rb b/spec/shared/models/sanitizable.rb index 2e4faa05b..356a625be 100644 --- a/spec/shared/models/sanitizable.rb +++ b/spec/shared/models/sanitizable.rb @@ -1,5 +1,5 @@ shared_examples "sanitizable" do - let(:sanitizable) { build(model_name(described_class)) } + let(:sanitizable) { build(model_name(described_class)) } describe "#tag_list" do before do