From 5c5d798590d8ca25f5fa4f6306d7f521c641905f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 5 Jul 2019 02:59:28 +0200 Subject: [PATCH 01/13] Don't use `Include` in rubocop configuration file The Rakefile and config.ru files are now included by default, and the behaviour of `Include` changed in Rubocop 0.56.0 (see rubocop's pull request 5882) so now it **only** includes the files defined there, while in the past it included those files in addition to the default files. --- .rubocop_basic.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index bfeedbc27..44beb5256 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -3,9 +3,6 @@ require: rubocop-rspec AllCops: DisplayCopNames: true DisplayStyleGuide: true - Include: - - "**/Rakefile" - - "**/config.ru" Exclude: - "db/migrate/**/*" - "db/schema.rb" From cf9e36c767e0c945062a5b4a3292f0979ed151cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 18 Jun 2019 01:56:20 +0200 Subject: [PATCH 02/13] Replace single quotes with double quotes Most of these quotes were in the dashboard branch before we added the rule for double quotes. --- .../admin/dashboard/actions/_form.html.erb | 6 +++--- .../admin/dashboard/actions/edit.html.erb | 4 ++-- .../admin/dashboard/actions/index.html.erb | 6 +++--- app/views/admin/dashboard/actions/new.html.erb | 4 ++-- .../administrator_tasks/_form.html.erb | 2 +- .../administrator_tasks/edit.html.erb | 2 +- app/views/admin/debates/show.html.erb | 14 +++++++------- .../admin/download_settings/_modal.html.erb | 6 +++--- .../admin/download_settings/edit.html.erb | 2 +- .../admin/proposals/toggle_selection.js.erb | 2 +- .../site_customization/documents/new.html.erb | 2 +- app/views/admin/stats/graph.html.erb | 4 ++-- app/views/communities/_subnav.html.erb | 4 ++-- app/views/dashboard/_goal.html.erb | 2 +- app/views/dashboard/_mailing_resource.html.erb | 2 +- app/views/dashboard/_menu.html.erb | 12 ++++++------ app/views/dashboard/_next_goal.html.erb | 4 ++-- app/views/dashboard/_poll_resource.html.erb | 2 +- app/views/dashboard/_poster_resource.html.erb | 2 +- app/views/dashboard/_proposed_action.html.erb | 2 +- .../_recommended_actions_by_status.html.erb | 4 ++-- app/views/dashboard/_resources.html.erb | 8 ++++---- .../_summary_recommended_actions.html.erb | 4 ++-- .../dashboard/actions/new_request.html.erb | 4 ++-- app/views/dashboard/community.html.erb | 8 ++++---- .../mailing/_mailing_options.html.erb | 2 +- app/views/dashboard/mailing/index.html.erb | 4 ++-- app/views/dashboard/mailing/new.html.erb | 4 ++-- app/views/dashboard/polls/_form.html.erb | 2 +- .../dashboard/polls/_question_fields.html.erb | 2 +- app/views/dashboard/polls/index.html.erb | 6 +++--- .../dashboard/poster/_poster_options.html.erb | 2 +- app/views/dashboard/poster/index.pdf.erb | 8 ++++---- app/views/dashboard/poster/new.html.erb | 4 ++-- app/views/dashboard/progress.html.erb | 12 ++++++------ app/views/debates/index.html.erb | 2 +- app/views/layouts/dashboard.html.erb | 10 +++++----- .../dashboard/_proposal_totals.html.erb | 10 +++++----- app/views/layouts/proposals_dashboard.html.erb | 10 +++++----- .../processes/_resume_proposal.html.erb | 2 +- app/views/legislation/processes/index.html.erb | 2 +- .../legislation/processes/resume.html.erb | 2 +- .../processes/resume_to_xlsx.xlsx.axlsx | 2 +- app/views/links/_nested_links.html.erb | 2 +- .../polls/questions/_answers_couples.html.erb | 2 +- app/views/proposals/show.html.erb | 2 +- app/views/proposals/vote.js.erb | 2 +- bin/bundle | 4 ++-- bin/delayed_job | 4 ++-- bin/rails | 6 +++--- bin/rake | 4 ++-- bin/rspec | 4 ++-- bin/setup | 18 +++++++++--------- bin/spring | 8 ++++---- bin/update | 18 +++++++++--------- config/routes/admin.rb | 4 ++-- spec/features/admin/settings_spec.rb | 4 ++-- 57 files changed, 140 insertions(+), 140 deletions(-) diff --git a/app/views/admin/dashboard/actions/_form.html.erb b/app/views/admin/dashboard/actions/_form.html.erb index b069d74b7..8a8588d77 100644 --- a/app/views/admin/dashboard/actions/_form.html.erb +++ b/app/views/admin/dashboard/actions/_form.html.erb @@ -1,4 +1,4 @@ -<%= render 'shared/errors' %> +<%= render "shared/errors" %>
@@ -70,13 +70,13 @@ <% if feature?(:allow_attached_documents) %>

- <%= render 'documents/nested_documents', documentable: dashboard_action, f: f %> + <%= render "documents/nested_documents", documentable: dashboard_action, f: f %>
<% end %> diff --git a/app/views/admin/dashboard/actions/edit.html.erb b/app/views/admin/dashboard/actions/edit.html.erb index 5a94ec443..9ab97a45d 100644 --- a/app/views/admin/dashboard/actions/edit.html.erb +++ b/app/views/admin/dashboard/actions/edit.html.erb @@ -4,7 +4,7 @@
- <%= form_for dashboard_action, url: { action: 'update' } do |f| %> - <%= render 'form', f: f %> + <%= form_for dashboard_action, url: { action: "update" } do |f| %> + <%= render "form", f: f %> <% end %>
diff --git a/app/views/admin/dashboard/actions/index.html.erb b/app/views/admin/dashboard/actions/index.html.erb index 5d3e7ca61..72dd4baa8 100644 --- a/app/views/admin/dashboard/actions/index.html.erb +++ b/app/views/admin/dashboard/actions/index.html.erb @@ -1,5 +1,5 @@ <%= link_to t("admin.dashboard.actions.index.create"), - new_admin_dashboard_action_path, class: 'button success float-right' %> + new_admin_dashboard_action_path, class: "button success float-right" %>

<%= t("admin.dashboard.actions.index.title") %> @@ -28,8 +28,8 @@ <%= t("admin.dashboard.actions.action_type.#{action.action_type}") %> <%= active_human_readable(action.active) %> <%= active_human_readable(action.published_proposal) %> - <%= number_with_delimiter(action.day_offset, delimiter: '.') %> - <%= number_with_delimiter(action.required_supports, delimiter: '.') %> + <%= number_with_delimiter(action.day_offset, delimiter: ".") %> + <%= number_with_delimiter(action.required_supports, delimiter: ".") %> <%= action.order %> <%= link_to t("admin.dashboard.actions.index.edit"), diff --git a/app/views/admin/dashboard/actions/new.html.erb b/app/views/admin/dashboard/actions/new.html.erb index 0ef2c672c..67e8e54ad 100644 --- a/app/views/admin/dashboard/actions/new.html.erb +++ b/app/views/admin/dashboard/actions/new.html.erb @@ -4,7 +4,7 @@

- <%= form_for dashboard_action, url: { action: 'create' } do |f| %> - <%= render 'form', f: f %> + <%= form_for dashboard_action, url: { action: "create" } do |f| %> + <%= render "form", f: f %> <% end %>
diff --git a/app/views/admin/dashboard/administrator_tasks/_form.html.erb b/app/views/admin/dashboard/administrator_tasks/_form.html.erb index e5d9cdfe6..ef0156f79 100644 --- a/app/views/admin/dashboard/administrator_tasks/_form.html.erb +++ b/app/views/admin/dashboard/administrator_tasks/_form.html.erb @@ -17,7 +17,7 @@ <%= administrator_task.source.action.title %> - <%= form_for administrator_task, url: { action: 'update' } do |f| %> + <%= form_for administrator_task, url: { action: "update" } do |f| %> <%= f.submit(value: t("admin.dashboard.administrator_tasks.form.solve"), class: "button") %> <% end %> diff --git a/app/views/admin/dashboard/administrator_tasks/edit.html.erb b/app/views/admin/dashboard/administrator_tasks/edit.html.erb index aaae4582d..71c0b9fce 100644 --- a/app/views/admin/dashboard/administrator_tasks/edit.html.erb +++ b/app/views/admin/dashboard/administrator_tasks/edit.html.erb @@ -5,4 +5,4 @@

<%= t("admin.dashboard.administrator_tasks.edit.solving") %>

-<%= render 'form' %> +<%= render "form" %> diff --git a/app/views/admin/debates/show.html.erb b/app/views/admin/debates/show.html.erb index af37f7bf3..2494efa3d 100644 --- a/app/views/admin/debates/show.html.erb +++ b/app/views/admin/debates/show.html.erb @@ -12,7 +12,7 @@ <% end %>
- <%= render '/shared/author_info', resource: @debate %> + <%= render "/shared/author_info", resource: @debate %>  •  <%= l @debate.created_at.to_date %> @@ -21,7 +21,7 @@ <%= link_to t("debates.show.comments", count: @debate.comments_count), "#comments" %>  •  - <%= render 'debates/flag_actions', debate: @debate %> + <%= render "debates/flag_actions", debate: @debate %>
@@ -37,20 +37,20 @@
- <%= t('votes.agree') %> + <%= t("votes.agree") %> - <%= votes_percentage('likes', @debate) %> + <%= votes_percentage("likes", @debate) %>
 • 
- <%= t('votes.disagree') %> + <%= t("votes.disagree") %> - <%= votes_percentage('dislikes', @debate) %> + <%= votes_percentage("dislikes", @debate) %>
-<%= render 'shared/tags', taggable: @debate %> +<%= render "shared/tags", taggable: @debate %> diff --git a/app/views/admin/download_settings/_modal.html.erb b/app/views/admin/download_settings/_modal.html.erb index d66a2e186..9d6f86493 100644 --- a/app/views/admin/download_settings/_modal.html.erb +++ b/app/views/admin/download_settings/_modal.html.erb @@ -1,8 +1,8 @@
-

<%= t('download.modal.title') %>

+

<%= t("download.modal.title") %>

<%= form_tag current_path_with_query_params(format: :csv), method: :get do |f| %> - <%= render 'admin/download_settings/form_hidden_params' %> - <%= render 'admin/download_settings/form', resource: resource, download_settings: get_attrs(get_model(resource[:name])) %> + <%= render "admin/download_settings/form_hidden_params" %> + <%= render "admin/download_settings/form", resource: resource, download_settings: get_attrs(get_model(resource[:name])) %>
diff --git a/app/views/admin/download_settings/edit.html.erb b/app/views/admin/download_settings/edit.html.erb index 43485871f..c5c1e039e 100644 --- a/app/views/admin/download_settings/edit.html.erb +++ b/app/views/admin/download_settings/edit.html.erb @@ -6,7 +6,7 @@

<%= t("download.edit.#{@download_resource[:name]}") %> <%= t("download.edit.config.#{@download_resource[:config].to_s}") unless @download_resource[:config] == 0 %>

<%= form_tag admin_update_download_settings_path(resource: @download_resource[:name], config: @download_resource[:config]), method: :put do %> - <%= render 'form', resource: @download_resource, download_settings: @download_settings %> + <%= render "form", resource: @download_resource, download_settings: @download_settings %>
<%= submit_tag t("download.edit.submit"), class: "button success expanded" %> diff --git a/app/views/admin/proposals/toggle_selection.js.erb b/app/views/admin/proposals/toggle_selection.js.erb index 4963b7b7c..0f7f171ba 100644 --- a/app/views/admin/proposals/toggle_selection.js.erb +++ b/app/views/admin/proposals/toggle_selection.js.erb @@ -1 +1 @@ -$("#<%= dom_id(@proposal) %> .js-select").html('<%= j render("select_proposal", proposal: @proposal) %>'); +$("#<%= dom_id(@proposal) %> .js-select").html("<%= j render("select_proposal", proposal: @proposal) %>"); diff --git a/app/views/admin/site_customization/documents/new.html.erb b/app/views/admin/site_customization/documents/new.html.erb index 9a4971564..461629b07 100644 --- a/app/views/admin/site_customization/documents/new.html.erb +++ b/app/views/admin/site_customization/documents/new.html.erb @@ -2,7 +2,7 @@ <%= form_for @document, url: admin_site_customization_documents_path do |f| %> - <%= f.file_field 'attachment', label: t("admin.documents.new.label_attachment") %> + <%= f.file_field "attachment", label: t("admin.documents.new.label_attachment") %>
<%= f.submit t("admin.documents.new.submit_button"), class: "button success" %> diff --git a/app/views/admin/stats/graph.html.erb b/app/views/admin/stats/graph.html.erb index af6d1111a..13c473347 100644 --- a/app/views/admin/stats/graph.html.erb +++ b/app/views/admin/stats/graph.html.erb @@ -1,5 +1,5 @@ <% content_for :head do %> - <%= javascript_include_tag "stat_graphs", 'data-turbolinks-track' => true %> + <%= javascript_include_tag "stat_graphs", "data-turbolinks-track" => true %> <% end %> -<%= render 'graph', name: @name, event: @event, count: @count %> +<%= render "graph", name: @name, event: @event, count: @count %> diff --git a/app/views/communities/_subnav.html.erb b/app/views/communities/_subnav.html.erb index be2b6ed30..e4b36b532 100644 --- a/app/views/communities/_subnav.html.erb +++ b/app/views/communities/_subnav.html.erb @@ -30,12 +30,12 @@
- <%= render partial: 'participant', collection: @participants %> + <%= render partial: "participant", collection: @participants %>
<% if @community.proposal.present? %>
- <%= render partial: 'poll', collection: @community.proposal.polls %> + <%= render partial: "poll", collection: @community.proposal.polls %>
<% end %>
diff --git a/app/views/dashboard/_goal.html.erb b/app/views/dashboard/_goal.html.erb index 824da44c9..b100e1952 100644 --- a/app/views/dashboard/_goal.html.erb +++ b/app/views/dashboard/_goal.html.erb @@ -3,7 +3,7 @@ <%= t("dashboard.goal.target_supports", count: number_with_precision(goal.required_supports, - delimiter: '.', precision: 0)) %> + delimiter: ".", precision: 0)) %>
diff --git a/app/views/dashboard/_mailing_resource.html.erb b/app/views/dashboard/_mailing_resource.html.erb index ef6e933f0..ed85a5642 100644 --- a/app/views/dashboard/_mailing_resource.html.erb +++ b/app/views/dashboard/_mailing_resource.html.erb @@ -3,7 +3,7 @@

<%= t("dashboard.menu.mailing") %>

- <%= Setting['proposals.email_short_title'] %> + <%= Setting["proposals.email_short_title"] %>

diff --git a/app/views/dashboard/_menu.html.erb b/app/views/dashboard/_menu.html.erb index 2948f35eb..7ab7244c6 100644 --- a/app/views/dashboard/_menu.html.erb +++ b/app/views/dashboard/_menu.html.erb @@ -1,12 +1,12 @@
diff --git a/config/initializers/devise_security_extension.rb b/config/initializers/devise_security_extension.rb index 6e691acbe..f72d8b3ec 100644 --- a/config/initializers/devise_security_extension.rb +++ b/config/initializers/devise_security_extension.rb @@ -42,7 +42,7 @@ module Devise module PasswordExpirable def need_change_password? self.administrator? && password_expired? - end + end def password_expired? self.password_changed_at < self.expire_password_after.ago From 71d9ddd849f44deecfa515c7a77b15f3ea844c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 18 Jun 2019 02:00:14 +0200 Subject: [PATCH 04/13] Apply rule to end files with a newline character --- app/controllers/admin/dashboard_controller.rb | 2 +- app/controllers/admin/officials_controller.rb | 2 +- app/controllers/admin/valuator_groups_controller.rb | 2 +- app/controllers/budgets/groups_controller.rb | 2 +- app/controllers/direct_messages_controller.rb | 2 +- app/controllers/direct_uploads_controller.rb | 2 +- app/controllers/management/dashboard_controller.rb | 2 +- app/controllers/management/email_verifications_controller.rb | 2 +- app/controllers/management/user_invites_controller.rb | 2 +- app/controllers/verification/verified_user_controller.rb | 2 +- app/helpers/cache_keys_helper.rb | 2 +- app/helpers/direct_uploads_helper.rb | 2 +- app/models/budget/reclassification.rb | 2 +- app/models/budget/reclassified_vote.rb | 2 +- app/models/budget/valuator_group_assignment.rb | 2 +- app/views/admin/banners/_errors.html.erb | 2 +- app/views/admin/banners/edit.html.erb | 2 +- app/views/admin/banners/new.html.erb | 2 +- app/views/admin/poll/_menu.html.erb | 2 +- app/views/admin/poll/booth_assignments/_results.html.erb | 2 +- app/views/admin/poll/booth_assignments/search_booths.js.erb | 2 +- app/views/admin/poll/booths/new.html.erb | 2 +- app/views/admin/poll/officer_assignments/search_officers.js.erb | 2 +- app/views/admin/poll/results/_recount.html.erb | 2 +- app/views/admin/poll/results/_result.html.erb | 2 +- app/views/admin/poll/shifts/search_officers.js.erb | 2 +- app/views/admin/site_customization/pages/index.html.erb | 1 - app/views/admin/stats/polls.html.erb | 2 +- app/views/admin/valuator_groups/_valuator.html.erb | 2 +- app/views/admin/valuator_groups/edit.html.erb | 2 +- app/views/admin/verifications/_failed_census_call.html.erb | 2 +- app/views/admin/widget/_menu.html.erb | 2 +- app/views/admin/widget/cards/edit.html.erb | 2 +- app/views/budgets/investments/_feasibility_link.html.erb | 2 +- app/views/comments/new.js.erb | 1 - app/views/comments/vote.js.erb | 2 +- app/views/debates/suggest.js.erb | 2 +- app/views/debates/vote.js.erb | 2 +- app/views/devise/password_expired/show.html.erb | 2 +- app/views/documents/_document_fields.html.erb | 2 +- app/views/images/destroy.js.erb | 2 +- app/views/layouts/_notification_item.html.erb | 2 +- app/views/legislation/annotations/_annotation_link.html.erb | 2 +- app/views/legislation/annotations/_comment_header.html.erb | 2 +- app/views/legislation/processes/_debate.html.erb | 2 +- app/views/legislation/proposals/suggest.js.erb | 2 +- app/views/mailer/budget_investment_unfeasible.html.erb | 2 +- app/views/mailer/budget_investment_unselected.html.erb | 2 +- app/views/management/email_verifications/sent.html.erb | 1 - app/views/management/proposals/vote.js.erb | 2 +- app/views/management/users/_erase_user_account.html.erb | 2 +- app/views/map_locations/_form_fields.html.erb | 1 - app/views/moderation/comments/hide.js.erb | 2 +- app/views/moderation/debates/hide.js.erb | 2 +- app/views/notifications/mark_as_read.js.erb | 2 +- app/views/notifications/mark_as_unread.js.erb | 2 +- app/views/proposals/suggest.js.erb | 2 +- app/views/proposals/vote.js.erb | 2 +- app/views/proposals/vote_featured.js.erb | 2 +- app/views/shared/_canonical.html.erb | 2 +- app/views/shared/_errors.html.erb | 2 +- app/views/shared/_print.html.erb | 2 +- config/initializers/devise_security_extension.rb | 2 +- config/initializers/i18n_backend.rb | 2 +- config/initializers/i18n_pluralize.rb | 2 +- lib/numeric.rb | 2 +- lib/wysiwyg_sanitizer.rb | 2 +- spec/controllers/management/base_controller_spec.rb | 2 +- spec/controllers/management/users_controller_spec.rb | 2 +- spec/controllers/users/registrations_controller_spec.rb | 2 +- spec/features/admin/poll/officer_assignments_spec.rb | 2 +- spec/features/admin/poll/officers_spec.rb | 2 +- spec/features/admin/users_spec.rb | 1 - spec/features/comments/poll_questions_spec.rb | 2 +- spec/features/direct_messages_spec.rb | 2 +- spec/features/management/email_verifications_spec.rb | 2 +- spec/features/proposal_ballots_spec.rb | 1 - spec/features/sessions_spec.rb | 1 - spec/features/stats_spec.rb | 2 +- spec/features/user_invites_spec.rb | 2 +- spec/helpers/admin_helper_spec.rb | 2 +- spec/helpers/application_helper_spec.rb | 2 +- spec/helpers/verification_helper_spec.rb | 2 +- spec/helpers/votes_helper_spec.rb | 2 +- spec/models/budget/reclassified_vote_spec.rb | 2 +- spec/models/direct_upload_spec.rb | 2 +- spec/models/tag_cloud_spec.rb | 2 +- spec/models/verification/sms_spec.rb | 2 +- spec/models/widget/card_spec.rb | 2 +- spec/models/widget/feed_spec.rb | 2 +- spec/support/matchers/appear_before.rb | 2 +- spec/support/verifiable.rb | 2 +- 92 files changed, 85 insertions(+), 92 deletions(-) diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 5fb5e3c13..f7aa5c440 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -3,4 +3,4 @@ class Admin::DashboardController < Admin::BaseController def index end -end \ No newline at end of file +end diff --git a/app/controllers/admin/officials_controller.rb b/app/controllers/admin/officials_controller.rb index e0a0a86ca..5cc004c54 100644 --- a/app/controllers/admin/officials_controller.rb +++ b/app/controllers/admin/officials_controller.rb @@ -30,4 +30,4 @@ class Admin::OfficialsController < Admin::BaseController params.require(:user).permit(:official_position, :official_level) end -end \ No newline at end of file +end diff --git a/app/controllers/admin/valuator_groups_controller.rb b/app/controllers/admin/valuator_groups_controller.rb index 6e8930122..7e2e6bb16 100644 --- a/app/controllers/admin/valuator_groups_controller.rb +++ b/app/controllers/admin/valuator_groups_controller.rb @@ -49,4 +49,4 @@ class Admin::ValuatorGroupsController < Admin::BaseController params.require(:valuator_group).permit(:name) end -end \ No newline at end of file +end diff --git a/app/controllers/budgets/groups_controller.rb b/app/controllers/budgets/groups_controller.rb index e309a3c8c..d289cca49 100644 --- a/app/controllers/budgets/groups_controller.rb +++ b/app/controllers/budgets/groups_controller.rb @@ -21,4 +21,4 @@ module Budgets @group = @budget.groups.find_by_slug_or_id! params[:id] end end -end \ No newline at end of file +end diff --git a/app/controllers/direct_messages_controller.rb b/app/controllers/direct_messages_controller.rb index 07f39d941..fa520dfcf 100644 --- a/app/controllers/direct_messages_controller.rb +++ b/app/controllers/direct_messages_controller.rb @@ -33,4 +33,4 @@ class DirectMessagesController < ApplicationController def parsed_params direct_message_params.merge(sender: @sender, receiver: @receiver) end -end \ No newline at end of file +end diff --git a/app/controllers/direct_uploads_controller.rb b/app/controllers/direct_uploads_controller.rb index a067a5d04..a2e089cdd 100644 --- a/app/controllers/direct_uploads_controller.rb +++ b/app/controllers/direct_uploads_controller.rb @@ -45,4 +45,4 @@ class DirectUploadsController < ApplicationController :attachment, :cached_attachment, attachment_attributes: []) end -end \ No newline at end of file +end diff --git a/app/controllers/management/dashboard_controller.rb b/app/controllers/management/dashboard_controller.rb index 87b134270..abb605341 100644 --- a/app/controllers/management/dashboard_controller.rb +++ b/app/controllers/management/dashboard_controller.rb @@ -3,4 +3,4 @@ class Management::DashboardController < Management::BaseController def index end -end \ No newline at end of file +end diff --git a/app/controllers/management/email_verifications_controller.rb b/app/controllers/management/email_verifications_controller.rb index 7d511fe4b..ef304de26 100644 --- a/app/controllers/management/email_verifications_controller.rb +++ b/app/controllers/management/email_verifications_controller.rb @@ -20,4 +20,4 @@ class Management::EmailVerificationsController < Management::BaseController params.require(:email_verification).permit(:document_type, :document_number, :email) end -end \ No newline at end of file +end diff --git a/app/controllers/management/user_invites_controller.rb b/app/controllers/management/user_invites_controller.rb index 4d9b4909f..cbe3d1914 100644 --- a/app/controllers/management/user_invites_controller.rb +++ b/app/controllers/management/user_invites_controller.rb @@ -10,4 +10,4 @@ class Management::UserInvitesController < Management::BaseController end end -end \ No newline at end of file +end diff --git a/app/controllers/verification/verified_user_controller.rb b/app/controllers/verification/verified_user_controller.rb index e637bb232..bc55f19f4 100644 --- a/app/controllers/verification/verified_user_controller.rb +++ b/app/controllers/verification/verified_user_controller.rb @@ -21,4 +21,4 @@ class Verification::VerifiedUserController < ApplicationController data end -end \ No newline at end of file +end diff --git a/app/helpers/cache_keys_helper.rb b/app/helpers/cache_keys_helper.rb index 75fc4a0ea..9b37807fb 100644 --- a/app/helpers/cache_keys_helper.rb +++ b/app/helpers/cache_keys_helper.rb @@ -27,4 +27,4 @@ module CacheKeysHelper "#{commentable.class.name}-#{commentable.id}" end -end \ No newline at end of file +end diff --git a/app/helpers/direct_uploads_helper.rb b/app/helpers/direct_uploads_helper.rb index 87ed630d7..d697b5127 100644 --- a/app/helpers/direct_uploads_helper.rb +++ b/app/helpers/direct_uploads_helper.rb @@ -13,4 +13,4 @@ module DirectUploadsHelper class: "delete remove-cached-attachment" end -end \ No newline at end of file +end diff --git a/app/models/budget/reclassification.rb b/app/models/budget/reclassification.rb index 7eefc0d33..f698ad381 100644 --- a/app/models/budget/reclassification.rb +++ b/app/models/budget/reclassification.rb @@ -47,4 +47,4 @@ class Budget end end -end \ No newline at end of file +end diff --git a/app/models/budget/reclassified_vote.rb b/app/models/budget/reclassified_vote.rb index 3f11aa388..6fceb4707 100644 --- a/app/models/budget/reclassified_vote.rb +++ b/app/models/budget/reclassified_vote.rb @@ -9,4 +9,4 @@ class Budget validates :investment, presence: true validates :reason, inclusion: {in: REASONS, allow_nil: false} end -end \ No newline at end of file +end diff --git a/app/models/budget/valuator_group_assignment.rb b/app/models/budget/valuator_group_assignment.rb index 3aa93cb14..cfacce16c 100644 --- a/app/models/budget/valuator_group_assignment.rb +++ b/app/models/budget/valuator_group_assignment.rb @@ -3,4 +3,4 @@ class Budget belongs_to :valuator_group, counter_cache: :budget_investments_count belongs_to :investment, counter_cache: true end -end \ No newline at end of file +end diff --git a/app/views/admin/banners/_errors.html.erb b/app/views/admin/banners/_errors.html.erb index d585cccee..0f3eaa3f4 100644 --- a/app/views/admin/banners/_errors.html.erb +++ b/app/views/admin/banners/_errors.html.erb @@ -12,4 +12,4 @@
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/admin/banners/edit.html.erb b/app/views/admin/banners/edit.html.erb index 17cb11405..26b4f49b0 100644 --- a/app/views/admin/banners/edit.html.erb +++ b/app/views/admin/banners/edit.html.erb @@ -7,4 +7,4 @@ <%= render "form" %>
-
\ No newline at end of file + diff --git a/app/views/admin/banners/new.html.erb b/app/views/admin/banners/new.html.erb index dc5eb4ca3..1174fc81c 100644 --- a/app/views/admin/banners/new.html.erb +++ b/app/views/admin/banners/new.html.erb @@ -7,4 +7,4 @@ <%= render "form" %> - \ No newline at end of file + diff --git a/app/views/admin/poll/_menu.html.erb b/app/views/admin/poll/_menu.html.erb index 08efd87dc..38c8bc5c4 100644 --- a/app/views/admin/poll/_menu.html.erb +++ b/app/views/admin/poll/_menu.html.erb @@ -1 +1 @@ -<%= render "admin/menu" %> \ No newline at end of file +<%= render "admin/menu" %> diff --git a/app/views/admin/poll/booth_assignments/_results.html.erb b/app/views/admin/poll/booth_assignments/_results.html.erb index fdbc4da3f..535485096 100644 --- a/app/views/admin/poll/booth_assignments/_results.html.erb +++ b/app/views/admin/poll/booth_assignments/_results.html.erb @@ -9,4 +9,4 @@ <%= render "admin/poll/results/recount", resource: @booth_assignment %> <%= render "admin/poll/results/result" %> <% end %> - \ No newline at end of file + diff --git a/app/views/admin/poll/booth_assignments/search_booths.js.erb b/app/views/admin/poll/booth_assignments/search_booths.js.erb index c773ce518..cdbc6f59a 100644 --- a/app/views/admin/poll/booth_assignments/search_booths.js.erb +++ b/app/views/admin/poll/booth_assignments/search_booths.js.erb @@ -1 +1 @@ -$("#search-booths-results").html("<%= j render "search_booths_results" %>"); \ No newline at end of file +$("#search-booths-results").html("<%= j render "search_booths_results" %>"); diff --git a/app/views/admin/poll/booths/new.html.erb b/app/views/admin/poll/booths/new.html.erb index 54e64c907..7e59fcd67 100644 --- a/app/views/admin/poll/booths/new.html.erb +++ b/app/views/admin/poll/booths/new.html.erb @@ -6,4 +6,4 @@ <%= form_for @booth, url: admin_booths_path(@booth) do |f| %> <%= render "form", f: f %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/admin/poll/officer_assignments/search_officers.js.erb b/app/views/admin/poll/officer_assignments/search_officers.js.erb index 9a97db091..300ec21b4 100644 --- a/app/views/admin/poll/officer_assignments/search_officers.js.erb +++ b/app/views/admin/poll/officer_assignments/search_officers.js.erb @@ -1 +1 @@ -$("#search-officers-results").html("<%= j render "search_officers_results" %>"); \ No newline at end of file +$("#search-officers-results").html("<%= j render "search_officers_results" %>"); diff --git a/app/views/admin/poll/results/_recount.html.erb b/app/views/admin/poll/results/_recount.html.erb index f4ab43954..f876c593e 100644 --- a/app/views/admin/poll/results/_recount.html.erb +++ b/app/views/admin/poll/results/_recount.html.erb @@ -11,4 +11,4 @@ <%= resource.recounts.sum(:total_amount) %> - \ No newline at end of file + diff --git a/app/views/admin/poll/results/_result.html.erb b/app/views/admin/poll/results/_result.html.erb index e2fe5f037..511f278ef 100644 --- a/app/views/admin/poll/results/_result.html.erb +++ b/app/views/admin/poll/results/_result.html.erb @@ -18,4 +18,4 @@ <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/admin/poll/shifts/search_officers.js.erb b/app/views/admin/poll/shifts/search_officers.js.erb index 9a97db091..300ec21b4 100644 --- a/app/views/admin/poll/shifts/search_officers.js.erb +++ b/app/views/admin/poll/shifts/search_officers.js.erb @@ -1 +1 @@ -$("#search-officers-results").html("<%= j render "search_officers_results" %>"); \ No newline at end of file +$("#search-officers-results").html("<%= j render "search_officers_results" %>"); diff --git a/app/views/admin/site_customization/pages/index.html.erb b/app/views/admin/site_customization/pages/index.html.erb index bf1b24569..d902086fc 100644 --- a/app/views/admin/site_customization/pages/index.html.erb +++ b/app/views/admin/site_customization/pages/index.html.erb @@ -61,4 +61,3 @@ <%= page_entries_info @pages %> <% end %> - diff --git a/app/views/admin/stats/polls.html.erb b/app/views/admin/stats/polls.html.erb index fae840f07..4373e5eae 100644 --- a/app/views/admin/stats/polls.html.erb +++ b/app/views/admin/stats/polls.html.erb @@ -84,4 +84,4 @@ -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/admin/valuator_groups/_valuator.html.erb b/app/views/admin/valuator_groups/_valuator.html.erb index 5c7bf71f8..1632a4c40 100644 --- a/app/views/admin/valuator_groups/_valuator.html.erb +++ b/app/views/admin/valuator_groups/_valuator.html.erb @@ -1,4 +1,4 @@
  • <%= link_to valuator.description_or_email, admin_valuator_path(valuator) %> -
  • \ No newline at end of file + diff --git a/app/views/admin/valuator_groups/edit.html.erb b/app/views/admin/valuator_groups/edit.html.erb index fe57117b6..b73095d2e 100644 --- a/app/views/admin/valuator_groups/edit.html.erb +++ b/app/views/admin/valuator_groups/edit.html.erb @@ -6,4 +6,4 @@ <%= f.text_field :name, label: false %> <%= f.submit t("admin.valuator_groups.form.edit"), class: "button success" %> <% end %> - \ No newline at end of file + diff --git a/app/views/admin/verifications/_failed_census_call.html.erb b/app/views/admin/verifications/_failed_census_call.html.erb index 793fdb2e4..8161e4b40 100644 --- a/app/views/admin/verifications/_failed_census_call.html.erb +++ b/app/views/admin/verifications/_failed_census_call.html.erb @@ -3,4 +3,4 @@ <%= failed_census_call.document_number %> <%= l(failed_census_call.date_of_birth) %> <%= failed_census_call.postal_code %> - \ No newline at end of file + diff --git a/app/views/admin/widget/_menu.html.erb b/app/views/admin/widget/_menu.html.erb index 08efd87dc..38c8bc5c4 100644 --- a/app/views/admin/widget/_menu.html.erb +++ b/app/views/admin/widget/_menu.html.erb @@ -1 +1 @@ -<%= render "admin/menu" %> \ No newline at end of file +<%= render "admin/menu" %> diff --git a/app/views/admin/widget/cards/edit.html.erb b/app/views/admin/widget/cards/edit.html.erb index b9e6045c9..fd7260ba7 100644 --- a/app/views/admin/widget/cards/edit.html.erb +++ b/app/views/admin/widget/cards/edit.html.erb @@ -6,4 +6,4 @@ <% end %> -<%= render "form" %> \ No newline at end of file +<%= render "form" %> diff --git a/app/views/budgets/investments/_feasibility_link.html.erb b/app/views/budgets/investments/_feasibility_link.html.erb index 118a02e7f..080efcd18 100644 --- a/app/views/budgets/investments/_feasibility_link.html.erb +++ b/app/views/budgets/investments/_feasibility_link.html.erb @@ -8,4 +8,4 @@ <% else %> <%= link_to t("budgets.investments.index.sidebar.unfeasible"), budget_investments_path(@budget, heading_id: @heading, unfeasible: 1) %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/comments/new.js.erb b/app/views/comments/new.js.erb index ad92cb822..2ecab68a2 100644 --- a/app/views/comments/new.js.erb +++ b/app/views/comments/new.js.erb @@ -2,4 +2,3 @@ var field_with_errors = "#js-comment-form-<%= dom_id %> #comment-body-<%= dom_id %>"; App.Comments.display_error(field_with_errors, "<%= j render("comments/errors") %>"); - diff --git a/app/views/comments/vote.js.erb b/app/views/comments/vote.js.erb index e56fb3d65..2fe859cbd 100644 --- a/app/views/comments/vote.js.erb +++ b/app/views/comments/vote.js.erb @@ -1 +1 @@ -$("#<%= dom_id(@comment) %>_votes").html("<%= j render("comments/votes", comment: @comment) %>"); \ No newline at end of file +$("#<%= dom_id(@comment) %>_votes").html("<%= j render("comments/votes", comment: @comment) %>"); diff --git a/app/views/debates/suggest.js.erb b/app/views/debates/suggest.js.erb index 819af2b16..d49120ed2 100644 --- a/app/views/debates/suggest.js.erb +++ b/app/views/debates/suggest.js.erb @@ -1 +1 @@ -<%= render "shared/suggest" %> \ No newline at end of file +<%= render "shared/suggest" %> diff --git a/app/views/debates/vote.js.erb b/app/views/debates/vote.js.erb index cf9a98cd6..aae060dbd 100644 --- a/app/views/debates/vote.js.erb +++ b/app/views/debates/vote.js.erb @@ -1 +1 @@ -$("#<%= dom_id(@debate) %>_votes").html("<%= j render("debates/votes", debate: @debate) %>"); \ No newline at end of file +$("#<%= dom_id(@debate) %>_votes").html("<%= j render("debates/votes", debate: @debate) %>"); diff --git a/app/views/devise/password_expired/show.html.erb b/app/views/devise/password_expired/show.html.erb index bba3e1d13..cf008fe35 100644 --- a/app/views/devise/password_expired/show.html.erb +++ b/app/views/devise/password_expired/show.html.erb @@ -10,4 +10,4 @@ <%= f.password_field :password_confirmation %>

    <%= f.submit t("devise.password_expired.change_password") %>

    -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/documents/_document_fields.html.erb b/app/views/documents/_document_fields.html.erb index 7d7129df6..8f532c71b 100644 --- a/app/views/documents/_document_fields.html.erb +++ b/app/views/documents/_document_fields.html.erb @@ -28,4 +28,4 @@
    - \ No newline at end of file + diff --git a/app/views/images/destroy.js.erb b/app/views/images/destroy.js.erb index 0fb79df5d..647e14a49 100644 --- a/app/views/images/destroy.js.erb +++ b/app/views/images/destroy.js.erb @@ -1 +1 @@ -App.Imageable.removeImage("<%= dom_id(@image) %>") \ No newline at end of file +App.Imageable.removeImage("<%= dom_id(@image) %>") diff --git a/app/views/layouts/_notification_item.html.erb b/app/views/layouts/_notification_item.html.erb index 5e2d6060c..7a21a3c38 100644 --- a/app/views/layouts/_notification_item.html.erb +++ b/app/views/layouts/_notification_item.html.erb @@ -27,4 +27,4 @@ <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/legislation/annotations/_annotation_link.html.erb b/app/views/legislation/annotations/_annotation_link.html.erb index 74f841abd..b047f52cb 100644 --- a/app/views/legislation/annotations/_annotation_link.html.erb +++ b/app/views/legislation/annotations/_annotation_link.html.erb @@ -1,3 +1,3 @@ <%= link_to legislation_process_draft_version_annotation_path(annotation.draft_version.process, annotation.draft_version, annotation, sub_annotation_ids: "") do %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/legislation/annotations/_comment_header.html.erb b/app/views/legislation/annotations/_comment_header.html.erb index 26cd21469..12a386206 100644 --- a/app/views/legislation/annotations/_comment_header.html.erb +++ b/app/views/legislation/annotations/_comment_header.html.erb @@ -7,4 +7,4 @@ <%= render "annotation_link", annotation: annotation %> - \ No newline at end of file + diff --git a/app/views/legislation/processes/_debate.html.erb b/app/views/legislation/processes/_debate.html.erb index fe4c02cef..57f0b5f71 100644 --- a/app/views/legislation/processes/_debate.html.erb +++ b/app/views/legislation/processes/_debate.html.erb @@ -14,4 +14,4 @@

    <%= t("legislation.processes.debate.participate") %>

    -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/legislation/proposals/suggest.js.erb b/app/views/legislation/proposals/suggest.js.erb index 819af2b16..d49120ed2 100644 --- a/app/views/legislation/proposals/suggest.js.erb +++ b/app/views/legislation/proposals/suggest.js.erb @@ -1 +1 @@ -<%= render "shared/suggest" %> \ No newline at end of file +<%= render "shared/suggest" %> diff --git a/app/views/mailer/budget_investment_unfeasible.html.erb b/app/views/mailer/budget_investment_unfeasible.html.erb index 710afce72..80ee3ccc5 100644 --- a/app/views/mailer/budget_investment_unfeasible.html.erb +++ b/app/views/mailer/budget_investment_unfeasible.html.erb @@ -21,4 +21,4 @@

    <%= t("mailers.budget_investment_unfeasible.sincerely") %>

    - \ No newline at end of file + diff --git a/app/views/mailer/budget_investment_unselected.html.erb b/app/views/mailer/budget_investment_unselected.html.erb index c57576b6f..e45a7848d 100644 --- a/app/views/mailer/budget_investment_unselected.html.erb +++ b/app/views/mailer/budget_investment_unselected.html.erb @@ -11,4 +11,4 @@

    <%= t("mailers.budget_investment_unselected.sincerely") %>

    - \ No newline at end of file + diff --git a/app/views/management/email_verifications/sent.html.erb b/app/views/management/email_verifications/sent.html.erb index 8a5458c29..a996ead96 100644 --- a/app/views/management/email_verifications/sent.html.erb +++ b/app/views/management/email_verifications/sent.html.erb @@ -9,4 +9,3 @@

    <%= t("management.print_info") %>

    - diff --git a/app/views/management/proposals/vote.js.erb b/app/views/management/proposals/vote.js.erb index 4a2dcf3a9..f26a977ac 100644 --- a/app/views/management/proposals/vote.js.erb +++ b/app/views/management/proposals/vote.js.erb @@ -1 +1 @@ -<%= render template: "proposals/vote" %> \ No newline at end of file +<%= render template: "proposals/vote" %> diff --git a/app/views/management/users/_erase_user_account.html.erb b/app/views/management/users/_erase_user_account.html.erb index 8d5a545a3..5746e103a 100644 --- a/app/views/management/users/_erase_user_account.html.erb +++ b/app/views/management/users/_erase_user_account.html.erb @@ -6,4 +6,4 @@ <%= link_to t("management.users.erase_submit"), erase_management_users_path, method: :delete, class: "button hollow alert", data: { confirm: t("management.users.erase_account_confirm") } %> - \ No newline at end of file + diff --git a/app/views/map_locations/_form_fields.html.erb b/app/views/map_locations/_form_fields.html.erb index 344287993..f2292a42e 100644 --- a/app/views/map_locations/_form_fields.html.erb +++ b/app/views/map_locations/_form_fields.html.erb @@ -29,4 +29,3 @@ <% end %> <% end %> - diff --git a/app/views/moderation/comments/hide.js.erb b/app/views/moderation/comments/hide.js.erb index 6739b9d09..e4f79a0ff 100644 --- a/app/views/moderation/comments/hide.js.erb +++ b/app/views/moderation/comments/hide.js.erb @@ -1,3 +1,3 @@ var comment_id = "<%= dom_id(@comment) %>"; App.ModeratorComments.add_class_faded(comment_id); -App.ModeratorComments.hide_moderator_actions(comment_id); \ No newline at end of file +App.ModeratorComments.hide_moderator_actions(comment_id); diff --git a/app/views/moderation/debates/hide.js.erb b/app/views/moderation/debates/hide.js.erb index 14f6fd80e..f8162a501 100644 --- a/app/views/moderation/debates/hide.js.erb +++ b/app/views/moderation/debates/hide.js.erb @@ -1,3 +1,3 @@ var debate_id = "<%= dom_id(@debate) %>"; App.ModeratorDebates.add_class_faded(debate_id); -App.ModeratorDebates.hide_moderator_actions(debate_id); \ No newline at end of file +App.ModeratorDebates.hide_moderator_actions(debate_id); diff --git a/app/views/notifications/mark_as_read.js.erb b/app/views/notifications/mark_as_read.js.erb index 6e6cb3785..3b8e24761 100644 --- a/app/views/notifications/mark_as_read.js.erb +++ b/app/views/notifications/mark_as_read.js.erb @@ -1 +1 @@ -$("#notification_<%= @notification.id %>").hide() \ No newline at end of file +$("#notification_<%= @notification.id %>").hide() diff --git a/app/views/notifications/mark_as_unread.js.erb b/app/views/notifications/mark_as_unread.js.erb index 6e6cb3785..3b8e24761 100644 --- a/app/views/notifications/mark_as_unread.js.erb +++ b/app/views/notifications/mark_as_unread.js.erb @@ -1 +1 @@ -$("#notification_<%= @notification.id %>").hide() \ No newline at end of file +$("#notification_<%= @notification.id %>").hide() diff --git a/app/views/proposals/suggest.js.erb b/app/views/proposals/suggest.js.erb index 819af2b16..d49120ed2 100644 --- a/app/views/proposals/suggest.js.erb +++ b/app/views/proposals/suggest.js.erb @@ -1 +1 @@ -<%= render "shared/suggest" %> \ No newline at end of file +<%= render "shared/suggest" %> diff --git a/app/views/proposals/vote.js.erb b/app/views/proposals/vote.js.erb index e74df788c..09fe51476 100644 --- a/app/views/proposals/vote.js.erb +++ b/app/views/proposals/vote.js.erb @@ -1 +1 @@ -$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("proposals/votes", proposal: @proposal) %>"); \ No newline at end of file +$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("proposals/votes", proposal: @proposal) %>"); diff --git a/app/views/proposals/vote_featured.js.erb b/app/views/proposals/vote_featured.js.erb index 7363dadf9..ee4c20d5a 100644 --- a/app/views/proposals/vote_featured.js.erb +++ b/app/views/proposals/vote_featured.js.erb @@ -1 +1 @@ -$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("proposals/featured_votes", proposal: @proposal) %>"); \ No newline at end of file +$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("proposals/featured_votes", proposal: @proposal) %>"); diff --git a/app/views/shared/_canonical.html.erb b/app/views/shared/_canonical.html.erb index 1c3361a0e..e53d3dc39 100644 --- a/app/views/shared/_canonical.html.erb +++ b/app/views/shared/_canonical.html.erb @@ -1 +1 @@ - \ No newline at end of file + diff --git a/app/views/shared/_errors.html.erb b/app/views/shared/_errors.html.erb index 3fe7d16c6..04de31885 100644 --- a/app/views/shared/_errors.html.erb +++ b/app/views/shared/_errors.html.erb @@ -14,4 +14,4 @@ <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/shared/_print.html.erb b/app/views/shared/_print.html.erb index 5544258d3..f321c34a6 100644 --- a/app/views/shared/_print.html.erb +++ b/app/views/shared/_print.html.erb @@ -1,3 +1,3 @@ <%= t("shared.print.print_button") %> - \ No newline at end of file + diff --git a/config/initializers/devise_security_extension.rb b/config/initializers/devise_security_extension.rb index f72d8b3ec..51cf56429 100644 --- a/config/initializers/devise_security_extension.rb +++ b/config/initializers/devise_security_extension.rb @@ -68,4 +68,4 @@ module Devise end end end -end \ No newline at end of file +end diff --git a/config/initializers/i18n_backend.rb b/config/initializers/i18n_backend.rb index bdaa023ca..824834de1 100644 --- a/config/initializers/i18n_backend.rb +++ b/config/initializers/i18n_backend.rb @@ -1 +1 @@ -I18n::Backend::Simple.send(:include, I18n::Backend::Memoize) unless Rails.env.development? \ No newline at end of file +I18n::Backend::Simple.send(:include, I18n::Backend::Memoize) unless Rails.env.development? diff --git a/config/initializers/i18n_pluralize.rb b/config/initializers/i18n_pluralize.rb index 5200df8ff..20698d6f0 100644 --- a/config/initializers/i18n_pluralize.rb +++ b/config/initializers/i18n_pluralize.rb @@ -16,4 +16,4 @@ module I18n end end -end \ No newline at end of file +end diff --git a/lib/numeric.rb b/lib/numeric.rb index 9ed1aabae..ab9b212b9 100644 --- a/lib/numeric.rb +++ b/lib/numeric.rb @@ -2,4 +2,4 @@ class Numeric def percent_of(n) (to_f / n * 100).to_i end -end \ No newline at end of file +end diff --git a/lib/wysiwyg_sanitizer.rb b/lib/wysiwyg_sanitizer.rb index ee056383c..1a6c430f4 100644 --- a/lib/wysiwyg_sanitizer.rb +++ b/lib/wysiwyg_sanitizer.rb @@ -11,4 +11,4 @@ class WYSIWYGSanitizer ActionController::Base.helpers.sanitize(html, tags: allowed_tags, attributes: allowed_attributes) end -end \ No newline at end of file +end diff --git a/spec/controllers/management/base_controller_spec.rb b/spec/controllers/management/base_controller_spec.rb index 751466e7b..ca0fa7528 100644 --- a/spec/controllers/management/base_controller_spec.rb +++ b/spec/controllers/management/base_controller_spec.rb @@ -24,4 +24,4 @@ describe Management::BaseController do end end -end \ No newline at end of file +end diff --git a/spec/controllers/management/users_controller_spec.rb b/spec/controllers/management/users_controller_spec.rb index 3b89920b9..60cc81700 100644 --- a/spec/controllers/management/users_controller_spec.rb +++ b/spec/controllers/management/users_controller_spec.rb @@ -17,4 +17,4 @@ describe Management::UsersController do end end -end \ No newline at end of file +end diff --git a/spec/controllers/users/registrations_controller_spec.rb b/spec/controllers/users/registrations_controller_spec.rb index 2a82842b0..409529534 100644 --- a/spec/controllers/users/registrations_controller_spec.rb +++ b/spec/controllers/users/registrations_controller_spec.rb @@ -31,4 +31,4 @@ describe Users::RegistrationsController do end -end \ No newline at end of file +end diff --git a/spec/features/admin/poll/officer_assignments_spec.rb b/spec/features/admin/poll/officer_assignments_spec.rb index 891f381c4..2f04ab607 100644 --- a/spec/features/admin/poll/officer_assignments_spec.rb +++ b/spec/features/admin/poll/officer_assignments_spec.rb @@ -64,4 +64,4 @@ describe "Officer Assignments" do end end -end \ No newline at end of file +end diff --git a/spec/features/admin/poll/officers_spec.rb b/spec/features/admin/poll/officers_spec.rb index c47f17ccb..dcc2fc140 100644 --- a/spec/features/admin/poll/officers_spec.rb +++ b/spec/features/admin/poll/officers_spec.rb @@ -33,4 +33,4 @@ describe "Admin poll officers" do expect(page).not_to have_css "#officers" end -end \ No newline at end of file +end diff --git a/spec/features/admin/users_spec.rb b/spec/features/admin/users_spec.rb index 8ba66a6d7..e3a0d9950 100644 --- a/spec/features/admin/users_spec.rb +++ b/spec/features/admin/users_spec.rb @@ -31,4 +31,3 @@ describe "Admin users" do expect(page).not_to have_content @admin.email end end - diff --git a/spec/features/comments/poll_questions_spec.rb b/spec/features/comments/poll_questions_spec.rb index 6e5cffe97..99b14edf3 100644 --- a/spec/features/comments/poll_questions_spec.rb +++ b/spec/features/comments/poll_questions_spec.rb @@ -1 +1 @@ -#refactor specs and test as one more commmentable \ No newline at end of file +#refactor specs and test as one more commmentable diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index c64d56d5a..2872d252b 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -119,4 +119,4 @@ describe "Direct messages" do end -end \ No newline at end of file +end diff --git a/spec/features/management/email_verifications_spec.rb b/spec/features/management/email_verifications_spec.rb index 7de10c253..209874c6e 100644 --- a/spec/features/management/email_verifications_spec.rb +++ b/spec/features/management/email_verifications_spec.rb @@ -34,4 +34,4 @@ describe "EmailVerifications" do expect(user).to be_level_three_verified end -end \ No newline at end of file +end diff --git a/spec/features/proposal_ballots_spec.rb b/spec/features/proposal_ballots_spec.rb index d88a05985..168bc7103 100644 --- a/spec/features/proposal_ballots_spec.rb +++ b/spec/features/proposal_ballots_spec.rb @@ -27,4 +27,3 @@ describe "Proposal ballots" do end end - diff --git a/spec/features/sessions_spec.rb b/spec/features/sessions_spec.rb index 5e0dd0b09..16fa62585 100644 --- a/spec/features/sessions_spec.rb +++ b/spec/features/sessions_spec.rb @@ -20,4 +20,3 @@ describe "Sessions" do end end - diff --git a/spec/features/stats_spec.rb b/spec/features/stats_spec.rb index a16e63aab..c28dec444 100644 --- a/spec/features/stats_spec.rb +++ b/spec/features/stats_spec.rb @@ -49,4 +49,4 @@ describe "Stats" do end -end \ No newline at end of file +end diff --git a/spec/features/user_invites_spec.rb b/spec/features/user_invites_spec.rb index 5e15cd222..5e38ebb2c 100644 --- a/spec/features/user_invites_spec.rb +++ b/spec/features/user_invites_spec.rb @@ -15,4 +15,4 @@ describe "User invites" do expect(page).to have_content "3 invitations have been sent." end -end \ No newline at end of file +end diff --git a/spec/helpers/admin_helper_spec.rb b/spec/helpers/admin_helper_spec.rb index 1f20ee1b4..c5cc7c25b 100644 --- a/spec/helpers/admin_helper_spec.rb +++ b/spec/helpers/admin_helper_spec.rb @@ -16,4 +16,4 @@ describe AdminHelper do end -end \ No newline at end of file +end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index b17a14756..7ad856681 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -24,4 +24,4 @@ describe ApplicationHelper do end end -end \ No newline at end of file +end diff --git a/spec/helpers/verification_helper_spec.rb b/spec/helpers/verification_helper_spec.rb index c5fe164d5..5ed838c9f 100644 --- a/spec/helpers/verification_helper_spec.rb +++ b/spec/helpers/verification_helper_spec.rb @@ -21,4 +21,4 @@ describe VerificationHelper do end end -end \ No newline at end of file +end diff --git a/spec/helpers/votes_helper_spec.rb b/spec/helpers/votes_helper_spec.rb index c402fb2b4..41dd80c7f 100644 --- a/spec/helpers/votes_helper_spec.rb +++ b/spec/helpers/votes_helper_spec.rb @@ -29,4 +29,4 @@ describe VotesHelper do end end -end \ No newline at end of file +end diff --git a/spec/models/budget/reclassified_vote_spec.rb b/spec/models/budget/reclassified_vote_spec.rb index a4ca44dac..a683e3564 100644 --- a/spec/models/budget/reclassified_vote_spec.rb +++ b/spec/models/budget/reclassified_vote_spec.rb @@ -37,4 +37,4 @@ describe Budget::ReclassifiedVote do end end -end \ No newline at end of file +end diff --git a/spec/models/direct_upload_spec.rb b/spec/models/direct_upload_spec.rb index ab7183825..2c40bc9ee 100644 --- a/spec/models/direct_upload_spec.rb +++ b/spec/models/direct_upload_spec.rb @@ -62,4 +62,4 @@ describe DirectUpload do end -end \ No newline at end of file +end diff --git a/spec/models/tag_cloud_spec.rb b/spec/models/tag_cloud_spec.rb index df04e9d5c..09a0f4c21 100644 --- a/spec/models/tag_cloud_spec.rb +++ b/spec/models/tag_cloud_spec.rb @@ -122,4 +122,4 @@ describe TagCloud do end end -end \ No newline at end of file +end diff --git a/spec/models/verification/sms_spec.rb b/spec/models/verification/sms_spec.rb index 4434bd341..714ea68a5 100644 --- a/spec/models/verification/sms_spec.rb +++ b/spec/models/verification/sms_spec.rb @@ -19,4 +19,4 @@ describe Verification::Sms do expect(build(:verification_sms, phone: "555; DROP TABLE USERS")).not_to be_valid end -end \ No newline at end of file +end diff --git a/spec/models/widget/card_spec.rb b/spec/models/widget/card_spec.rb index 5cc4238f5..c0a393984 100644 --- a/spec/models/widget/card_spec.rb +++ b/spec/models/widget/card_spec.rb @@ -36,4 +36,4 @@ describe Widget::Card do expect(Widget::Card.body).not_to include(page_card) end end -end \ No newline at end of file +end diff --git a/spec/models/widget/feed_spec.rb b/spec/models/widget/feed_spec.rb index f8b881a0b..2d8521f70 100644 --- a/spec/models/widget/feed_spec.rb +++ b/spec/models/widget/feed_spec.rb @@ -75,4 +75,4 @@ describe Widget::Feed do end -end \ No newline at end of file +end diff --git a/spec/support/matchers/appear_before.rb b/spec/support/matchers/appear_before.rb index bab77830f..dc44c5ebc 100644 --- a/spec/support/matchers/appear_before.rb +++ b/spec/support/matchers/appear_before.rb @@ -3,4 +3,4 @@ RSpec::Matchers.define :appear_before do |later_content| text = page.text text.index(earlier_content) < text.index(later_content) end -end \ No newline at end of file +end diff --git a/spec/support/verifiable.rb b/spec/support/verifiable.rb index 53070da4d..4a8c5a90e 100644 --- a/spec/support/verifiable.rb +++ b/spec/support/verifiable.rb @@ -254,4 +254,4 @@ shared_examples_for "verifiable" do end end -end \ No newline at end of file +end From 17c36c6c6c0456fe5c59f1990687abb59a3fb55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 18 Jun 2019 02:05:00 +0200 Subject: [PATCH 05/13] Apply `NotToNot` rubocop rule --- spec/controllers/legislation/annotations_controller_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/controllers/legislation/annotations_controller_spec.rb b/spec/controllers/legislation/annotations_controller_spec.rb index 7e580b3c8..3fdf31a27 100644 --- a/spec/controllers/legislation/annotations_controller_spec.rb +++ b/spec/controllers/legislation/annotations_controller_spec.rb @@ -101,7 +101,7 @@ describe Legislation::AnnotationsController do "text" => "una anotacion" } } - end.to_not change { draft_version.annotations.count } + end.not_to change { draft_version.annotations.count } end it "creates an annotation by parsing parameters in JSON" do @@ -157,7 +157,7 @@ describe Legislation::AnnotationsController do "text" => "una anotacion" } } - end.to_not change { draft_version.annotations.count } + end.not_to change { draft_version.annotations.count } expect(annotation.reload.comments_count).to eq(2) expect(annotation.comments.last.body).to eq("una anotacion") From b5b07bccd389a3c18975ded561d2cd0908aa60f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 18 Jun 2019 02:09:10 +0200 Subject: [PATCH 06/13] Apply `PercentLiteralDelimiters` rubocop rule --- .rubocop.yml | 3 --- .rubocop_basic.yml | 3 +++ app/controllers/admin/activity_controller.rb | 2 +- app/controllers/admin/banners_controller.rb | 2 +- app/controllers/admin/budgets_controller.rb | 2 +- .../admin/hidden_budget_investments_controller.rb | 2 +- .../admin/hidden_comments_controller.rb | 2 +- app/controllers/admin/hidden_debates_controller.rb | 2 +- app/controllers/admin/hidden_users_controller.rb | 2 +- app/controllers/admin/organizations_controller.rb | 2 +- .../admin/proposal_notifications_controller.rb | 2 +- app/controllers/budgets/investments_controller.rb | 2 +- app/controllers/communities_controller.rb | 2 +- app/controllers/debates_controller.rb | 2 +- .../legislation/proposals_controller.rb | 4 ++-- .../legislation/questions_controller.rb | 2 +- .../moderation/budgets/investments_controller.rb | 4 ++-- app/controllers/moderation/comments_controller.rb | 4 ++-- app/controllers/moderation/debates_controller.rb | 4 ++-- .../proposal_notifications_controller.rb | 4 ++-- app/controllers/moderation/proposals_controller.rb | 4 ++-- app/controllers/topics_controller.rb | 2 +- .../tracking/budget_investments_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- .../valuation/budget_investments_controller.rb | 4 ++-- app/models/activity.rb | 2 +- app/models/budget.rb | 10 +++++----- app/models/budget/phase.rb | 6 +++--- app/models/budget/reclassified_vote.rb | 2 +- app/models/debate.rb | 2 +- app/models/legislation/draft_version.rb | 2 +- app/models/poll/partial_result.rb | 2 +- app/models/poll/recount.rb | 2 +- app/models/related_content.rb | 2 +- app/models/signature.rb | 2 +- app/models/signature_sheet.rb | 2 +- app/models/widget/feed.rb | 2 +- app/views/admin/_menu.html.erb | 8 ++++---- config/deploy.rb | 8 ++++---- config/deploy/preproduction.rb | 4 ++-- config/deploy/production.rb | 2 +- config/deploy/staging.rb | 2 +- config/initializers/assets.rb | 14 +++++++------- config/initializers/social_share_button.rb | 2 +- config/spring.rb | 4 ++-- spec/features/budgets/investments_spec.rb | 6 +++--- spec/features/proposals_spec.rb | 2 +- spec/lib/document_parser_spec.rb | 2 +- spec/lib/tag_sanitizer_spec.rb | 2 +- 49 files changed, 79 insertions(+), 79 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b1c79a16c..cf9fb516e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -353,6 +353,3 @@ Security/MarshalLoad: Security/YAMLLoad: Enabled: true - -Style/PercentLiteralDelimiters: - Enabled: true diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 44beb5256..8529369be 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -68,5 +68,8 @@ Rails/TimeZone: RSpec/NotToNot: Enabled: true +Style/PercentLiteralDelimiters: + Enabled: true + Style/StringLiterals: EnforcedStyle: double_quotes diff --git a/app/controllers/admin/activity_controller.rb b/app/controllers/admin/activity_controller.rb index ce9c04183..44357c5fb 100644 --- a/app/controllers/admin/activity_controller.rb +++ b/app/controllers/admin/activity_controller.rb @@ -1,5 +1,5 @@ class Admin::ActivityController < Admin::BaseController - has_filters %w{all on_users on_proposals on_debates on_comments on_system_emails} + has_filters %w[all on_users on_proposals on_debates on_comments on_system_emails] def show @activity = Activity.for_render.send(@current_filter) diff --git a/app/controllers/admin/banners_controller.rb b/app/controllers/admin/banners_controller.rb index 1a486bb56..fed5fe8c8 100644 --- a/app/controllers/admin/banners_controller.rb +++ b/app/controllers/admin/banners_controller.rb @@ -1,7 +1,7 @@ class Admin::BannersController < Admin::BaseController include Translatable - has_filters %w{all with_active with_inactive}, only: :index + has_filters %w[all with_active with_inactive], only: :index before_action :banner_sections, only: [:edit, :new, :create, :update] diff --git a/app/controllers/admin/budgets_controller.rb b/app/controllers/admin/budgets_controller.rb index fdfaaf017..aac0f979e 100644 --- a/app/controllers/admin/budgets_controller.rb +++ b/app/controllers/admin/budgets_controller.rb @@ -4,7 +4,7 @@ class Admin::BudgetsController < Admin::BaseController include FeatureFlags feature_flag :budgets - has_filters %w{open finished}, only: :index + has_filters %w[open finished], only: :index before_action :load_budget, except: [:index, :new, :create] load_and_authorize_resource diff --git a/app/controllers/admin/hidden_budget_investments_controller.rb b/app/controllers/admin/hidden_budget_investments_controller.rb index f34818361..08b95dffc 100644 --- a/app/controllers/admin/hidden_budget_investments_controller.rb +++ b/app/controllers/admin/hidden_budget_investments_controller.rb @@ -1,7 +1,7 @@ class Admin::HiddenBudgetInvestmentsController < Admin::BaseController include FeatureFlags - has_filters %w{all with_confirmed_hide without_confirmed_hide}, only: :index + has_filters %w[all with_confirmed_hide without_confirmed_hide], only: :index feature_flag :budgets diff --git a/app/controllers/admin/hidden_comments_controller.rb b/app/controllers/admin/hidden_comments_controller.rb index 561fe3aef..e17926b36 100644 --- a/app/controllers/admin/hidden_comments_controller.rb +++ b/app/controllers/admin/hidden_comments_controller.rb @@ -1,5 +1,5 @@ class Admin::HiddenCommentsController < Admin::BaseController - has_filters %w{without_confirmed_hide all with_confirmed_hide} + has_filters %w[without_confirmed_hide all with_confirmed_hide] before_action :load_comment, only: [:confirm_hide, :restore] diff --git a/app/controllers/admin/hidden_debates_controller.rb b/app/controllers/admin/hidden_debates_controller.rb index 3e93db0a6..84374f63c 100644 --- a/app/controllers/admin/hidden_debates_controller.rb +++ b/app/controllers/admin/hidden_debates_controller.rb @@ -3,7 +3,7 @@ class Admin::HiddenDebatesController < Admin::BaseController feature_flag :debates - has_filters %w{without_confirmed_hide all with_confirmed_hide}, only: :index + has_filters %w[without_confirmed_hide all with_confirmed_hide], only: :index before_action :load_debate, only: [:confirm_hide, :restore] diff --git a/app/controllers/admin/hidden_users_controller.rb b/app/controllers/admin/hidden_users_controller.rb index 8237b7fd4..6035d5804 100644 --- a/app/controllers/admin/hidden_users_controller.rb +++ b/app/controllers/admin/hidden_users_controller.rb @@ -1,5 +1,5 @@ class Admin::HiddenUsersController < Admin::BaseController - has_filters %w{without_confirmed_hide all with_confirmed_hide}, only: :index + has_filters %w[without_confirmed_hide all with_confirmed_hide], only: :index before_action :load_user, only: [:confirm_hide, :restore] diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index 9c26147e2..117d7037a 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -1,5 +1,5 @@ class Admin::OrganizationsController < Admin::BaseController - has_filters %w{pending all verified rejected}, only: :index + has_filters %w[pending all verified rejected], only: :index load_and_authorize_resource except: :search diff --git a/app/controllers/admin/proposal_notifications_controller.rb b/app/controllers/admin/proposal_notifications_controller.rb index 1fee9a055..f83cb1580 100644 --- a/app/controllers/admin/proposal_notifications_controller.rb +++ b/app/controllers/admin/proposal_notifications_controller.rb @@ -1,6 +1,6 @@ class Admin::ProposalNotificationsController < Admin::BaseController - has_filters %w{without_confirmed_hide all with_confirmed_hide}, only: :index + has_filters %w[without_confirmed_hide all with_confirmed_hide], only: :index before_action :load_proposal, only: [:confirm_hide, :restore] diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index 5a57dd1f4..18127079b 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -30,7 +30,7 @@ module Budgets feature_flag :budgets - has_orders %w{most_voted newest oldest}, only: :show + has_orders %w[most_voted newest oldest], only: :show has_orders ->(c) { c.instance_variable_get(:@budget).investments_orders }, only: :index valid_filters = %w[not_unfeasible feasible unfeasible unselected selected winners] diff --git a/app/controllers/communities_controller.rb b/app/controllers/communities_controller.rb index fc8298d41..040272fc5 100644 --- a/app/controllers/communities_controller.rb +++ b/app/controllers/communities_controller.rb @@ -1,5 +1,5 @@ class CommunitiesController < ApplicationController - TOPIC_ORDERS = %w{newest most_commented oldest}.freeze + TOPIC_ORDERS = %w[newest most_commented oldest].freeze before_action :set_order, :set_community, :load_topics, :load_participants has_orders TOPIC_ORDERS diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index c0def9803..b83f2ddc2 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -14,7 +14,7 @@ class DebatesController < ApplicationController invisible_captcha only: [:create, :update], honeypot: :subtitle has_orders ->(c) { Debate.debates_orders(c.current_user) }, only: :index - has_orders %w{most_voted newest oldest}, only: :show + has_orders %w[most_voted newest oldest], only: :show load_and_authorize_resource helper_method :resource_model, :resource_name diff --git a/app/controllers/legislation/proposals_controller.rb b/app/controllers/legislation/proposals_controller.rb index 944a4f6aa..4db3b0e72 100644 --- a/app/controllers/legislation/proposals_controller.rb +++ b/app/controllers/legislation/proposals_controller.rb @@ -13,8 +13,8 @@ class Legislation::ProposalsController < Legislation::BaseController invisible_captcha only: [:create, :update], honeypot: :subtitle - has_orders %w{confidence_score created_at}, only: :index - has_orders %w{most_voted newest oldest}, only: :show + has_orders %w[confidence_score created_at], only: :index + has_orders %w[most_voted newest oldest], only: :show helper_method :resource_model, :resource_name respond_to :html, :js diff --git a/app/controllers/legislation/questions_controller.rb b/app/controllers/legislation/questions_controller.rb index d50443281..7ee66fd64 100644 --- a/app/controllers/legislation/questions_controller.rb +++ b/app/controllers/legislation/questions_controller.rb @@ -2,7 +2,7 @@ class Legislation::QuestionsController < Legislation::BaseController load_and_authorize_resource :process load_and_authorize_resource :question, through: :process - has_orders %w{most_voted newest oldest}, only: :show + has_orders %w[most_voted newest oldest], only: :show def show @commentable = @question diff --git a/app/controllers/moderation/budgets/investments_controller.rb b/app/controllers/moderation/budgets/investments_controller.rb index a56534259..8944c78fa 100644 --- a/app/controllers/moderation/budgets/investments_controller.rb +++ b/app/controllers/moderation/budgets/investments_controller.rb @@ -2,8 +2,8 @@ class Moderation::Budgets::InvestmentsController < Moderation::BaseController include FeatureFlags include ModerateActions - has_filters %w{pending_flag_review all with_ignored_flag}, only: :index - has_orders %w{flags created_at}, only: :index + has_filters %w[pending_flag_review all with_ignored_flag], only: :index + has_orders %w[flags created_at], only: :index feature_flag :budgets diff --git a/app/controllers/moderation/comments_controller.rb b/app/controllers/moderation/comments_controller.rb index d5fbf7954..6a93108ba 100644 --- a/app/controllers/moderation/comments_controller.rb +++ b/app/controllers/moderation/comments_controller.rb @@ -1,8 +1,8 @@ class Moderation::CommentsController < Moderation::BaseController include ModerateActions - has_filters %w{pending_flag_review all with_ignored_flag}, only: :index - has_orders %w{flags newest}, only: :index + has_filters %w[pending_flag_review all with_ignored_flag], only: :index + has_orders %w[flags newest], only: :index before_action :load_resources, only: [:index, :moderate] diff --git a/app/controllers/moderation/debates_controller.rb b/app/controllers/moderation/debates_controller.rb index aaa3d9f89..a85d300d2 100644 --- a/app/controllers/moderation/debates_controller.rb +++ b/app/controllers/moderation/debates_controller.rb @@ -2,8 +2,8 @@ class Moderation::DebatesController < Moderation::BaseController include ModerateActions include FeatureFlags - has_filters %w{pending_flag_review all with_ignored_flag}, only: :index - has_orders %w{flags created_at}, only: :index + has_filters %w[pending_flag_review all with_ignored_flag], only: :index + has_orders %w[flags created_at], only: :index feature_flag :debates diff --git a/app/controllers/moderation/proposal_notifications_controller.rb b/app/controllers/moderation/proposal_notifications_controller.rb index d36e0614e..abd680d5f 100644 --- a/app/controllers/moderation/proposal_notifications_controller.rb +++ b/app/controllers/moderation/proposal_notifications_controller.rb @@ -1,8 +1,8 @@ class Moderation::ProposalNotificationsController < Moderation::BaseController include ModerateActions - has_filters %w{pending_review all ignored}, only: :index - has_orders %w{created_at moderated}, only: :index + has_filters %w[pending_review all ignored], only: :index + has_orders %w[created_at moderated], only: :index before_action :load_resources, only: [:index, :moderate] diff --git a/app/controllers/moderation/proposals_controller.rb b/app/controllers/moderation/proposals_controller.rb index f15aca85d..6d358c1bf 100644 --- a/app/controllers/moderation/proposals_controller.rb +++ b/app/controllers/moderation/proposals_controller.rb @@ -2,8 +2,8 @@ class Moderation::ProposalsController < Moderation::BaseController include ModerateActions include FeatureFlags - has_filters %w{pending_flag_review all with_ignored_flag}, only: :index - has_orders %w{flags created_at}, only: :index + has_filters %w[pending_flag_review all with_ignored_flag], only: :index + has_orders %w[flags created_at], only: :index feature_flag :proposals diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index f3f0dd7ef..1c7b4732e 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -4,7 +4,7 @@ class TopicsController < ApplicationController before_action :load_community before_action :load_topic, only: [:show, :edit, :update, :destroy] - has_orders %w{most_voted newest oldest}, only: :show + has_orders %w[most_voted newest oldest], only: :show skip_authorization_check only: :show load_and_authorize_resource except: :show diff --git a/app/controllers/tracking/budget_investments_controller.rb b/app/controllers/tracking/budget_investments_controller.rb index 65afda323..946f61143 100644 --- a/app/controllers/tracking/budget_investments_controller.rb +++ b/app/controllers/tracking/budget_investments_controller.rb @@ -8,7 +8,7 @@ class Tracking::BudgetInvestmentsController < Tracking::BaseController before_action :load_budget before_action :load_investment, only: [:show, :edit] - has_orders %w{oldest}, only: [:show, :edit] + has_orders %w[oldest], only: [:show, :edit] load_and_authorize_resource :investment, class: "Budget::Investment" diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 905bcf8c8..690b74f68 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ class UsersController < ApplicationController - has_filters %w{proposals debates budget_investments comments follows}, only: :show + has_filters %w[proposals debates budget_investments comments follows], only: :show load_and_authorize_resource helper_method :author? diff --git a/app/controllers/valuation/budget_investments_controller.rb b/app/controllers/valuation/budget_investments_controller.rb index 66398f14f..6c33a2766 100644 --- a/app/controllers/valuation/budget_investments_controller.rb +++ b/app/controllers/valuation/budget_investments_controller.rb @@ -9,8 +9,8 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController before_action :load_budget before_action :load_investment, only: [:show, :edit, :valuate] - has_orders %w{oldest}, only: [:show, :edit] - has_filters %w{valuating valuation_finished}, only: :index + has_orders %w[oldest], only: [:show, :edit] + has_filters %w[valuating valuation_finished], only: :index load_and_authorize_resource :investment, class: "Budget::Investment" diff --git a/app/models/activity.rb b/app/models/activity.rb index ed617c97a..1bc3851b8 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -2,7 +2,7 @@ class Activity < ApplicationRecord belongs_to :actionable, -> { with_hidden }, polymorphic: true belongs_to :user, -> { with_hidden } - VALID_ACTIONS = %w(hide block restore valuate email) + VALID_ACTIONS = %w[hide block restore valuate email] validates :action, inclusion: {in: VALID_ACTIONS} diff --git a/app/models/budget.rb b/app/models/budget.rb index c4fe62eeb..5928209cf 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -20,7 +20,7 @@ class Budget < ApplicationRecord end end - CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze + CURRENCY_SYMBOLS = %w[€ $ £ ¥].freeze validates_translation :name, presence: true validates :phase, inclusion: { in: Budget::Phase::PHASE_KINDS } @@ -173,13 +173,13 @@ class Budget < ApplicationRecord def investments_orders case phase when "accepting", "reviewing" - %w{random} + %w[random] when "publishing_prices", "balloting", "reviewing_ballots" - %w{random price} + %w[random price] when "finished" - %w{random} + %w[random] else - %w{random confidence_score} + %w[random confidence_score] end end diff --git a/app/models/budget/phase.rb b/app/models/budget/phase.rb index 56d125d1d..ccaf2f78d 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -1,8 +1,8 @@ class Budget class Phase < ApplicationRecord - PHASE_KINDS = %w(drafting informing accepting reviewing selecting valuating publishing_prices balloting - reviewing_ballots finished).freeze - PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze + PHASE_KINDS = %w[drafting informing accepting reviewing selecting valuating publishing_prices balloting + reviewing_ballots finished].freeze + PUBLISHED_PRICES_PHASES = %w[publishing_prices balloting reviewing_ballots finished].freeze SUMMARY_MAX_LENGTH = 1000 DESCRIPTION_MAX_LENGTH = 2000 diff --git a/app/models/budget/reclassified_vote.rb b/app/models/budget/reclassified_vote.rb index 6fceb4707..6b3ad99d8 100644 --- a/app/models/budget/reclassified_vote.rb +++ b/app/models/budget/reclassified_vote.rb @@ -1,6 +1,6 @@ class Budget class ReclassifiedVote < ApplicationRecord - REASONS = %w(heading_changed unfeasible) + REASONS = %w[heading_changed unfeasible] belongs_to :user belongs_to :investment diff --git a/app/models/debate.rb b/app/models/debate.rb index b3a23200a..152059eaf 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -161,7 +161,7 @@ class Debate < ApplicationRecord end def self.debates_orders(user) - orders = %w{hot_score confidence_score created_at relevance} + orders = %w[hot_score confidence_score created_at relevance] orders << "recommendations" if Setting["feature.user.recommendations_on_debates"] && user&.recommended_debates return orders end diff --git a/app/models/legislation/draft_version.rb b/app/models/legislation/draft_version.rb index 57f1039a4..56a42fd07 100644 --- a/app/models/legislation/draft_version.rb +++ b/app/models/legislation/draft_version.rb @@ -1,5 +1,5 @@ class Legislation::DraftVersion < ApplicationRecord - VALID_STATUSES = %w(draft published) + VALID_STATUSES = %w[draft published] acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/poll/partial_result.rb b/app/models/poll/partial_result.rb index 036e80b75..23821bd60 100644 --- a/app/models/poll/partial_result.rb +++ b/app/models/poll/partial_result.rb @@ -1,6 +1,6 @@ class Poll::PartialResult < ApplicationRecord - VALID_ORIGINS = %w{web booth} + VALID_ORIGINS = %w[web booth] belongs_to :question, -> { with_hidden } belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" diff --git a/app/models/poll/recount.rb b/app/models/poll/recount.rb index 9cd744cc0..56fe36889 100644 --- a/app/models/poll/recount.rb +++ b/app/models/poll/recount.rb @@ -1,6 +1,6 @@ class Poll::Recount < ApplicationRecord - VALID_ORIGINS = %w{web booth letter}.freeze + VALID_ORIGINS = %w[web booth letter].freeze belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" belongs_to :booth_assignment diff --git a/app/models/related_content.rb b/app/models/related_content.rb index 4a74ba3c7..1ac79beec 100644 --- a/app/models/related_content.rb +++ b/app/models/related_content.rb @@ -1,6 +1,6 @@ class RelatedContent < ApplicationRecord RELATED_CONTENT_SCORE_THRESHOLD = Setting["related_content_score_threshold"].to_f - RELATIONABLE_MODELS = %w{proposals debates budgets investments}.freeze + RELATIONABLE_MODELS = %w[proposals debates budgets investments].freeze acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/signature.rb b/app/models/signature.rb index a3b58fc08..584f69567 100644 --- a/app/models/signature.rb +++ b/app/models/signature.rb @@ -93,7 +93,7 @@ class Signature < ApplicationRecord end def document_types - %w(1 2 3 4) + %w[1 2 3 4] end end diff --git a/app/models/signature_sheet.rb b/app/models/signature_sheet.rb index c7d102dca..beaeb4caa 100644 --- a/app/models/signature_sheet.rb +++ b/app/models/signature_sheet.rb @@ -2,7 +2,7 @@ class SignatureSheet < ApplicationRecord belongs_to :signable, polymorphic: true belongs_to :author, class_name: "User", foreign_key: "author_id" - VALID_SIGNABLES = %w(Proposal Budget::Investment) + VALID_SIGNABLES = %w[Proposal Budget::Investment] has_many :signatures diff --git a/app/models/widget/feed.rb b/app/models/widget/feed.rb index 553d35db6..c0a18cfc4 100644 --- a/app/models/widget/feed.rb +++ b/app/models/widget/feed.rb @@ -1,7 +1,7 @@ class Widget::Feed < ApplicationRecord self.table_name = "widget_feeds" - KINDS = %w(proposals debates processes) + KINDS = %w[proposals debates processes] def active? setting.value.present? diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index e535c9d44..fa135908b 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -58,7 +58,7 @@ <%= t("admin.menu.title_booths") %>
      > -
    • > +
    • > <%= link_to t("admin.menu.poll_officers"), admin_officers_path %>
    • @@ -74,8 +74,8 @@ <%= link_to t("admin.menu.poll_booth_assignments"), booth_assignments_admin_polls_path %> -
    • > +
    • > <%= link_to t("admin.menu.poll_shifts"), available_admin_booths_path %>
    @@ -90,7 +90,7 @@ <% end %> - <% messages_sections = %w(newsletters emails_download admin_notifications system_emails) %> + <% messages_sections = %w[newsletters emails_download admin_notifications system_emails] %> <% messages_menu_active = messages_sections.include?(controller_name) %>
  • > diff --git a/config/deploy.rb b/config/deploy.rb index 602e86ae1..9501436a2 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -21,8 +21,8 @@ set :log_level, :info set :pty, true set :use_sudo, false -set :linked_files, %w{config/database.yml config/secrets.yml config/unicorn.rb config/environments/production.rb} -set :linked_dirs, %w{log tmp public/system public/assets public/ckeditor_assets} +set :linked_files, %w[config/database.yml config/secrets.yml config/unicorn.rb config/environments/production.rb] +set :linked_dirs, %w[log tmp public/system public/assets public/ckeditor_assets] set :keep_releases, 5 @@ -31,12 +31,12 @@ set :local_user, ENV["USER"] set :delayed_job_workers, 2 set :delayed_job_roles, :background -set(:config_files, %w( +set(:config_files, %w[ log_rotation database.yml secrets.yml unicorn.rb -)) +]) set :whenever_roles, -> { :app } diff --git a/config/deploy/preproduction.rb b/config/deploy/preproduction.rb index 27fdf021d..f7b2ade9f 100644 --- a/config/deploy/preproduction.rb +++ b/config/deploy/preproduction.rb @@ -6,5 +6,5 @@ set :ssh_options, port: deploysecret(:ssh_port) set :stage, :preproduction set :rails_env, :preproduction -server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer cron background) -server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer) +server deploysecret(:server1), user: deploysecret(:user), roles: %w[web app db importer cron background] +server deploysecret(:server2), user: deploysecret(:user), roles: %w[web app db importer] diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 14ae536ac..6f1524a8c 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -6,7 +6,7 @@ set :ssh_options, port: deploysecret(:ssh_port) set :stage, :production set :rails_env, :production -server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer cron background) +server deploysecret(:server1), user: deploysecret(:user), roles: %w[web app db importer cron background] #server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer cron background) #server deploysecret(:server3), user: deploysecret(:user), roles: %w(web app db importer) #server deploysecret(:server4), user: deploysecret(:user), roles: %w(web app db importer) diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 8fc1b4630..fe873d00e 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -6,4 +6,4 @@ set :ssh_options, port: deploysecret(:ssh_port) set :stage, :staging set :rails_env, :staging -server deploysecret(:server), user: deploysecret(:user), roles: %w(web app db importer cron) +server deploysecret(:server), user: deploysecret(:user), roles: %w[web app db importer cron] diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 30f4b1bf7..1a326e763 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,12 +9,12 @@ Rails.application.config.assets.version = "1.0" # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js ) -Rails.application.config.assets.precompile += %w( ckeditor/config.js ) -Rails.application.config.assets.precompile += %w( ie_lt9.js ) -Rails.application.config.assets.precompile += %w( stat_graphs.js ) -Rails.application.config.assets.precompile += %w( dashboard_graphs.js ) -Rails.application.config.assets.precompile += %w( print.css ) -Rails.application.config.assets.precompile += %w( ie.css ) -Rails.application.config.assets.precompile += %w( pdf_fonts.css ) +Rails.application.config.assets.precompile += %w[ckeditor/config.js] +Rails.application.config.assets.precompile += %w[ie_lt9.js] +Rails.application.config.assets.precompile += %w[stat_graphs.js] +Rails.application.config.assets.precompile += %w[dashboard_graphs.js] +Rails.application.config.assets.precompile += %w[print.css] +Rails.application.config.assets.precompile += %w[ie.css] +Rails.application.config.assets.precompile += %w[pdf_fonts.css] # Loads custom images and custom fonts before app/assets/images and app/assets/fonts diff --git a/config/initializers/social_share_button.rb b/config/initializers/social_share_button.rb index 6ee0fa0ed..f28cd2933 100644 --- a/config/initializers/social_share_button.rb +++ b/config/initializers/social_share_button.rb @@ -1,3 +1,3 @@ SocialShareButton.configure do |config| - config.allow_sites = %w(twitter facebook google_plus telegram) + config.allow_sites = %w[twitter facebook google_plus telegram] end diff --git a/config/spring.rb b/config/spring.rb index c9119b40c..9fa7863f9 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,6 +1,6 @@ -%w( +%w[ .ruby-version .rbenv-vars tmp/restart.txt tmp/caching-dev.txt -).each { |path| Spring.watch(path) } +].each { |path| Spring.watch(path) } diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index e61b9e056..d45599d68 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -944,7 +944,7 @@ describe "Budget Investments" do scenario "Show up to 5 suggestions", :js do login_as(author) - %w(first second third fourth fifth sixth).each do |ordinal| + %w[first second third fourth fifth sixth].each do |ordinal| create(factory, title: "#{ordinal.titleize} #{factory}, has search term", budget: budget) end create(factory, title: "This is the last #{factory}", budget: budget) @@ -960,7 +960,7 @@ describe "Budget Investments" do scenario "No found suggestions", :js do login_as(author) - %w(first second third fourth fifth sixth).each do |ordinal| + %w[first second third fourth fifth sixth].each do |ordinal| create(factory, title: "#{ordinal.titleize} #{factory}, has search term", budget: budget) end @@ -975,7 +975,7 @@ describe "Budget Investments" do scenario "Don't show suggestions from a different budget", :js do login_as(author) - %w(first second third fourth fifth sixth).each do |ordinal| + %w[first second third fourth fifth sixth].each do |ordinal| create(factory, title: "#{ordinal.titleize} #{factory}, has search term", budget: budget) end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 4a6c3b4de..4f8a1c904 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -890,7 +890,7 @@ describe "Proposals" do expect(page).not_to have_content archived_proposal.title end - orders = %w{hot_score confidence_score created_at relevance} + orders = %w[hot_score confidence_score created_at relevance] orders.each do |order| visit proposals_path(order: order) diff --git a/spec/lib/document_parser_spec.rb b/spec/lib/document_parser_spec.rb index 631983abc..d4b2d34da 100644 --- a/spec/lib/document_parser_spec.rb +++ b/spec/lib/document_parser_spec.rb @@ -23,7 +23,7 @@ describe DocumentParser do end it "adds upper and lowercase letter when the letter is present" do - expect(DocumentParser.get_document_number_variants(1, "1234567A")).to eq(%w(1234567 01234567 1234567a 1234567A 01234567a 01234567A)) + expect(DocumentParser.get_document_number_variants(1, "1234567A")).to eq(%w[1234567 01234567 1234567a 1234567A 01234567a 01234567A]) end end diff --git a/spec/lib/tag_sanitizer_spec.rb b/spec/lib/tag_sanitizer_spec.rb index db269dddd..dc7c9e626 100644 --- a/spec/lib/tag_sanitizer_spec.rb +++ b/spec/lib/tag_sanitizer_spec.rb @@ -22,7 +22,7 @@ describe TagSanitizer do describe "#sanitize_tag_list" do it "returns a new tag list with sanitized tags" do - expect(subject.sanitize_tag_list(%w{x=1 y?z})).to eq(%w(x1 yz)) + expect(subject.sanitize_tag_list(%w[x=1 y?z])).to eq(%w[x1 yz]) end end From e252d82cdb2f5aa7c9b7fac5bb4160a619fe76fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 18 Jun 2019 02:29:00 +0200 Subject: [PATCH 07/13] Apply `IndentationWidth` rubocop rule --- .../questions/answers/videos_controller.rb | 4 +- .../related_contents_controller.rb | 16 ++++---- app/helpers/welcome_helper.rb | 4 +- app/models/document.rb | 6 +-- lib/local_census.rb | 8 ++-- lib/migrations/reports.rb | 2 +- spec/factories/budgets.rb | 14 +++---- .../comments/budget_investments_spec.rb | 26 ++++++------ spec/features/comments/polls_spec.rb | 26 ++++++------ spec/features/comments/proposals_spec.rb | 26 ++++++------ spec/features/moderation/users_spec.rb | 6 +-- spec/features/tracks_spec.rb | 4 +- .../verification/verified_user_spec.rb | 2 +- spec/models/budget/investment_spec.rb | 40 +++++++++---------- spec/models/legislation/annotation_spec.rb | 2 +- spec/models/legislation/draft_version_spec.rb | 6 +-- spec/models/poll/voter_spec.rb | 4 +- spec/models/proposal_spec.rb | 4 +- spec/shared/features/mappable.rb | 2 +- spec/shared/features/nested_imageable.rb | 4 +- spec/shared/models/map_validations.rb | 32 +++++++-------- 21 files changed, 119 insertions(+), 119 deletions(-) diff --git a/app/controllers/admin/poll/questions/answers/videos_controller.rb b/app/controllers/admin/poll/questions/answers/videos_controller.rb index 7628ab081..3e76531d8 100644 --- a/app/controllers/admin/poll/questions/answers/videos_controller.rb +++ b/app/controllers/admin/poll/questions/answers/videos_controller.rb @@ -34,9 +34,9 @@ class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseContr def destroy notice = if @video.destroy - t("flash.actions.destroy.poll_question_answer_video") + t("flash.actions.destroy.poll_question_answer_video") else - t("flash.actions.destroy.error") + t("flash.actions.destroy.error") end redirect_back(fallback_location: (request.referrer || root_path), notice: notice) end diff --git a/app/controllers/related_contents_controller.rb b/app/controllers/related_contents_controller.rb index 0c31d5f69..ae18564b9 100644 --- a/app/controllers/related_contents_controller.rb +++ b/app/controllers/related_contents_controller.rb @@ -46,16 +46,16 @@ class RelatedContentsController < ApplicationController end def related_object - if valid_url? - url = params[:url] + if valid_url? + url = params[:url] - related_klass = url.scan(/\/(#{RelatedContent::RELATIONABLE_MODELS.join("|")})\//) - .flatten.map { |i| i.to_s.singularize.camelize }.join("::") - related_id = url.match(/\/(\d+)(?!.*\/\d)/)[1] + related_klass = url.scan(/\/(#{RelatedContent::RELATIONABLE_MODELS.join("|")})\//) + .flatten.map { |i| i.to_s.singularize.camelize }.join("::") + related_id = url.match(/\/(\d+)(?!.*\/\d)/)[1] - @related = related_klass.singularize.camelize.constantize.find_by(id: related_id) - end + @related = related_klass.singularize.camelize.constantize.find_by(id: related_id) + end rescue - nil + nil end end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index fa729492e..8f674574c 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -48,9 +48,9 @@ module WelcomeHelper def calculate_offset(debates, proposals, apply_offset) if debates.any? && proposals.any? offset = if apply_offset - "medium-offset-2 large-offset-2" + "medium-offset-2 large-offset-2" else - "end" + "end" end end end diff --git a/app/models/document.rb b/app/models/document.rb index 3edf203d6..67c220e64 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -60,11 +60,11 @@ class Document < ApplicationRecord def custom_hash_data(attachment) original_filename = if !attachment.instance.persisted? && attachment.instance.remove - attachment.instance.original_filename + attachment.instance.original_filename elsif !attachment.instance.persisted? - attachment.instance.attachment_file_name + attachment.instance.attachment_file_name else - attachment.instance.title + attachment.instance.title end "#{attachment.instance.user_id}/#{original_filename}" end diff --git a/lib/local_census.rb b/lib/local_census.rb index fc309730a..1ff5112a5 100644 --- a/lib/local_census.rb +++ b/lib/local_census.rb @@ -28,9 +28,9 @@ class LocalCensus end def district_code - @body.district_code + @body.district_code rescue - nil + nil end def gender @@ -45,9 +45,9 @@ class LocalCensus end def name - "#{@body.nombre} #{@body.apellido1}" + "#{@body.nombre} #{@body.apellido1}" rescue - nil + nil end private diff --git a/lib/migrations/reports.rb b/lib/migrations/reports.rb index 7a378a126..31a57eade 100644 --- a/lib/migrations/reports.rb +++ b/lib/migrations/reports.rb @@ -15,7 +15,7 @@ class Migrations::Reports stats: poll.read_attribute(:stats_enabled), advanced_stats: poll.read_attribute(:stats_enabled), ) - end + end end diff --git a/spec/factories/budgets.rb b/spec/factories/budgets.rb index cecefbc2e..cfb5e9574 100644 --- a/spec/factories/budgets.rb +++ b/spec/factories/budgets.rb @@ -159,14 +159,14 @@ FactoryBot.define do end trait :flagged do - after :create do |investment| - Flag.flag(create(:user), investment) - end - end + after :create do |investment| + Flag.flag(create(:user), investment) + end + end - trait :with_confirmed_hide do - confirmed_hide_at { Time.current } - end + trait :with_confirmed_hide do + confirmed_hide_at { Time.current } + end trait :with_milestone_tags do after(:create) { |investment| investment.milestone_tags << create(:tag, :milestone) } diff --git a/spec/features/comments/budget_investments_spec.rb b/spec/features/comments/budget_investments_spec.rb index b171d5b88..9e09f6de9 100644 --- a/spec/features/comments/budget_investments_spec.rb +++ b/spec/features/comments/budget_investments_spec.rb @@ -115,25 +115,25 @@ describe "Commenting Budget::Investments" do end scenario "Creation date works differently in roots and in child comments, when sorting by confidence_score" do - old_root = create(:comment, commentable: investment, created_at: Time.current - 10) - new_root = create(:comment, commentable: investment, created_at: Time.current) - old_child = create(:comment, commentable: investment, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: investment, parent_id: new_root.id, created_at: Time.current) + old_root = create(:comment, commentable: investment, created_at: Time.current - 10) + new_root = create(:comment, commentable: investment, created_at: Time.current) + old_child = create(:comment, commentable: investment, parent_id: new_root.id, created_at: Time.current - 10) + new_child = create(:comment, commentable: investment, parent_id: new_root.id, created_at: Time.current) - visit budget_investment_path(investment.budget, investment, order: :most_voted) + visit budget_investment_path(investment.budget, investment, order: :most_voted) - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) + expect(new_root.body).to appear_before(old_root.body) + expect(old_child.body).to appear_before(new_child.body) - visit budget_investment_path(investment.budget, investment, order: :newest) + visit budget_investment_path(investment.budget, investment, order: :newest) - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) + expect(new_root.body).to appear_before(old_root.body) + expect(new_child.body).to appear_before(old_child.body) - visit budget_investment_path(investment.budget, investment, order: :oldest) + visit budget_investment_path(investment.budget, investment, order: :oldest) - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) + expect(old_root.body).to appear_before(new_root.body) + expect(old_child.body).to appear_before(new_child.body) end scenario "Turns links into html links" do diff --git a/spec/features/comments/polls_spec.rb b/spec/features/comments/polls_spec.rb index 8a1fb1b27..6b0f84761 100644 --- a/spec/features/comments/polls_spec.rb +++ b/spec/features/comments/polls_spec.rb @@ -111,25 +111,25 @@ describe "Commenting polls" do end scenario "Creation date works differently in roots and in child comments, when sorting by confidence_score" do - old_root = create(:comment, commentable: poll, created_at: Time.current - 10) - new_root = create(:comment, commentable: poll, created_at: Time.current) - old_child = create(:comment, commentable: poll, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: poll, parent_id: new_root.id, created_at: Time.current) + old_root = create(:comment, commentable: poll, created_at: Time.current - 10) + new_root = create(:comment, commentable: poll, created_at: Time.current) + old_child = create(:comment, commentable: poll, parent_id: new_root.id, created_at: Time.current - 10) + new_child = create(:comment, commentable: poll, parent_id: new_root.id, created_at: Time.current) - visit poll_path(poll, order: :most_voted) + visit poll_path(poll, order: :most_voted) - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) + expect(new_root.body).to appear_before(old_root.body) + expect(old_child.body).to appear_before(new_child.body) - visit poll_path(poll, order: :newest) + visit poll_path(poll, order: :newest) - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) + expect(new_root.body).to appear_before(old_root.body) + expect(new_child.body).to appear_before(old_child.body) - visit poll_path(poll, order: :oldest) + visit poll_path(poll, order: :oldest) - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) + expect(old_root.body).to appear_before(new_root.body) + expect(old_child.body).to appear_before(new_child.body) end scenario "Turns links into html links" do diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb index 9c0ae0cb3..e5e84d183 100644 --- a/spec/features/comments/proposals_spec.rb +++ b/spec/features/comments/proposals_spec.rb @@ -109,25 +109,25 @@ describe "Commenting proposals" do end scenario "Creation date works differently in roots and in child comments, when sorting by confidence_score" do - old_root = create(:comment, commentable: proposal, created_at: Time.current - 10) - new_root = create(:comment, commentable: proposal, created_at: Time.current) - old_child = create(:comment, commentable: proposal, parent_id: new_root.id, created_at: Time.current - 10) - new_child = create(:comment, commentable: proposal, parent_id: new_root.id, created_at: Time.current) + old_root = create(:comment, commentable: proposal, created_at: Time.current - 10) + new_root = create(:comment, commentable: proposal, created_at: Time.current) + old_child = create(:comment, commentable: proposal, parent_id: new_root.id, created_at: Time.current - 10) + new_child = create(:comment, commentable: proposal, parent_id: new_root.id, created_at: Time.current) - visit proposal_path(proposal, order: :most_voted) + visit proposal_path(proposal, order: :most_voted) - expect(new_root.body).to appear_before(old_root.body) - expect(old_child.body).to appear_before(new_child.body) + expect(new_root.body).to appear_before(old_root.body) + expect(old_child.body).to appear_before(new_child.body) - visit proposal_path(proposal, order: :newest) + visit proposal_path(proposal, order: :newest) - expect(new_root.body).to appear_before(old_root.body) - expect(new_child.body).to appear_before(old_child.body) + expect(new_root.body).to appear_before(old_root.body) + expect(new_child.body).to appear_before(old_child.body) - visit proposal_path(proposal, order: :oldest) + visit proposal_path(proposal, order: :oldest) - expect(old_root.body).to appear_before(new_root.body) - expect(old_child.body).to appear_before(new_child.body) + expect(old_root.body).to appear_before(new_root.body) + expect(old_child.body).to appear_before(new_child.body) end scenario "Turns links into html links" do diff --git a/spec/features/moderation/users_spec.rb b/spec/features/moderation/users_spec.rb index 6fc04cff2..845106f7f 100644 --- a/spec/features/moderation/users_spec.rb +++ b/spec/features/moderation/users_spec.rb @@ -63,9 +63,9 @@ describe "Moderate users" do click_button "Search" within("#moderation_users") do - expect(page).to have_content citizen.name - expect(page).not_to have_content "Blocked" - click_link "Block" + expect(page).to have_content citizen.name + expect(page).not_to have_content "Blocked" + click_link "Block" end within("#moderation_users") do diff --git a/spec/features/tracks_spec.rb b/spec/features/tracks_spec.rb index 70538cb03..b866a3fbb 100644 --- a/spec/features/tracks_spec.rb +++ b/spec/features/tracks_spec.rb @@ -4,11 +4,11 @@ describe "Tracking" do context "Custom variable" do - scenario "Usertype anonymous" do + scenario "Usertype anonymous" do visit proposals_path expect(page.html).to include "anonymous" - end + end scenario "Usertype level_1_user" do create(:geozone) diff --git a/spec/features/verification/verified_user_spec.rb b/spec/features/verification/verified_user_spec.rb index 8a9e1c936..579629a62 100644 --- a/spec/features/verification/verified_user_spec.rb +++ b/spec/features/verification/verified_user_spec.rb @@ -82,7 +82,7 @@ describe "Verified users" do visit verified_user_path within("#verified_user_#{verified_user.id}_email") do - click_button "Send code" + click_button "Send code" end expect(page).to have_content "We have sent a confirmation email to your account: rock@example.com" diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index b6c471925..f8bd836e9 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -104,14 +104,14 @@ describe Budget::Investment do describe "#code" do let(:investment) { create(:budget_investment) } - it "returns the proposal id" do - expect(investment.code).to include(investment.id.to_s) - end + it "returns the proposal id" do + expect(investment.code).to include(investment.id.to_s) + end - it "returns the administrator id when assigned" do - investment.administrator = create(:administrator) - expect(investment.code).to include("#{investment.id}-A#{investment.administrator.id}") - end + it "returns the administrator id when assigned" do + investment.administrator = create(:administrator) + expect(investment.code).to include("#{investment.id}-A#{investment.administrator.id}") + end end describe "#send_unfeasible_email" do @@ -307,24 +307,24 @@ describe Budget::Investment do describe "#by_budget" do it "returns investments scoped by budget" do - budget1 = create(:budget) - budget2 = create(:budget) + budget1 = create(:budget) + budget2 = create(:budget) - group1 = create(:budget_group, budget: budget1) - group2 = create(:budget_group, budget: budget2) + group1 = create(:budget_group, budget: budget1) + group2 = create(:budget_group, budget: budget2) - heading1 = create(:budget_heading, group: group1) - heading2 = create(:budget_heading, group: group2) + heading1 = create(:budget_heading, group: group1) + heading2 = create(:budget_heading, group: group2) - investment1 = create(:budget_investment, heading: heading1) - investment2 = create(:budget_investment, heading: heading1) - investment3 = create(:budget_investment, heading: heading2) + investment1 = create(:budget_investment, heading: heading1) + investment2 = create(:budget_investment, heading: heading1) + investment3 = create(:budget_investment, heading: heading2) - investments_by_budget = Budget::Investment.by_budget(budget1) + investments_by_budget = Budget::Investment.by_budget(budget1) - expect(investments_by_budget).to include investment1 - expect(investments_by_budget).to include investment2 - expect(investments_by_budget).not_to include investment3 + expect(investments_by_budget).to include investment1 + expect(investments_by_budget).to include investment2 + expect(investments_by_budget).not_to include investment3 end end diff --git a/spec/models/legislation/annotation_spec.rb b/spec/models/legislation/annotation_spec.rb index bd68ec5bf..676137716 100644 --- a/spec/models/legislation/annotation_spec.rb +++ b/spec/models/legislation/annotation_spec.rb @@ -1,4 +1,4 @@ - require "rails_helper" +require "rails_helper" RSpec.describe Legislation::Annotation, type: :model do let(:draft_version) { create(:legislation_draft_version) } diff --git a/spec/models/legislation/draft_version_spec.rb b/spec/models/legislation/draft_version_spec.rb index 0b8ceb451..5beb04a1b 100644 --- a/spec/models/legislation/draft_version_spec.rb +++ b/spec/models/legislation/draft_version_spec.rb @@ -29,7 +29,7 @@ describe Legislation::DraftVersion do end def body_markdown -<<-BODY_MARKDOWN + <<-BODY_MARKDOWN # Title 1 Some paragraph. @@ -50,7 +50,7 @@ BODY_MARKDOWN end def body_html -<<-BODY_HTML + <<-BODY_HTML

    Title 1

    Some paragraph.

    @@ -73,7 +73,7 @@ BODY_HTML end def toc_html -<<-TOC_HTML + <<-TOC_HTML
    • Title 1 diff --git a/spec/models/poll/voter_spec.rb b/spec/models/poll/voter_spec.rb index 3ebab9818..aab54eb42 100644 --- a/spec/models/poll/voter_spec.rb +++ b/spec/models/poll/voter_spec.rb @@ -25,9 +25,9 @@ describe Poll::Voter do end it "is valid if has not voted" do - voter = build(:poll_voter, :valid_document) + voter = build(:poll_voter, :valid_document) - expect(voter).to be_valid + expect(voter).to be_valid end it "is not valid if the user has already voted in the same poll or booth_assignment" do diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 40459fddf..f2661987a 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -88,14 +88,14 @@ describe Proposal do proposal.responsible_name = "12345678Z" end - it "is the document_number if level three user" do + it "is the document_number if level three user" do author = create(:user, :level_three, document_number: "12345678Z") proposal.author = author proposal.responsible_name = nil expect(proposal).to be_valid proposal.responsible_name = "12345678Z" - end + end it "is not updated when the author is deleted" do author = create(:user, :level_three, document_number: "12345678Z") diff --git a/spec/shared/features/mappable.rb b/spec/shared/features/mappable.rb index e9fff3662..1f211c9e6 100644 --- a/spec/shared/features/mappable.rb +++ b/spec/shared/features/mappable.rb @@ -283,6 +283,6 @@ end def set_arguments(arguments, mappable, mappable_path_arguments) mappable_path_arguments&.each do |argument_name, path_to_value| - arguments.merge!("#{argument_name}": mappable.send(path_to_value)) + arguments.merge!("#{argument_name}": mappable.send(path_to_value)) end end diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/features/nested_imageable.rb index 8f0493c4c..e84c7e2ba 100644 --- a/spec/shared/features/nested_imageable.rb +++ b/spec/shared/features/nested_imageable.rb @@ -16,7 +16,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, Setting["feature.allow_images"] = true imageable_path_arguments&.each do |argument_name, path_to_value| - arguments.merge!("#{argument_name}": imageable.send(path_to_value)) + arguments.merge!("#{argument_name}": imageable.send(path_to_value)) end imageable.update(author: user) if imageable.respond_to?(:author) @@ -176,7 +176,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, scenario "Should show successful notice when resource filled correctly without any nested images", :js do if has_many_images - skip "no need to test, there are no attributes for the parent resource" + skip "no need to test, there are no attributes for the parent resource" else login_as user visit send(path, arguments) diff --git a/spec/shared/models/map_validations.rb b/spec/shared/models/map_validations.rb index 8ec63af51..27f17167f 100644 --- a/spec/shared/models/map_validations.rb +++ b/spec/shared/models/map_validations.rb @@ -9,43 +9,43 @@ shared_examples "map validations" do end after do - Setting["feature.map"] = nil + Setting["feature.map"] = nil end it "is valid with a map location" do - mappable.map_location = build(:map_location) - mappable.skip_map = nil + mappable.map_location = build(:map_location) + mappable.skip_map = nil - expect(mappable).to be_valid + expect(mappable).to be_valid end it "is valid accepting that the mappable has no map" do - mappable.skip_map = "1" - mappable.map_location = nil + mappable.skip_map = "1" + mappable.map_location = nil - expect(mappable).to be_valid + expect(mappable).to be_valid end it "is valid when the feature map is deactivated" do - Setting["feature.map"] = nil + Setting["feature.map"] = nil - mappable.map_location = nil - mappable.skip_map = nil + mappable.map_location = nil + mappable.skip_map = nil - expect(mappable).to be_valid + expect(mappable).to be_valid end it "is not valid without a map location" do - mappable.map_location = nil - mappable.skip_map = nil + mappable.map_location = nil + mappable.skip_map = nil - expect(mappable).not_to be_valid + expect(mappable).not_to be_valid end it "is not valid without accepting that the mappable has no map" do - mappable.skip_map = nil + mappable.skip_map = nil - expect(mappable).not_to be_valid + expect(mappable).not_to be_valid end end From 47b2c42a1db5edd5b732cb01e3fd7186eec3810e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 18 Jun 2019 02:34:40 +0200 Subject: [PATCH 08/13] Apply `IndentationConsistency` rubocop rule --- .../admin/budget_phases_controller.rb | 14 +-- app/controllers/admin/debates_controller.rb | 6 +- .../admin/emails_download_controller.rb | 6 +- app/controllers/admin/homepage_controller.rb | 24 ++--- .../admin/milestone_statuses_controller.rb | 12 +-- app/controllers/communities_controller.rb | 36 +++---- app/controllers/direct_uploads_controller.rb | 10 +- app/controllers/follows_controller.rb | 12 +-- app/controllers/installation_controller.rb | 16 ++-- .../officing/ballot_sheets_controller.rb | 56 +++++------ app/controllers/officing/booth_controller.rb | 12 +-- .../related_contents_controller.rb | 52 +++++----- app/controllers/sandbox_controller.rb | 18 ++-- app/controllers/topics_controller.rb | 18 ++-- app/controllers/welcome_controller.rb | 8 +- app/helpers/flags_helper.rb | 24 ++--- app/helpers/map_locations_helper.rb | 38 ++++---- app/helpers/shifts_helper.rb | 6 +- app/mailers/devise_mailer.rb | 8 +- app/mailers/mailer.rb | 16 ++-- app/models/admin_notification.rb | 18 ++-- app/models/ahoy/data_source.rb | 18 ++-- app/models/budget.rb | 38 ++++---- app/models/budget/group.rb | 6 +- app/models/budget/heading.rb | 6 +- app/models/budget/investment/exporter.rb | 94 +++++++++---------- app/models/comment_notifier.rb | 32 +++---- app/models/community.rb | 24 ++--- app/models/concerns/search_cache.rb | 30 +++--- app/models/concerns/statisticable.rb | 72 +++++++------- app/models/direct_upload.rb | 24 ++--- app/models/newsletter.rb | 20 ++-- app/models/notification.rb | 18 ++-- app/models/proposal_notification.rb | 6 +- app/models/related_content.rb | 40 ++++---- lib/user_segments.rb | 12 +-- 36 files changed, 425 insertions(+), 425 deletions(-) diff --git a/app/controllers/admin/budget_phases_controller.rb b/app/controllers/admin/budget_phases_controller.rb index 3dd08675b..0979e852f 100644 --- a/app/controllers/admin/budget_phases_controller.rb +++ b/app/controllers/admin/budget_phases_controller.rb @@ -17,13 +17,13 @@ class Admin::BudgetPhasesController < Admin::BaseController private - def load_phase - @phase = Budget::Phase.find(params[:id]) - end + def load_phase + @phase = Budget::Phase.find(params[:id]) + end - def budget_phase_params - valid_attributes = [:starts_at, :ends_at, :enabled] - params.require(:budget_phase).permit(*valid_attributes, translation_params(Budget::Phase)) - end + def budget_phase_params + valid_attributes = [:starts_at, :ends_at, :enabled] + params.require(:budget_phase).permit(*valid_attributes, translation_params(Budget::Phase)) + end end diff --git a/app/controllers/admin/debates_controller.rb b/app/controllers/admin/debates_controller.rb index 44ac33926..05fee888a 100644 --- a/app/controllers/admin/debates_controller.rb +++ b/app/controllers/admin/debates_controller.rb @@ -13,8 +13,8 @@ class Admin::DebatesController < Admin::BaseController private - def resource_model - Debate - end + def resource_model + Debate + end end diff --git a/app/controllers/admin/emails_download_controller.rb b/app/controllers/admin/emails_download_controller.rb index 434dc071f..3bafa7668 100644 --- a/app/controllers/admin/emails_download_controller.rb +++ b/app/controllers/admin/emails_download_controller.rb @@ -12,7 +12,7 @@ class Admin::EmailsDownloadController < Admin::BaseController private - def users_segment_emails_csv(users_segment) - UserSegments.user_segment_emails(users_segment).join(",") - end + def users_segment_emails_csv(users_segment) + UserSegments.user_segment_emails(users_segment).join(",") + end end diff --git a/app/controllers/admin/homepage_controller.rb b/app/controllers/admin/homepage_controller.rb index 50a433df5..4c70827d4 100644 --- a/app/controllers/admin/homepage_controller.rb +++ b/app/controllers/admin/homepage_controller.rb @@ -9,20 +9,20 @@ class Admin::HomepageController < Admin::BaseController private - def load_header - @header = ::Widget::Card.header - end + def load_header + @header = ::Widget::Card.header + end - def load_recommendations - @recommendations = Setting.where(key: "feature.user.recommendations").first - end + def load_recommendations + @recommendations = Setting.where(key: "feature.user.recommendations").first + end - def load_cards - @cards = ::Widget::Card.body - end + def load_cards + @cards = ::Widget::Card.body + end - def load_feeds - @feeds = Widget::Feed.order("created_at") - end + def load_feeds + @feeds = Widget::Feed.order("created_at") + end end diff --git a/app/controllers/admin/milestone_statuses_controller.rb b/app/controllers/admin/milestone_statuses_controller.rb index b7cbb7b4d..f365629c0 100644 --- a/app/controllers/admin/milestone_statuses_controller.rb +++ b/app/controllers/admin/milestone_statuses_controller.rb @@ -41,11 +41,11 @@ class Admin::MilestoneStatusesController < Admin::BaseController private - def load_status - @status = Milestone::Status.find(params[:id]) - end + def load_status + @status = Milestone::Status.find(params[:id]) + end - def status_params - params.require(:milestone_status).permit([:name, :description]) - end + def status_params + params.require(:milestone_status).permit([:name, :description]) + end end diff --git a/app/controllers/communities_controller.rb b/app/controllers/communities_controller.rb index 040272fc5..ff3996322 100644 --- a/app/controllers/communities_controller.rb +++ b/app/controllers/communities_controller.rb @@ -13,27 +13,27 @@ class CommunitiesController < ApplicationController private - def set_order - @order = valid_order? ? params[:order] : "newest" - end + def set_order + @order = valid_order? ? params[:order] : "newest" + end - def set_community - @community = Community.find(params[:id]) - end + def set_community + @community = Community.find(params[:id]) + end - def load_topics - @topics = @community.topics.send("sort_by_#{@order}").page(params[:page]) - end + def load_topics + @topics = @community.topics.send("sort_by_#{@order}").page(params[:page]) + end - def load_participants - @participants = @community.participants - end + def load_participants + @participants = @community.participants + end - def valid_order? - params[:order].present? && TOPIC_ORDERS.include?(params[:order]) - end + def valid_order? + params[:order].present? && TOPIC_ORDERS.include?(params[:order]) + end - def communitable_exists? - @community.proposal.present? || @community.investment.present? - end + def communitable_exists? + @community.proposal.present? || @community.investment.present? + end end diff --git a/app/controllers/direct_uploads_controller.rb b/app/controllers/direct_uploads_controller.rb index a2e089cdd..5b19977f7 100644 --- a/app/controllers/direct_uploads_controller.rb +++ b/app/controllers/direct_uploads_controller.rb @@ -39,10 +39,10 @@ class DirectUploadsController < ApplicationController private - def direct_upload_params - params.require(:direct_upload) - .permit(:resource, :resource_type, :resource_id, :resource_relation, - :attachment, :cached_attachment, attachment_attributes: []) - end + def direct_upload_params + params.require(:direct_upload) + .permit(:resource, :resource_type, :resource_id, :resource_relation, + :attachment, :cached_attachment, attachment_attributes: []) + end end diff --git a/app/controllers/follows_controller.rb b/app/controllers/follows_controller.rb index 78185b5b4..4331a52eb 100644 --- a/app/controllers/follows_controller.rb +++ b/app/controllers/follows_controller.rb @@ -17,12 +17,12 @@ class FollowsController < ApplicationController private - def find_followable - params[:followable_type].constantize.find(params[:followable_id]) - end + def find_followable + params[:followable_type].constantize.find(params[:followable_id]) + end - def followable_translation_key(followable) - followable.class.name.parameterize(separator: "_") - end + def followable_translation_key(followable) + followable.class.name.parameterize(separator: "_") + end end diff --git a/app/controllers/installation_controller.rb b/app/controllers/installation_controller.rb index 79c244e5e..4a9174f53 100644 --- a/app/controllers/installation_controller.rb +++ b/app/controllers/installation_controller.rb @@ -10,14 +10,14 @@ class InstallationController < ApplicationController private - def consul_installation_details - { - release: "1.0.0" - }.merge(features: settings_feature_flags) - end + def consul_installation_details + { + release: "1.0.0" + }.merge(features: settings_feature_flags) + end - def settings_feature_flags - Setting.where("key LIKE 'feature.%'").each_with_object({}) { |x, n| n[x.key.remove("feature.")] = x.value } - end + def settings_feature_flags + Setting.where("key LIKE 'feature.%'").each_with_object({}) { |x, n| n[x.key.remove("feature.")] = x.value } + end end diff --git a/app/controllers/officing/ballot_sheets_controller.rb b/app/controllers/officing/ballot_sheets_controller.rb index 9a4f08401..835e8a23b 100644 --- a/app/controllers/officing/ballot_sheets_controller.rb +++ b/app/controllers/officing/ballot_sheets_controller.rb @@ -32,39 +32,39 @@ class Officing::BallotSheetsController < Officing::BaseController private - def namespace - "officing" - end + def namespace + "officing" + end - def load_poll - @poll = Poll.find(params[:poll_id]) - end + def load_poll + @poll = Poll.find(params[:poll_id]) + end - def load_ballot_sheets - @ballot_sheets = Poll::BallotSheet.where(poll: @poll) - end + def load_ballot_sheets + @ballot_sheets = Poll::BallotSheet.where(poll: @poll) + end - def load_ballot_sheet - @ballot_sheet = Poll::BallotSheet.find(params[:id]) - end + def load_ballot_sheet + @ballot_sheet = Poll::BallotSheet.find(params[:id]) + end - def load_officer_assignments - @officer_assignments = ::Poll::OfficerAssignment. - includes(booth_assignment: [:booth]). - joins(:booth_assignment). - final. - where(id: current_user.poll_officer.officer_assignment_ids). - where("poll_booth_assignments.poll_id = ?", @poll.id). - where(date: Date.current) - end + def load_officer_assignments + @officer_assignments = ::Poll::OfficerAssignment. + includes(booth_assignment: [:booth]). + joins(:booth_assignment). + final. + where(id: current_user.poll_officer.officer_assignment_ids). + where("poll_booth_assignments.poll_id = ?", @poll.id). + where(date: Date.current) + end - def load_officer_assignment - @officer_assignment = current_user.poll_officer.officer_assignments.final - .find_by(id: ballot_sheet_params[:officer_assignment_id]) - end + def load_officer_assignment + @officer_assignment = current_user.poll_officer.officer_assignments.final + .find_by(id: ballot_sheet_params[:officer_assignment_id]) + end - def ballot_sheet_params - params.permit(:data, :poll_id, :officer_assignment_id) - end + def ballot_sheet_params + params.permit(:data, :poll_id, :officer_assignment_id) + end end diff --git a/app/controllers/officing/booth_controller.rb b/app/controllers/officing/booth_controller.rb index 584c92de0..6da408e67 100644 --- a/app/controllers/officing/booth_controller.rb +++ b/app/controllers/officing/booth_controller.rb @@ -13,12 +13,12 @@ class Officing::BoothController < Officing::BaseController private - def booth_params - params.require(:booth).permit(:id) - end + def booth_params + params.require(:booth).permit(:id) + end - def set_booth(booth) - session[:booth_id] = booth.id - end + def set_booth(booth) + session[:booth_id] = booth.id + end end diff --git a/app/controllers/related_contents_controller.rb b/app/controllers/related_contents_controller.rb index ae18564b9..a36ba23f9 100644 --- a/app/controllers/related_contents_controller.rb +++ b/app/controllers/related_contents_controller.rb @@ -30,32 +30,32 @@ class RelatedContentsController < ApplicationController private - def score(action) - @related = RelatedContent.find params[:id] - @related.send("score_#{action}", current_user) + def score(action) + @related = RelatedContent.find params[:id] + @related.send("score_#{action}", current_user) - render template: "relationable/_refresh_score_actions" - end - - def valid_url? - params[:url].start_with?(Setting["url"]) - end - - def relationable_object - @relationable = params[:relationable_klass].singularize.camelize.constantize.find_by(id: params[:relationable_id]) - end - - def related_object - if valid_url? - url = params[:url] - - related_klass = url.scan(/\/(#{RelatedContent::RELATIONABLE_MODELS.join("|")})\//) - .flatten.map { |i| i.to_s.singularize.camelize }.join("::") - related_id = url.match(/\/(\d+)(?!.*\/\d)/)[1] - - @related = related_klass.singularize.camelize.constantize.find_by(id: related_id) + render template: "relationable/_refresh_score_actions" + end + + def valid_url? + params[:url].start_with?(Setting["url"]) + end + + def relationable_object + @relationable = params[:relationable_klass].singularize.camelize.constantize.find_by(id: params[:relationable_id]) + end + + def related_object + if valid_url? + url = params[:url] + + related_klass = url.scan(/\/(#{RelatedContent::RELATIONABLE_MODELS.join("|")})\//) + .flatten.map { |i| i.to_s.singularize.camelize }.join("::") + related_id = url.match(/\/(\d+)(?!.*\/\d)/)[1] + + @related = related_klass.singularize.camelize.constantize.find_by(id: related_id) + end + rescue + nil end - rescue - nil - end end diff --git a/app/controllers/sandbox_controller.rb b/app/controllers/sandbox_controller.rb index ec813c49f..ca18b4588 100644 --- a/app/controllers/sandbox_controller.rb +++ b/app/controllers/sandbox_controller.rb @@ -31,15 +31,15 @@ class SandboxController < ApplicationController private - def set_layout - if params[:template] && params[:template].split("_").first == "admin" - "admin" - else - "application" + def set_layout + if params[:template] && params[:template].split("_").first == "admin" + "admin" + else + "application" + end end - end - def namespace - "admin" - end + def namespace + "admin" + end end diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 1c7b4732e..7c75e2fa0 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -46,15 +46,15 @@ class TopicsController < ApplicationController private - def topic_params - params.require(:topic).permit(:title, :description) - end + def topic_params + params.require(:topic).permit(:title, :description) + end - def load_community - @community = Community.find(params[:community_id]) - end + def load_community + @community = Community.find(params[:community_id]) + end - def load_topic - @topic = Topic.find(params[:id]) - end + def load_topic + @topic = Topic.find(params[:id]) + end end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index b6bb138c4..fee05dfd1 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -33,9 +33,9 @@ class WelcomeController < ApplicationController private - def set_user_recommendations - @recommended_debates = Debate.recommendations(current_user).sort_by_recommendations.limit(3) - @recommended_proposals = Proposal.recommendations(current_user).sort_by_recommendations.limit(3) - end + def set_user_recommendations + @recommended_debates = Debate.recommendations(current_user).sort_by_recommendations.limit(3) + @recommended_proposals = Proposal.recommendations(current_user).sort_by_recommendations.limit(3) + end end diff --git a/app/helpers/flags_helper.rb b/app/helpers/flags_helper.rb index 9983b34ae..c02dcefad 100644 --- a/app/helpers/flags_helper.rb +++ b/app/helpers/flags_helper.rb @@ -10,20 +10,20 @@ module FlagsHelper private - def flagged?(flaggable) - if flaggable.is_a? Comment - @comment_flags[flaggable.id] unless flaggable.commentable_type == "Poll" - else - Flag.flagged?(current_user, flaggable) + def flagged?(flaggable) + if flaggable.is_a? Comment + @comment_flags[flaggable.id] unless flaggable.commentable_type == "Poll" + else + Flag.flagged?(current_user, flaggable) + end end - end - def own_flaggable?(flaggable) - if flaggable.is_a? Comment - flaggable.user_id == current_user.id - else - flaggable.author_id == current_user.id + def own_flaggable?(flaggable) + if flaggable.is_a? Comment + flaggable.user_id == current_user.id + else + flaggable.author_id == current_user.id + end end - end end diff --git a/app/helpers/map_locations_helper.rb b/app/helpers/map_locations_helper.rb index eeab8681a..d0f51f5f6 100644 --- a/app/helpers/map_locations_helper.rb +++ b/app/helpers/map_locations_helper.rb @@ -47,24 +47,24 @@ module MapLocationsHelper private - def prepare_map_settings(map_location, editable, parent_class, investments_coordinates=nil) - options = { - map: "", - map_center_latitude: map_location_latitude(map_location), - map_center_longitude: map_location_longitude(map_location), - map_zoom: map_location_zoom(map_location), - map_tiles_provider: Rails.application.secrets.map_tiles_provider, - map_tiles_provider_attribution: Rails.application.secrets.map_tiles_provider_attribution, - marker_editable: editable, - marker_remove_selector: "##{map_location_remove_marker_link_id(map_location)}", - latitude_input_selector: "##{map_location_input_id(parent_class, "latitude")}", - longitude_input_selector: "##{map_location_input_id(parent_class, "longitude")}", - zoom_input_selector: "##{map_location_input_id(parent_class, "zoom")}", - marker_investments_coordinates: investments_coordinates - } - options[:marker_latitude] = map_location.latitude if map_location.latitude.present? - options[:marker_longitude] = map_location.longitude if map_location.longitude.present? - options - end + def prepare_map_settings(map_location, editable, parent_class, investments_coordinates=nil) + options = { + map: "", + map_center_latitude: map_location_latitude(map_location), + map_center_longitude: map_location_longitude(map_location), + map_zoom: map_location_zoom(map_location), + map_tiles_provider: Rails.application.secrets.map_tiles_provider, + map_tiles_provider_attribution: Rails.application.secrets.map_tiles_provider_attribution, + marker_editable: editable, + marker_remove_selector: "##{map_location_remove_marker_link_id(map_location)}", + latitude_input_selector: "##{map_location_input_id(parent_class, "latitude")}", + longitude_input_selector: "##{map_location_input_id(parent_class, "longitude")}", + zoom_input_selector: "##{map_location_input_id(parent_class, "zoom")}", + marker_investments_coordinates: investments_coordinates + } + options[:marker_latitude] = map_location.latitude if map_location.latitude.present? + options[:marker_longitude] = map_location.longitude if map_location.longitude.present? + options + end end diff --git a/app/helpers/shifts_helper.rb b/app/helpers/shifts_helper.rb index 7ea17baf2..965cbde4e 100644 --- a/app/helpers/shifts_helper.rb +++ b/app/helpers/shifts_helper.rb @@ -37,7 +37,7 @@ module ShiftsHelper private - def officer_shifts(task_id, booth) - @officer.shifts.where(task: task_id, booth: booth).map(&:date) - end + def officer_shifts(task_id, booth) + @officer.shifts.where(task: task_id, booth: booth).map(&:date) + end end diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb index 9f1bb6f4e..89f2a76b6 100644 --- a/app/mailers/devise_mailer.rb +++ b/app/mailers/devise_mailer.rb @@ -5,9 +5,9 @@ class DeviseMailer < Devise::Mailer protected - def devise_mail(record, action, opts = {}) - I18n.with_locale record.locale do - super(record, action, opts) + def devise_mail(record, action, opts = {}) + I18n.with_locale record.locale do + super(record, action, opts) + end end - end end diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 9defb0f15..b8c473980 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -129,16 +129,16 @@ class Mailer < ApplicationMailer private - def with_user(user, &block) - I18n.with_locale(user.locale) do - yield + def with_user(user, &block) + I18n.with_locale(user.locale) do + yield + end end - end - def prevent_delivery_to_users_without_email - if @email_to.blank? - mail.perform_deliveries = false + def prevent_delivery_to_users_without_email + if @email_to.blank? + mail.perform_deliveries = false + end end - end end diff --git a/app/models/admin_notification.rb b/app/models/admin_notification.rb index 5e86f3d28..3fdec9c16 100644 --- a/app/models/admin_notification.rb +++ b/app/models/admin_notification.rb @@ -35,14 +35,14 @@ class AdminNotification < ApplicationRecord private - def validate_segment_recipient - errors.add(:segment_recipient, :invalid) unless valid_segment_recipient? - end - - def complete_link_url - return unless link.present? - unless self.link[/\Ahttp:\/\//] || self.link[/\Ahttps:\/\//] - self.link = "http://#{self.link}" + def validate_segment_recipient + errors.add(:segment_recipient, :invalid) unless valid_segment_recipient? + end + + def complete_link_url + return unless link.present? + unless self.link[/\Ahttp:\/\//] || self.link[/\Ahttps:\/\//] + self.link = "http://#{self.link}" + end end - end end diff --git a/app/models/ahoy/data_source.rb b/app/models/ahoy/data_source.rb index ba8a2cf14..78c228fc4 100644 --- a/app/models/ahoy/data_source.rb +++ b/app/models/ahoy/data_source.rb @@ -32,17 +32,17 @@ module Ahoy private - def collections - @collections ||= [] - end + def collections + @collections ||= [] + end - def shared_keys - @shared_keys ||= [] - end + def shared_keys + @shared_keys ||= [] + end - def add_key(key) - shared_keys.push(key) unless shared_keys.include? key - end + def add_key(key) + shared_keys.push(key) unless shared_keys.include? key + end end diff --git a/app/models/budget.rb b/app/models/budget.rb index 5928209cf..8b8b7c6f6 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -205,28 +205,28 @@ class Budget < ApplicationRecord private - def sanitize_descriptions - s = WYSIWYGSanitizer.new - Budget::Phase::PHASE_KINDS.each do |phase| - sanitized = s.sanitize(send("description_#{phase}")) - send("description_#{phase}=", sanitized) + def sanitize_descriptions + s = WYSIWYGSanitizer.new + Budget::Phase::PHASE_KINDS.each do |phase| + sanitized = s.sanitize(send("description_#{phase}")) + send("description_#{phase}=", sanitized) + end end - end - def generate_phases - Budget::Phase::PHASE_KINDS.each do |phase| - Budget::Phase.create( - budget: self, - kind: phase, - prev_phase: phases&.last, - starts_at: phases&.last&.ends_at || Date.current, - ends_at: (phases&.last&.ends_at || Date.current) + 1.month - ) + def generate_phases + Budget::Phase::PHASE_KINDS.each do |phase| + Budget::Phase.create( + budget: self, + kind: phase, + prev_phase: phases&.last, + starts_at: phases&.last&.ends_at || Date.current, + ends_at: (phases&.last&.ends_at || Date.current) + 1.month + ) + end end - end - def generate_slug? - slug.nil? || drafting? - end + def generate_slug? + slug.nil? || drafting? + end end diff --git a/app/models/budget/group.rb b/app/models/budget/group.rb index 71eebb308..bcf217182 100644 --- a/app/models/budget/group.rb +++ b/app/models/budget/group.rb @@ -36,8 +36,8 @@ class Budget private - def generate_slug? - slug.nil? || budget.drafting? - end + def generate_slug? + slug.nil? || budget.drafting? + end end end diff --git a/app/models/budget/heading.rb b/app/models/budget/heading.rb index 0e218d6fb..3e3d8b07d 100644 --- a/app/models/budget/heading.rb +++ b/app/models/budget/heading.rb @@ -56,8 +56,8 @@ class Budget private - def generate_slug? - slug.nil? || budget.drafting? - end + def generate_slug? + slug.nil? || budget.drafting? + end end end diff --git a/app/models/budget/investment/exporter.rb b/app/models/budget/investment/exporter.rb index e355600f3..cf4972198 100644 --- a/app/models/budget/investment/exporter.rb +++ b/app/models/budget/investment/exporter.rb @@ -14,54 +14,54 @@ class Budget::Investment::Exporter private - def headers - [ - I18n.t("admin.budget_investments.index.list.id"), - I18n.t("admin.budget_investments.index.list.title"), - I18n.t("admin.budget_investments.index.list.supports"), - I18n.t("admin.budget_investments.index.list.admin"), - I18n.t("admin.budget_investments.index.list.valuator"), - I18n.t("admin.budget_investments.index.list.valuation_group"), - I18n.t("admin.budget_investments.index.list.geozone"), - I18n.t("admin.budget_investments.index.list.feasibility"), - I18n.t("admin.budget_investments.index.list.valuation_finished"), - I18n.t("admin.budget_investments.index.list.selected"), - I18n.t("admin.budget_investments.index.list.visible_to_valuators"), - I18n.t("admin.budget_investments.index.list.author_username") - ] - end - - def csv_values(investment) - [ - investment.id.to_s, - investment.title, - investment.total_votes.to_s, - admin(investment), - investment.assigned_valuators || "-", - investment.assigned_valuation_groups || "-", - investment.heading.name, - price(investment), - investment.valuation_finished? ? I18n.t("shared.yes") : I18n.t("shared.no"), - investment.selected? ? I18n.t("shared.yes") : I18n.t("shared.no"), - investment.visible_to_valuators? ? I18n.t("shared.yes") : I18n.t("shared.no"), - investment.author.username - ] - end - - def admin(investment) - if investment.administrator.present? - investment.administrator.name - else - I18n.t("admin.budget_investments.index.no_admin_assigned") + def headers + [ + I18n.t("admin.budget_investments.index.list.id"), + I18n.t("admin.budget_investments.index.list.title"), + I18n.t("admin.budget_investments.index.list.supports"), + I18n.t("admin.budget_investments.index.list.admin"), + I18n.t("admin.budget_investments.index.list.valuator"), + I18n.t("admin.budget_investments.index.list.valuation_group"), + I18n.t("admin.budget_investments.index.list.geozone"), + I18n.t("admin.budget_investments.index.list.feasibility"), + I18n.t("admin.budget_investments.index.list.valuation_finished"), + I18n.t("admin.budget_investments.index.list.selected"), + I18n.t("admin.budget_investments.index.list.visible_to_valuators"), + I18n.t("admin.budget_investments.index.list.author_username") + ] end - end - def price(investment) - price_string = "admin.budget_investments.index.feasibility.#{investment.feasibility}" - if investment.feasible? - "#{I18n.t(price_string)} (#{investment.formatted_price})" - else - I18n.t(price_string) + def csv_values(investment) + [ + investment.id.to_s, + investment.title, + investment.total_votes.to_s, + admin(investment), + investment.assigned_valuators || "-", + investment.assigned_valuation_groups || "-", + investment.heading.name, + price(investment), + investment.valuation_finished? ? I18n.t("shared.yes") : I18n.t("shared.no"), + investment.selected? ? I18n.t("shared.yes") : I18n.t("shared.no"), + investment.visible_to_valuators? ? I18n.t("shared.yes") : I18n.t("shared.no"), + investment.author.username + ] + end + + def admin(investment) + if investment.administrator.present? + investment.administrator.name + else + I18n.t("admin.budget_investments.index.no_admin_assigned") + end + end + + def price(investment) + price_string = "admin.budget_investments.index.feasibility.#{investment.feasibility}" + if investment.feasible? + "#{I18n.t(price_string)} (#{investment.formatted_price})" + else + I18n.t(price_string) + end end - end end diff --git a/app/models/comment_notifier.rb b/app/models/comment_notifier.rb index 68b350e6b..be8a9d69a 100644 --- a/app/models/comment_notifier.rb +++ b/app/models/comment_notifier.rb @@ -11,25 +11,25 @@ class CommentNotifier private - def send_comment_email - unless @comment.commentable.is_a?(Legislation::Annotation) - Mailer.comment(@comment).deliver_later if email_on_comment? + def send_comment_email + unless @comment.commentable.is_a?(Legislation::Annotation) + Mailer.comment(@comment).deliver_later if email_on_comment? + end end - end - def send_reply_email - Mailer.reply(@comment).deliver_later if email_on_comment_reply? - end + def send_reply_email + Mailer.reply(@comment).deliver_later if email_on_comment_reply? + end - def email_on_comment? - commentable_author = @comment.commentable.author - commentable_author != @author && commentable_author.email_on_comment? - end + def email_on_comment? + commentable_author = @comment.commentable.author + commentable_author != @author && commentable_author.email_on_comment? + end - def email_on_comment_reply? - return false unless @comment.reply? - parent_author = @comment.parent.author - parent_author != @author && parent_author.email_on_comment_reply? - end + def email_on_comment_reply? + return false unless @comment.reply? + parent_author = @comment.parent.author + parent_author != @author && parent_author.email_on_comment_reply? + end end diff --git a/app/models/community.rb b/app/models/community.rb index c4430a2ca..3a40b682c 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -44,18 +44,18 @@ class Community < ApplicationRecord private - def users_who_commented - topics_ids = topics.pluck(:id) - query = "comments.commentable_id IN (?)and comments.commentable_type = 'Topic'" - User.by_comments(query, topics_ids) - end + def users_who_commented + topics_ids = topics.pluck(:id) + query = "comments.commentable_id IN (?)and comments.commentable_type = 'Topic'" + User.by_comments(query, topics_ids) + end - def users_who_topics_author - author_ids = topics.pluck(:author_id) - User.by_authors(author_ids) - end + def users_who_topics_author + author_ids = topics.pluck(:author_id) + User.by_authors(author_ids) + end - def author_from_community - from_proposal? ? User.where(id: proposal&.author_id) : User.where(id: investment&.author_id) - end + def author_from_community + from_proposal? ? User.where(id: proposal&.author_id) : User.where(id: investment&.author_id) + end end diff --git a/app/models/concerns/search_cache.rb b/app/models/concerns/search_cache.rb index e3e211647..fd01c98a0 100644 --- a/app/models/concerns/search_cache.rb +++ b/app/models/concerns/search_cache.rb @@ -12,23 +12,23 @@ module SearchCache private - def searchable_values_sql - searchable_values - .select{ |k, _| k.present? } - .collect{ |value, weight| set_tsvector(value, weight) } - .join(" || ") - end + def searchable_values_sql + searchable_values + .select{ |k, _| k.present? } + .collect{ |value, weight| set_tsvector(value, weight) } + .join(" || ") + end - def set_tsvector(value, weight) - "setweight(to_tsvector('spanish', unaccent(coalesce(#{quote(strip_html(value))}, ''))), #{quote(weight)})" - end + def set_tsvector(value, weight) + "setweight(to_tsvector('spanish', unaccent(coalesce(#{quote(strip_html(value))}, ''))), #{quote(weight)})" + end - def quote(value) - ActiveRecord::Base.connection.quote(value) - end + def quote(value) + ActiveRecord::Base.connection.quote(value) + end - def strip_html(value) - ActionController::Base.helpers.sanitize(value, tags: []) - end + def strip_html(value) + ActionController::Base.helpers.sanitize(value, tags: []) + end end diff --git a/app/models/concerns/statisticable.rb b/app/models/concerns/statisticable.rb index b45de3f6f..144367559 100644 --- a/app/models/concerns/statisticable.rb +++ b/app/models/concerns/statisticable.rb @@ -6,6 +6,42 @@ module Statisticable attr_reader :resource end + class_methods do + def stats_methods + base_stats_methods + gender_methods + age_methods + geozone_methods + end + + def base_stats_methods + %i[total_participants participations] + participation_check_methods + end + + def participation_check_methods + PARTICIPATIONS.map { |participation| :"#{participation}?" } + end + + def gender_methods + %i[total_male_participants total_female_participants male_percentage female_percentage] + end + + def age_methods + [:participants_by_age] + end + + def geozone_methods + %i[participants_by_geozone total_no_demographic_data] + end + + def stats_cache(*method_names) + method_names.each do |method_name| + alias_method :"raw_#{method_name}", method_name + + define_method method_name do + stats_cache(method_name) { send(:"raw_#{method_name}") } + end + end + end + end + def initialize(resource) @resource = resource end @@ -150,40 +186,4 @@ module Statisticable I18n.t("stats.age_range", start: start, finish: finish) end end - - class_methods do - def stats_methods - base_stats_methods + gender_methods + age_methods + geozone_methods - end - - def base_stats_methods - %i[total_participants participations] + participation_check_methods - end - - def participation_check_methods - PARTICIPATIONS.map { |participation| :"#{participation}?" } - end - - def gender_methods - %i[total_male_participants total_female_participants male_percentage female_percentage] - end - - def age_methods - [:participants_by_age] - end - - def geozone_methods - %i[participants_by_geozone total_no_demographic_data] - end - - def stats_cache(*method_names) - method_names.each do |method_name| - alias_method :"raw_#{method_name}", method_name - - define_method method_name do - stats_cache(method_name) { send(:"raw_#{method_name}") } - end - end - end - end end diff --git a/app/models/direct_upload.rb b/app/models/direct_upload.rb index 088c8ea64..277f1af6e 100644 --- a/app/models/direct_upload.rb +++ b/app/models/direct_upload.rb @@ -47,20 +47,20 @@ class DirectUpload private - def parent_resource_attachment_validations - @relation.valid? + def parent_resource_attachment_validations + @relation.valid? - if @relation.errors.key? :attachment - errors.add(:attachment, @relation.errors.full_messages_for(:attachment)) + if @relation.errors.key? :attachment + errors.add(:attachment, @relation.errors.full_messages_for(:attachment)) + end end - end - def relation_attributtes - { - attachment: @attachment, - cached_attachment: @cached_attachment, - user: @user - } - end + def relation_attributtes + { + attachment: @attachment, + cached_attachment: @cached_attachment, + user: @user + } + end end diff --git a/app/models/newsletter.rb b/app/models/newsletter.rb index bac4d8ef7..df088ce8e 100644 --- a/app/models/newsletter.rb +++ b/app/models/newsletter.rb @@ -55,16 +55,16 @@ class Newsletter < ApplicationRecord private - def validate_segment_recipient - errors.add(:segment_recipient, :invalid) unless valid_segment_recipient? - end + def validate_segment_recipient + errors.add(:segment_recipient, :invalid) unless valid_segment_recipient? + end - def valid_email?(email) - email.match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i) - end + def valid_email?(email) + email.match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i) + end - def log_delivery(recipient_email) - user = User.where(email: recipient_email).first - Activity.log(user, :email, self) - end + def log_delivery(recipient_email) + user = User.where(email: recipient_email).first + Activity.log(user, :email, self) + end end diff --git a/app/models/notification.rb b/app/models/notification.rb index e5a8e2b95..66343ae6a 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -82,16 +82,16 @@ class Notification < ApplicationRecord private - def self.batch_size - 10000 - end + def self.batch_size + 10000 + end - def self.batch_interval - 20.minutes - end + def self.batch_interval + 20.minutes + end - def self.first_batch_run_at - Time.current - end + def self.first_batch_run_at + Time.current + end end diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb index 20fe1f0cb..3ea3ea906 100644 --- a/app/models/proposal_notification.rb +++ b/app/models/proposal_notification.rb @@ -56,8 +56,8 @@ class ProposalNotification < ApplicationRecord private - def set_author - self.update(author_id: self.proposal.author_id) if self.proposal - end + def set_author + self.update(author_id: self.proposal.author_id) if self.proposal + end end diff --git a/app/models/related_content.rb b/app/models/related_content.rb index 1ac79beec..25a46c6c4 100644 --- a/app/models/related_content.rb +++ b/app/models/related_content.rb @@ -36,28 +36,28 @@ class RelatedContent < ApplicationRecord private - def create_opposite_related_content - related_content = RelatedContent.create!(opposite_related_content: self, parent_relationable: child_relationable, - child_relationable: parent_relationable, author: author) - self.opposite_related_content = related_content - end + def create_opposite_related_content + related_content = RelatedContent.create!(opposite_related_content: self, parent_relationable: child_relationable, + child_relationable: parent_relationable, author: author) + self.opposite_related_content = related_content + end - def score(value, user) - score_with_opposite(value, user) - hide_with_opposite if (related_content_scores.sum(:value) / related_content_scores_count) < RELATED_CONTENT_SCORE_THRESHOLD - end + def score(value, user) + score_with_opposite(value, user) + hide_with_opposite if (related_content_scores.sum(:value) / related_content_scores_count) < RELATED_CONTENT_SCORE_THRESHOLD + end - def hide_with_opposite - hide - opposite_related_content.hide - end + def hide_with_opposite + hide + opposite_related_content.hide + end - def create_author_score - score_positive(author) - end + def create_author_score + score_positive(author) + end - def score_with_opposite(value, user) - RelatedContentScore.create(user: user, related_content: self, value: value) - RelatedContentScore.create(user: user, related_content: opposite_related_content, value: value) - end + def score_with_opposite(value, user) + RelatedContentScore.create(user: user, related_content: self, value: value) + RelatedContentScore.create(user: user, related_content: opposite_related_content, value: value) + end end diff --git a/lib/user_segments.rb b/lib/user_segments.rb index bc5419c78..17d609e68 100644 --- a/lib/user_segments.rb +++ b/lib/user_segments.rb @@ -60,11 +60,11 @@ class UserSegments private - def self.current_budget_investments - Budget.current.investments - end + def self.current_budget_investments + Budget.current.investments + end - def self.author_ids(author_ids) - all_users.where(id: author_ids) - end + def self.author_ids(author_ids) + all_users.where(id: author_ids) + end end From 488461b8ac18351b09c21741b6cb3a2f2bcc9858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Jun 2019 15:34:27 +0200 Subject: [PATCH 09/13] Remove consecutive blank lines --- .rubocop_basic.yml | 3 +++ app/controllers/admin/poll/active_polls_controller.rb | 1 - app/controllers/dashboard/supports_controller.rb | 1 - app/controllers/legislation/processes_controller.rb | 1 - app/models/poll/pair_answer.rb | 1 - app/models/user.rb | 1 - app/models/votation_type.rb | 1 - app/views/account/show.html.erb | 1 - app/views/admin/budget_investments/_investments.html.erb | 1 - app/views/admin/budget_investments/edit.html.erb | 1 - app/views/admin/hidden_comments/index.html.erb | 1 - app/views/admin/hidden_debates/index.html.erb | 1 - app/views/admin/signature_sheets/show.html.erb | 1 - app/views/admin/users/index.html.erb | 1 - app/views/officing/results/index.html.erb | 1 - app/views/stats/index.html.erb | 1 - app/views/topics/show.html.erb | 1 - app/views/users/registrations/new.html.erb | 1 - app/views/welcome/index.html.erb | 1 - config/deploy.rb | 1 - config/environments/production.rb | 1 - lib/email_digest.rb | 1 - spec/controllers/legislation/annotations_controller_spec.rb | 1 - spec/features/admin/admin_notifications_spec.rb | 1 - spec/features/admin/budget_investments_spec.rb | 3 --- spec/features/admin/budgets_spec.rb | 1 - spec/features/budget_polls/budgets_spec.rb | 1 - spec/features/legislation/resume_spec.rb | 2 -- spec/features/polls/votation_type_spec.rb | 1 - spec/features/valuation/budget_investments_spec.rb | 1 - spec/features/welcome_spec.rb | 1 - spec/helpers/signature_sheets_helper_spec.rb | 2 -- spec/models/budget/heading_spec.rb | 2 -- spec/models/dashboard/action_spec.rb | 1 - spec/models/legislation/process/phase_spec.rb | 1 - spec/models/poll/pair_answer_spec.rb | 1 - 36 files changed, 3 insertions(+), 40 deletions(-) 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) } From 24359f815224df1a73ccca4307efc19e5e1285b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Jun 2019 16:06:17 +0200 Subject: [PATCH 10/13] Remove extra space in HTML tags --- .../admin/site_customization/information_texts/_tabs.html.erb | 2 +- app/views/shared/_suggest.html.erb | 2 +- app/views/users/_following.html.erb | 2 +- app/views/welcome/_recommended_carousel.html.erb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/site_customization/information_texts/_tabs.html.erb b/app/views/admin/site_customization/information_texts/_tabs.html.erb index d3d195503..4947e2a8c 100644 --- a/app/views/admin/site_customization/information_texts/_tabs.html.erb +++ b/app/views/admin/site_customization/information_texts/_tabs.html.erb @@ -1,4 +1,4 @@ -
        +
          <% information_texts_tabs.each do |tab| %>
        • <% if tab.to_s == @tab %> diff --git a/app/views/shared/_suggest.html.erb b/app/views/shared/_suggest.html.erb index 3164594fc..3f401cf99 100644 --- a/app/views/shared/_suggest.html.erb +++ b/app/views/shared/_suggest.html.erb @@ -1,4 +1,4 @@ -
          +
          <% if @search_terms && @resources.any? %>

          diff --git a/app/views/users/_following.html.erb b/app/views/users/_following.html.erb index 8a6dd91fc..91fa8562a 100644 --- a/app/views/users/_following.html.erb +++ b/app/views/users/_following.html.erb @@ -1,4 +1,4 @@ -

          +
      <% @administrators.each do |administrator| %> - + diff --git a/app/views/admin/banners/_form.html.erb b/app/views/admin/banners/_form.html.erb index 4bb19e227..f6e17cf10 100644 --- a/app/views/admin/banners/_form.html.erb +++ b/app/views/admin/banners/_form.html.erb @@ -15,7 +15,7 @@ class: "js-calendar-full", id: "post_started_at" %> - <% date_ended_at = @banner.post_ended_at.present? ? I18n.localize(@banner.post_ended_at) : ""%> + <% date_ended_at = @banner.post_ended_at.present? ? I18n.localize(@banner.post_ended_at) : "" %>
      <%= f.label :post_ended_at, t("admin.banners.banner.post_ended_at") %> <%= f.text_field :post_ended_at, @@ -40,7 +40,7 @@ <%= translations_form.text_field :description, placeholder: t("admin.banners.banner.description"), data: {js_banner_description: "js_banner_description"}, - label: t("admin.banners.banner.description") %> + label: t("admin.banners.banner.description") %>
      <% end %> diff --git a/app/views/admin/banners/index.html.erb b/app/views/admin/banners/index.html.erb index 8ab4463d8..8c099f4f8 100644 --- a/app/views/admin/banners/index.html.erb +++ b/app/views/admin/banners/index.html.erb @@ -11,9 +11,9 @@
      <%= t("admin.shared.actions") %>
      <%= administrator.id %>
      - - - + + + diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index cdc7e7651..5c6d12e31 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -8,7 +8,7 @@ class: "button hollow float-right clear" %> <% else %> - <%= t("admin.budgets.winners.calculate")%> + <%= t("admin.budgets.winners.calculate") %>
      <%= t("admin.budget_investments.index.cannot_calculate_winners") %> @@ -27,7 +27,7 @@
      <%= t("admin.banners.banner.post_started_at")%><%= t("admin.banners.banner.post_ended_at")%><%= t("admin.actions.actions")%><%= t("admin.banners.banner.post_started_at") %><%= t("admin.banners.banner.post_ended_at") %><%= t("admin.actions.actions") %>
      - + diff --git a/app/views/admin/legislation/draft_versions/index.html.erb b/app/views/admin/legislation/draft_versions/index.html.erb index 0abbf128d..c4f6ccc25 100644 --- a/app/views/admin/legislation/draft_versions/index.html.erb +++ b/app/views/admin/legislation/draft_versions/index.html.erb @@ -38,7 +38,7 @@ diff --git a/app/views/admin/poll/booth_assignments/show.html.erb b/app/views/admin/poll/booth_assignments/show.html.erb index 64d73ebaf..26e6650d9 100644 --- a/app/views/admin/poll/booth_assignments/show.html.erb +++ b/app/views/admin/poll/booth_assignments/show.html.erb @@ -67,7 +67,7 @@ <% unless @poll.recounts_confirmed? %> diff --git a/app/views/admin/poll/officer_assignments/by_officer.html.erb b/app/views/admin/poll/officer_assignments/by_officer.html.erb index 21e4c9b0c..f6507d6b0 100644 --- a/app/views/admin/poll/officer_assignments/by_officer.html.erb +++ b/app/views/admin/poll/officer_assignments/by_officer.html.erb @@ -21,7 +21,7 @@ <% @officer_assignments.each do |officer_assignment| %> - + <% end %> diff --git a/app/views/admin/stats/direct_messages.html.erb b/app/views/admin/stats/direct_messages.html.erb index 4a8a55829..df5621a13 100644 --- a/app/views/admin/stats/direct_messages.html.erb +++ b/app/views/admin/stats/direct_messages.html.erb @@ -1,6 +1,6 @@ <%= back_link_to %> -

      <%= t("admin.stats.direct_messages.title")%>

      +

      <%= t("admin.stats.direct_messages.title") %>

      diff --git a/app/views/admin/stats/polls.html.erb b/app/views/admin/stats/polls.html.erb index 4373e5eae..d40e4280b 100644 --- a/app/views/admin/stats/polls.html.erb +++ b/app/views/admin/stats/polls.html.erb @@ -1,6 +1,6 @@ <%= back_link_to %> -

      <%= t("admin.stats.polls.title")%>

      +

      <%= t("admin.stats.polls.title") %>

      diff --git a/app/views/admin/stats/proposal_notifications.html.erb b/app/views/admin/stats/proposal_notifications.html.erb index e26ac3431..4a5501177 100644 --- a/app/views/admin/stats/proposal_notifications.html.erb +++ b/app/views/admin/stats/proposal_notifications.html.erb @@ -1,6 +1,6 @@ <%= back_link_to %> -

      <%= t("admin.stats.proposal_notifications.title")%>

      +

      <%= t("admin.stats.proposal_notifications.title") %>

      diff --git a/app/views/admin/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 18c69b304..4f754fcb0 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -101,7 +101,7 @@

      <%= t "admin.stats.show.summary.verified_users_who_didnt_vote_proposals" %>
      - <%=number_with_delimiter(@user_ids_who_didnt_vote_proposals)%> + <%= number_with_delimiter(@user_ids_who_didnt_vote_proposals) %>

      diff --git a/app/views/admin/tags/index.html.erb b/app/views/admin/tags/index.html.erb index 57ca27ffd..3bdad5a9c 100644 --- a/app/views/admin/tags/index.html.erb +++ b/app/views/admin/tags/index.html.erb @@ -4,7 +4,7 @@ <%= form_for(@tag, url: admin_tags_path, as: :tag) do |f| %>
      <%= f.label :name, t("admin.tags.name.placeholder") %> - <%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %> + <%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %>
      <%= f.submit(t("admin.tags.create"), class: "button success") %> diff --git a/app/views/budgets/investments/_ballot.html.erb b/app/views/budgets/investments/_ballot.html.erb index a94f0a5f2..2913d2a32 100644 --- a/app/views/budgets/investments/_ballot.html.erb +++ b/app/views/budgets/investments/_ballot.html.erb @@ -51,7 +51,7 @@ budget_investments_path(budget_id: investment.budget_id, heading_id: investment.heading_id)) %> <% change_ballot = link_to(t("budgets.ballots.reasons_for_not_balloting.change_ballot"), - budget_ballot_path(@budget))%> + budget_ballot_path(@budget)) %>

      diff --git a/app/views/budgets/investments/index.html.erb b/app/views/budgets/investments/index.html.erb index 34a6ff711..f1e53520b 100644 --- a/app/views/budgets/investments/index.html.erb +++ b/app/views/budgets/investments/index.html.erb @@ -21,7 +21,7 @@ <%= render "/budgets/investments/header" %> <% end %> - <% if params[:search].present? || params[:advanced_search].present? %> + <% if params[:search].present? || params[:advanced_search].present? %>

      diff --git a/app/views/comments/_commentable_tree.html.erb b/app/views/comments/_commentable_tree.html.erb index f6631ea4c..07ba48f52 100644 --- a/app/views/comments/_commentable_tree.html.erb +++ b/app/views/comments/_commentable_tree.html.erb @@ -29,7 +29,7 @@ <% @comment_tree.root_comments.each do |comment| %> <%= render "comments/comment", { comment: comment, valuation: valuation, - allow_comments: allow_comments } %> + allow_comments: allow_comments } %> <% end %> <%= paginate @comment_tree.root_comments %>
      diff --git a/app/views/communities/_participant.html.erb b/app/views/communities/_participant.html.erb index fd9ed1dd0..278deb0d9 100644 --- a/app/views/communities/_participant.html.erb +++ b/app/views/communities/_participant.html.erb @@ -6,7 +6,7 @@
      - <%= link_to participant.name, user_path(participant)%> + <%= link_to participant.name, user_path(participant) %> <% if author?(@community, participant) %> diff --git a/app/views/debates/_comments.html.erb b/app/views/debates/_comments.html.erb index 7e041cdb5..9f74ad568 100644 --- a/app/views/debates/_comments.html.erb +++ b/app/views/debates/_comments.html.erb @@ -21,7 +21,7 @@ <% end %> <% @comment_tree.root_comments.each do |comment| %> - <%= render "comments/comment", comment: comment %> + <%= render "comments/comment", comment: comment %> <% end %> <%= paginate @comment_tree.root_comments %>
      diff --git a/app/views/debates/_featured_debates.html.erb b/app/views/debates/_featured_debates.html.erb index 577a6da77..26360194b 100644 --- a/app/views/debates/_featured_debates.html.erb +++ b/app/views/debates/_featured_debates.html.erb @@ -7,7 +7,7 @@ <% @featured_debates.each do |debate| %>

      <%= link_to debate.title, debate %>

      - <%= link_to debate.author.name, user_path(debate.author)%> + <%= link_to debate.author.name, user_path(debate.author) %>
      <% end %>
      diff --git a/app/views/debates/_form.html.erb b/app/views/debates/_form.html.erb index 33f60dd91..166c19030 100644 --- a/app/views/debates/_form.html.erb +++ b/app/views/debates/_form.html.erb @@ -34,7 +34,7 @@ placeholder: t("debates.form.tags_placeholder"), aria: {describedby: "tag-list-help-text"}, data: {js_url: suggest_tags_path}, - class: "tag-autocomplete"%> + class: "tag-autocomplete" %>
      <% if @debate.new_record? %> diff --git a/app/views/debates/_votes.html.erb b/app/views/debates/_votes.html.erb index 5ec065323..4dc9dff58 100644 --- a/app/views/debates/_votes.html.erb +++ b/app/views/debates/_votes.html.erb @@ -49,7 +49,7 @@ <%= t("votes.organizations") %>

      - <% elsif user_signed_in? && !debate.votable_by?(current_user)%> + <% elsif user_signed_in? && !debate.votable_by?(current_user) %>
      diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index 9075bdd7c..07d31e026 100644 --- a/app/views/documents/_document.html.erb +++ b/app/views/documents/_document.html.erb @@ -1,4 +1,4 @@ -
    • +
    • <%= link_to t("documents.buttons.download_document"), document.attachment.url, target: "_blank", rel: "nofollow", class: "button hollow medium float-right" %> diff --git a/app/views/documents/_nested_documents.html.erb b/app/views/documents/_nested_documents.html.erb index 8a4814aee..239a77de4 100644 --- a/app/views/documents/_nested_documents.html.erb +++ b/app/views/documents/_nested_documents.html.erb @@ -2,7 +2,7 @@ <%= f.label :documents, t("documents.form.title") %>

      <%= documentables_note(documentable) %>

      -
      +
      <%= f.fields_for :documents do |documents_builder| %> <%= render "documents/document_fields", f: documents_builder %> <% end %> diff --git a/app/views/layouts/_admin_header.html.erb b/app/views/layouts/_admin_header.html.erb index d05e61515..1995fa7ff 100644 --- a/app/views/layouts/_admin_header.html.erb +++ b/app/views/layouts/_admin_header.html.erb @@ -12,7 +12,7 @@
      -
      <%= t("application.menu")%>
      +
      <%= t("application.menu") %>
      diff --git a/app/views/layouts/_common_head.html.erb b/app/views/layouts/_common_head.html.erb index 54779408c..377045e03 100644 --- a/app/views/layouts/_common_head.html.erb +++ b/app/views/layouts/_common_head.html.erb @@ -1,7 +1,7 @@ -<%= content_for?(:title) ? yield(:title) : default_title %> +<%= content_for?(:title) ? yield(:title) : default_title %> <%= stylesheet_link_tag "application" %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index e93075833..a65f1a8b0 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -17,7 +17,7 @@ - <%= t("application.menu")%> + <%= t("application.menu") %>
      diff --git a/app/views/layouts/_meta_tags.html.erb b/app/views/layouts/_meta_tags.html.erb index 443f7352f..a729d2a77 100644 --- a/app/views/layouts/_meta_tags.html.erb +++ b/app/views/layouts/_meta_tags.html.erb @@ -1,5 +1,5 @@ " /> + content="<%= content_for?(:meta_description) ? yield(:meta_description) : setting["meta_description"] %>" /> " /> + content="<%= content_for?(:meta_keywords) ? yield(:meta_keywords) : setting["meta_keywords"] %>" /> diff --git a/app/views/layouts/_tracking_data.html.erb b/app/views/layouts/_tracking_data.html.erb index a0be1bafa..2287c46fd 100644 --- a/app/views/layouts/_tracking_data.html.erb +++ b/app/views/layouts/_tracking_data.html.erb @@ -1 +1 @@ -/> +/> diff --git a/app/views/legislation/proposals/_comments.html.erb b/app/views/legislation/proposals/_comments.html.erb index 6615c682b..092ec8140 100644 --- a/app/views/legislation/proposals/_comments.html.erb +++ b/app/views/legislation/proposals/_comments.html.erb @@ -16,7 +16,7 @@ <% end %> <% @comment_tree.root_comments.each do |comment| %> - <%= render "comments/comment", comment: comment %> + <%= render "comments/comment", comment: comment %> <% end %> <%= paginate @comment_tree.root_comments %>
      diff --git a/app/views/legislation/proposals/_featured_votes.html.erb b/app/views/legislation/proposals/_featured_votes.html.erb index a6263ee2e..01f05497c 100644 --- a/app/views/legislation/proposals/_featured_votes.html.erb +++ b/app/views/legislation/proposals/_featured_votes.html.erb @@ -19,7 +19,7 @@ <%= t("votes.organizations") %>

      - <% elsif user_signed_in? && !proposal.votable_by?(current_user)%> + <% elsif user_signed_in? && !proposal.votable_by?(current_user) %>
    • <%= link_to_investments_sorted_by :id %><%= link_to_investments_sorted_by :id %> <%= link_to_investments_sorted_by :title %> <%= link_to_investments_sorted_by :supports %> <%= t("admin.budget_investments.index.list.admin") %> <% if draft_version.status == "draft" %> <%= t("admin.legislation.draft_versions.statuses.draft") %> - <%= link_to "(#{t(".preview")})", legislation_process_draft_version_path(@process, draft_version) %> + <%= link_to "(#{t(".preview")})", legislation_process_draft_version_path(@process, draft_version) %> <% else %> <%= t("admin.legislation.draft_versions.statuses.published") %> <% end %> diff --git a/app/views/admin/legislation/questions/_question_option_fields.html.erb b/app/views/admin/legislation/questions/_question_option_fields.html.erb index e1f729a0e..c610c298c 100644 --- a/app/views/admin/legislation/questions/_question_option_fields.html.erb +++ b/app/views/admin/legislation/questions/_question_option_fields.html.erb @@ -9,7 +9,7 @@
      - <%= link_to_remove_association t("admin.legislation.questions.question_option_fields.remove_option"), f, class: "delete"%> + <%= link_to_remove_association t("admin.legislation.questions.question_option_fields.remove_option"), f, class: "delete" %>
      diff --git a/app/views/admin/organizations/index.html.erb b/app/views/admin/organizations/index.html.erb index c42f3fcd6..9b3d3249f 100644 --- a/app/views/admin/organizations/index.html.erb +++ b/app/views/admin/organizations/index.html.erb @@ -57,7 +57,7 @@ <% if can? :reject, organization %> <%= link_to t("admin.organizations.index.reject"), reject_admin_organization_path(organization, request.query_parameters), - method: :put, class: "button hollow alert small-5"%> + method: :put, class: "button hollow alert small-5" %> <% end %>
      - <%= total_recounts_by_booth(@booth_assignment) || "-" %> + <%= total_recounts_by_booth(@booth_assignment) || "-" %>
      <%= l(officer_assignment.date.to_date)%> <%= content_tag :strong, t("polls.final_date") if officer_assignment.final %><%= l(officer_assignment.date.to_date) %> <%= content_tag :strong, t("polls.final_date") if officer_assignment.final %> <%= booth_name_with_location(officer_assignment.booth_assignment.booth) %>
      diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb index cc4ee29f4..45336c13b 100644 --- a/app/views/mailer/direct_message_for_sender.html.erb +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -10,6 +10,6 @@
      - <%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %> + <%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %>
      diff --git a/app/views/officing/_menu.html.erb b/app/views/officing/_menu.html.erb index 5630702c0..00c9c39d2 100644 --- a/app/views/officing/_menu.html.erb +++ b/app/views/officing/_menu.html.erb @@ -18,6 +18,6 @@ <%= t("officing.menu.total_recounts") %> <% end %> - <% end%> + <% end %> diff --git a/app/views/officing/residence/_errors.html.erb b/app/views/officing/residence/_errors.html.erb index 4f8895a35..e24dfee0d 100644 --- a/app/views/officing/residence/_errors.html.erb +++ b/app/views/officing/residence/_errors.html.erb @@ -10,5 +10,5 @@ <% else %> <%= render "shared/errors", resource: @residence, - message: t("officing.residence.new.form_errors") %> + message: t("officing.residence.new.form_errors") %> <% end %> diff --git a/app/views/officing/results/new.html.erb b/app/views/officing/results/new.html.erb index 4beda8f75..eb2a0ca5b 100644 --- a/app/views/officing/results/new.html.erb +++ b/app/views/officing/results/new.html.erb @@ -66,7 +66,7 @@
      - + diff --git a/app/views/pages/custom_page.html.erb b/app/views/pages/custom_page.html.erb index e2c6bbeb1..58181259d 100644 --- a/app/views/pages/custom_page.html.erb +++ b/app/views/pages/custom_page.html.erb @@ -6,7 +6,7 @@

      <%= @custom_page.title %>

      <% if @custom_page.subtitle.present? %> -

      <%= @custom_page.subtitle%>

      +

      <%= @custom_page.subtitle %>

      <% end %> <%= safe_html_with_links AdminWYSIWYGSanitizer.new.sanitize(@custom_page.content) %> diff --git a/app/views/polls/_comments.html.erb b/app/views/polls/_comments.html.erb index f8b9a72b6..82eb6b165 100644 --- a/app/views/polls/_comments.html.erb +++ b/app/views/polls/_comments.html.erb @@ -16,7 +16,7 @@ <% end %> <% @comment_tree.root_comments.each do |comment| %> - <%= render "comments/comment", comment: comment %> + <%= render "comments/comment", comment: comment %> <% end %> <%= paginate @comment_tree.root_comments %>
      diff --git a/app/views/proposals/_comments.html.erb b/app/views/proposals/_comments.html.erb index 6615c682b..092ec8140 100644 --- a/app/views/proposals/_comments.html.erb +++ b/app/views/proposals/_comments.html.erb @@ -16,7 +16,7 @@ <% end %> <% @comment_tree.root_comments.each do |comment| %> - <%= render "comments/comment", comment: comment %> + <%= render "comments/comment", comment: comment %> <% end %> <%= paginate @comment_tree.root_comments %> diff --git a/app/views/proposals/_featured_votes.html.erb b/app/views/proposals/_featured_votes.html.erb index a6263ee2e..01f05497c 100644 --- a/app/views/proposals/_featured_votes.html.erb +++ b/app/views/proposals/_featured_votes.html.erb @@ -19,7 +19,7 @@ <%= t("votes.organizations") %>

      - <% elsif user_signed_in? && !proposal.votable_by?(current_user)%> + <% elsif user_signed_in? && !proposal.votable_by?(current_user) %>
      <%= t("officing.results.new.date") %><%= t("officing.results.new.date") %> <%= t("officing.results.new.booth") %>