diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 8529369be..d264ee91c 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -26,6 +26,9 @@ Layout/IndentationConsistency: Layout/IndentationWidth: Enabled: true +Layout/EmptyLines: + Enabled: true + Layout/EndOfLine: EnforcedStyle: lf diff --git a/app/controllers/admin/poll/active_polls_controller.rb b/app/controllers/admin/poll/active_polls_controller.rb index 97665ac2f..17690a803 100644 --- a/app/controllers/admin/poll/active_polls_controller.rb +++ b/app/controllers/admin/poll/active_polls_controller.rb @@ -22,7 +22,6 @@ class Admin::Poll::ActivePollsController < Admin::Poll::BaseController end end - private def load_active_poll diff --git a/app/controllers/dashboard/supports_controller.rb b/app/controllers/dashboard/supports_controller.rb index 3605c6132..177cc24fb 100644 --- a/app/controllers/dashboard/supports_controller.rb +++ b/app/controllers/dashboard/supports_controller.rb @@ -15,7 +15,6 @@ class Dashboard::SupportsController < Dashboard::BaseController accumulate_supports(grouped_votes) end - def supports @supports ||= Vote .where(votable: proposal, diff --git a/app/controllers/legislation/processes_controller.rb b/app/controllers/legislation/processes_controller.rb index 85374f27a..c450963e4 100644 --- a/app/controllers/legislation/processes_controller.rb +++ b/app/controllers/legislation/processes_controller.rb @@ -10,7 +10,6 @@ class Legislation::ProcessesController < Legislation::BaseController before_action :set_random_seed, only: :proposals before_action :check_past, only: :resume - def index @current_filter ||= "open" @processes = ::Legislation::Process.send(@current_filter).published diff --git a/app/models/poll/pair_answer.rb b/app/models/poll/pair_answer.rb index 2b314565c..215d638d7 100644 --- a/app/models/poll/pair_answer.rb +++ b/app/models/poll/pair_answer.rb @@ -18,7 +18,6 @@ class Poll::PairAnswer < ApplicationRecord validates :answer_right, inclusion: { in: ->(a) { a.question.question_answers.visibles }}, unless: ->(a) { a.question.blank? } - scope :by_author, ->(author_id) { where(author_id: author_id) } scope :by_question, ->(question_id) { where(question_id: question_id) } diff --git a/app/models/user.rb b/app/models/user.rb index 2f787f34d..b5ffacd5f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -358,7 +358,6 @@ class User < ApplicationRecord followables.compact.map { |followable| followable.tags.map(&:name) }.flatten.compact.uniq end - def self.current_user Thread.current[:user] end diff --git a/app/models/votation_type.rb b/app/models/votation_type.rb index c84418401..95fd384e2 100644 --- a/app/models/votation_type.rb +++ b/app/models/votation_type.rb @@ -110,7 +110,6 @@ class VotationType < ApplicationRecord end end - result end diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index 871e2de0d..b1f16af33 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -49,7 +49,6 @@ <% end %> - <% if @account.email.present? %>

<%= t("account.show.notifications")%>

diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index 59044bb55..cdc7e7651 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -1,6 +1,5 @@ <%= t("admin.budget_investments.index.download_current_selection") %> - <% if params[:advanced_filters].include?("winners") %> <% if display_calculate_winners_button?(@budget) %> <%= link_to calculate_winner_button_text(@budget), diff --git a/app/views/admin/budget_investments/edit.html.erb b/app/views/admin/budget_investments/edit.html.erb index ef6540c9e..736a17db4 100644 --- a/app/views/admin/budget_investments/edit.html.erb +++ b/app/views/admin/budget_investments/edit.html.erb @@ -127,7 +127,6 @@ label: t("admin.budget_investments.edit.milestone_tags") %> -
<%= f.submit(class: "button", value: t("admin.budget_investments.edit.submit_button")) %>
diff --git a/app/views/admin/hidden_comments/index.html.erb b/app/views/admin/hidden_comments/index.html.erb index 8500dce58..ca26aef31 100644 --- a/app/views/admin/hidden_comments/index.html.erb +++ b/app/views/admin/hidden_comments/index.html.erb @@ -1,7 +1,6 @@

<%= t("admin.hidden_comments.index.title") %>

<%= t("admin.shared.moderated_content") %>

- <%= render "shared/filter_subnav", i18n_namespace: "admin.hidden_comments.index" %> <% if @comments.any? %> diff --git a/app/views/admin/hidden_debates/index.html.erb b/app/views/admin/hidden_debates/index.html.erb index 92bb70c8c..25cfd7102 100644 --- a/app/views/admin/hidden_debates/index.html.erb +++ b/app/views/admin/hidden_debates/index.html.erb @@ -1,7 +1,6 @@

<%= t("admin.hidden_debates.index.title") %>

<%= t("admin.shared.moderated_content") %>

- <%= render "shared/filter_subnav", i18n_namespace: "admin.hidden_debates.index" %> <% if @debates.any? %> diff --git a/app/views/admin/signature_sheets/show.html.erb b/app/views/admin/signature_sheets/show.html.erb index 622842099..91fdc270a 100644 --- a/app/views/admin/signature_sheets/show.html.erb +++ b/app/views/admin/signature_sheets/show.html.erb @@ -18,7 +18,6 @@ <%= simple_format @signature_sheet.required_fields_to_verify %> -
<%= t("admin.signature_sheets.show.verified", diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index e5c68c36e..612f5d81d 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -11,7 +11,6 @@ <% end %>
-
<%= render "users" %>
diff --git a/app/views/officing/results/index.html.erb b/app/views/officing/results/index.html.erb index 67b6ece0f..1f689e07a 100644 --- a/app/views/officing/results/index.html.erb +++ b/app/views/officing/results/index.html.erb @@ -8,7 +8,6 @@ -
diff --git a/app/views/stats/index.html.erb b/app/views/stats/index.html.erb index 4065c3c40..e34341ba8 100644 --- a/app/views/stats/index.html.erb +++ b/app/views/stats/index.html.erb @@ -58,7 +58,6 @@

- diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 77879b4e6..75c4b406b 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -37,7 +37,6 @@ <% end %> -
<%= render "topics/filter_subnav" %>
diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index 021db1647..f5c8cbecb 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -28,7 +28,6 @@ <%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label") %> - <%= f.password_field :password, autocomplete: "off", placeholder: t("devise_views.users.registrations.new.password_label") %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index e7e0fc70b..edc93514d 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -18,7 +18,6 @@
<%= render "feeds" %> -
<% if @cards.any? %>
"> diff --git a/config/deploy.rb b/config/deploy.rb index 9501436a2..c56d88f3e 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -52,7 +52,6 @@ namespace :deploy do after :finishing, "deploy:cleanup" - desc "Deploys and runs the tasks needed to upgrade to a new release" task :upgrade do after "add_new_settings", "execute_release_tasks" diff --git a/config/environments/production.rb b/config/environments/production.rb index 49ffa3202..2972eb78f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -48,7 +48,6 @@ Rails.application.configure do # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true diff --git a/lib/email_digest.rb b/lib/email_digest.rb index 502c68f41..55bb62600 100644 --- a/lib/email_digest.rb +++ b/lib/email_digest.rb @@ -14,7 +14,6 @@ class EmailDigest notifications.any? end - def deliver(run_at) if valid_email? && pending_notifications? Mailer.delay(run_at: run_at).proposal_notification_digest(user, notifications.to_a) diff --git a/spec/controllers/legislation/annotations_controller_spec.rb b/spec/controllers/legislation/annotations_controller_spec.rb index 3fdf31a27..148c4451c 100644 --- a/spec/controllers/legislation/annotations_controller_spec.rb +++ b/spec/controllers/legislation/annotations_controller_spec.rb @@ -16,7 +16,6 @@ describe Legislation::AnnotationsController do title: "Final version") } let(:user) { create(:user, :level_two) } - it "creates an ahoy event" do sign_in user diff --git a/spec/features/admin/admin_notifications_spec.rb b/spec/features/admin/admin_notifications_spec.rb index a9df505dc..424e422cf 100644 --- a/spec/features/admin/admin_notifications_spec.rb +++ b/spec/features/admin/admin_notifications_spec.rb @@ -98,7 +98,6 @@ describe "Admin Notifications" do click_link "Edit" end - fill_in_admin_notification_form(segment_recipient: "All users", title: "Other title", body: "Other body", diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 3ba82fdaa..a0fb805f6 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -687,7 +687,6 @@ describe "Admin budget investments" do administrator: administrator) create(:budget_investment, budget: budget, title: "More hospitals") - visit admin_budget_budget_investments_path(budget_id: budget.id) expect(page).to have_css(".budget_investment", count: 3) @@ -767,7 +766,6 @@ describe "Admin budget investments" do administrator: administrator) create(:budget_investment, budget: budget, title: "More hostals") - visit admin_budget_budget_investments_path(budget_id: budget.id) expect(page).to have_css(".budget_investment", count: 4) @@ -1884,7 +1882,6 @@ describe "Admin budget investments" do expect(cookie_value).to eq("id,supports,admin,geozone," + "feasibility,valuation_finished,visible_to_valuators,selected,incompatible,author") - visit admin_budget_budget_investments_path(budget) cookies = page.driver.browser.manage.all_cookies diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index b13d46a8a..80f36b0b1 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -286,7 +286,6 @@ describe "Admin budgets" do expect(page).not_to have_content unselected.title expect(page).not_to have_content selected.title - visit edit_admin_budget_path(budget) expect(page).to have_content "See results" end diff --git a/spec/features/budget_polls/budgets_spec.rb b/spec/features/budget_polls/budgets_spec.rb index 5a8062c8a..6362e008a 100644 --- a/spec/features/budget_polls/budgets_spec.rb +++ b/spec/features/budget_polls/budgets_spec.rb @@ -32,7 +32,6 @@ describe "Admin Budgets" do name_en: "Budget for climate change", name_fr: "Budget pour le changement climatique") - visit admin_budgets_path select("Français", from: "locale-switcher") diff --git a/spec/features/legislation/resume_spec.rb b/spec/features/legislation/resume_spec.rb index c61112336..09f703be8 100644 --- a/spec/features/legislation/resume_spec.rb +++ b/spec/features/legislation/resume_spec.rb @@ -75,8 +75,6 @@ describe "Legislation" do @debate = create(:legislation_question, process: @process, title: "Question 2") create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 3") create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 4") - - end scenario "show debates list" do diff --git a/spec/features/polls/votation_type_spec.rb b/spec/features/polls/votation_type_spec.rb index 0425d80be..1a42d7b40 100644 --- a/spec/features/polls/votation_type_spec.rb +++ b/spec/features/polls/votation_type_spec.rb @@ -367,5 +367,4 @@ describe "Poll Votation Type" do end end - end diff --git a/spec/features/valuation/budget_investments_spec.rb b/spec/features/valuation/budget_investments_spec.rb index acd16e517..ea95e184a 100644 --- a/spec/features/valuation/budget_investments_spec.rb +++ b/spec/features/valuation/budget_investments_spec.rb @@ -547,7 +547,6 @@ describe "Valuation budget investments" do investment = create(:budget_investment, budget: budget) investment.valuators << [valuator] - login_as(admin.user) visit valuation_budget_budget_investment_path(budget, investment) click_link "Edit dossier" diff --git a/spec/features/welcome_spec.rb b/spec/features/welcome_spec.rb index 1bc309539..a1835e5ba 100644 --- a/spec/features/welcome_spec.rb +++ b/spec/features/welcome_spec.rb @@ -121,5 +121,4 @@ describe "Welcome screen" do Setting["feature.user.skip_verification"] = nil end - end diff --git a/spec/helpers/signature_sheets_helper_spec.rb b/spec/helpers/signature_sheets_helper_spec.rb index 5e53e7ec4..1ed697c68 100644 --- a/spec/helpers/signature_sheets_helper_spec.rb +++ b/spec/helpers/signature_sheets_helper_spec.rb @@ -77,6 +77,4 @@ describe SignatureSheetsHelper do end - - end diff --git a/spec/models/budget/heading_spec.rb b/spec/models/budget/heading_spec.rb index b32f6aeb1..966a52269 100644 --- a/spec/models/budget/heading_spec.rb +++ b/spec/models/budget/heading_spec.rb @@ -168,7 +168,6 @@ describe Budget::Heading do end end - describe "save longitude" do it "Doesn't allow longitude < -180" do @@ -267,7 +266,6 @@ describe Budget::Heading do end end - describe "heading" do it "can be deleted if no budget's investments associated" do heading1 = create(:budget_heading, group: group, name: "name") diff --git a/spec/models/dashboard/action_spec.rb b/spec/models/dashboard/action_spec.rb index 591ca33db..d5a1b26df 100644 --- a/spec/models/dashboard/action_spec.rb +++ b/spec/models/dashboard/action_spec.rb @@ -279,7 +279,6 @@ describe Dashboard::Action do let!(:resource) { create(:dashboard_action, :resource, :active, day_offset: 0, published_proposal: true) } - it "when proposal has been created today and day_offset is valid only for today" do expect(described_class.detect_new_actions_since(Date.yesterday, proposal)).to include(resource.id) diff --git a/spec/models/legislation/process/phase_spec.rb b/spec/models/legislation/process/phase_spec.rb index ed57d34ca..902e49bd0 100644 --- a/spec/models/legislation/process/phase_spec.rb +++ b/spec/models/legislation/process/phase_spec.rb @@ -20,7 +20,6 @@ RSpec.describe Legislation::Process::Phase, type: :model do expect(process.draft_phase.enabled?).to be false end - it "checks allegations phase" do expect(process.allegations_phase.enabled?).to be true diff --git a/spec/models/poll/pair_answer_spec.rb b/spec/models/poll/pair_answer_spec.rb index 8f7d5efde..17679b2d4 100644 --- a/spec/models/poll/pair_answer_spec.rb +++ b/spec/models/poll/pair_answer_spec.rb @@ -72,7 +72,6 @@ describe Poll::PairAnswer do end - describe "#generate_pair" do let(:user) { create(:user) } let(:question) { create(:poll_question) }