Add rubocop spacing rules
We were following these rules in most places; we just didn't define them anywhere.
This commit is contained in:
@@ -81,7 +81,7 @@ class Admin::BudgetsController < Admin::BaseController
|
||||
private
|
||||
|
||||
def budget_params
|
||||
descriptions = Budget::Phase::PHASE_KINDS.map{|p| "description_#{p}"}.map(&:to_sym)
|
||||
descriptions = Budget::Phase::PHASE_KINDS.map { |p| "description_#{p}" }.map(&:to_sym)
|
||||
valid_attributes = [:phase,
|
||||
:currency_symbol,
|
||||
:help_link,
|
||||
|
||||
@@ -7,7 +7,7 @@ class Admin::CommentsController < Admin::BaseController
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv {send_data to_csv(Comment.sort_by_newest, Comment),
|
||||
format.csv { send_data to_csv(Comment.sort_by_newest, Comment),
|
||||
type: "text/csv",
|
||||
disposition: "attachment",
|
||||
filename: "comments.csv" }
|
||||
|
||||
@@ -17,7 +17,7 @@ class Admin::Dashboard::AdministratorTasksController < Admin::Dashboard::BaseCon
|
||||
|
||||
administrator_task.update(user: current_user, executed_at: Time.current)
|
||||
redirect_to admin_dashboard_administrator_tasks_path,
|
||||
{ flash: { notice: t("admin.dashboard.administrator_tasks.update.success") } }
|
||||
{ flash: { notice: t("admin.dashboard.administrator_tasks.update.success") }}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -4,7 +4,7 @@ class Admin::DownloadSettingsController < Admin::BaseController
|
||||
load_and_authorize_resource
|
||||
|
||||
def edit
|
||||
permitted = downloadable_params
|
||||
permitted = downloadable_params
|
||||
@download_settings = []
|
||||
if permitted_models.include? permitted[:resource]
|
||||
set_edit(permitted[:resource])
|
||||
@@ -12,7 +12,7 @@ class Admin::DownloadSettingsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def update
|
||||
permitted = downloadable_params
|
||||
permitted = downloadable_params
|
||||
if permitted[:downloadable]
|
||||
DownloadSetting.where(name_model: get_model(permitted[:resource]).to_s,
|
||||
config: permitted[:config].to_i).each do |download_setting|
|
||||
@@ -27,7 +27,7 @@ class Admin::DownloadSettingsController < Admin::BaseController
|
||||
private
|
||||
|
||||
def set_edit(resource)
|
||||
@download_resource = {name: resource, config: get_config}
|
||||
@download_resource = { name: resource, config: get_config }
|
||||
@download_settings = get_attrs(get_model(resource), get_config)
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
||||
.page(params[:page])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv {send_data to_csv(process_for_download, Legislation::Process),
|
||||
format.csv { send_data to_csv(process_for_download, Legislation::Process),
|
||||
type: "text/csv",
|
||||
disposition: "attachment",
|
||||
filename: "legislation_processes.csv" }
|
||||
|
||||
@@ -4,7 +4,7 @@ class Admin::LocalCensusRecords::ImportsController < Admin::LocalCensusRecords::
|
||||
def create
|
||||
@import = LocalCensusRecords::Import.new(local_census_records_import_params)
|
||||
if @import.save
|
||||
flash.now[:notice] = t("admin.local_census_records.imports.create.notice")
|
||||
flash.now[:notice] = t("admin.local_census_records.imports.create.notice")
|
||||
render :show
|
||||
else
|
||||
render :new
|
||||
|
||||
@@ -18,7 +18,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
||||
def show
|
||||
included_relations = [:recounts, :voters, officer_assignments: [officer: [:user]]]
|
||||
@booth_assignment = @poll.booth_assignments.includes(*included_relations).find(params[:id])
|
||||
@voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date}
|
||||
@voters_by_date = @booth_assignment.voters.group_by { |v| v.created_at.to_date }
|
||||
@partial_results = @booth_assignment.partial_results
|
||||
@recounts = @booth_assignment.recounts
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ class Admin::SiteCustomization::ImagesController < Admin::SiteCustomization::Bas
|
||||
flash.now[:error] = t("admin.site_customization.images.update.error")
|
||||
|
||||
@images = SiteCustomization::Image.all_images
|
||||
idx = @images.index {|e| e.name == @image.name }
|
||||
idx = @images.index { |e| e.name == @image.name }
|
||||
@images[idx] = @image
|
||||
|
||||
render :index
|
||||
|
||||
@@ -77,13 +77,13 @@ class Admin::StatsController < Admin::BaseController
|
||||
|
||||
authorize! :read_admin_stats, @budget, message: t("admin.stats.budgets.no_data_before_balloting_phase")
|
||||
|
||||
@user_count = @budget.ballots.select {|ballot| ballot.lines.any? }.count
|
||||
@user_count = @budget.ballots.select { |ballot| ballot.lines.any? }.count
|
||||
|
||||
@vote_count = @budget.lines.count
|
||||
|
||||
@vote_count_by_heading = @budget.lines.group(:heading_id).count.collect {|k,v| [Budget::Heading.find(k).name, v]}.sort
|
||||
@vote_count_by_heading = @budget.lines.group(:heading_id).count.collect { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||
|
||||
@user_count_by_district = User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.collect {|k,v| [Budget::Heading.find(k).name, v]}.sort
|
||||
@user_count_by_district = User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.collect { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||
end
|
||||
|
||||
def polls
|
||||
|
||||
@@ -98,7 +98,7 @@ module Budgets
|
||||
end
|
||||
|
||||
def json_data
|
||||
investment = Budget::Investment.find(params[:id])
|
||||
investment = Budget::Investment.find(params[:id])
|
||||
data = {
|
||||
investment_id: investment.id,
|
||||
investment_title: investment.title,
|
||||
|
||||
@@ -28,7 +28,7 @@ module CommentableActions
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv {send_data to_csv(resources_csv, resource_model),
|
||||
format.csv { send_data to_csv(resources_csv, resource_model),
|
||||
type: "text/csv",
|
||||
disposition: "attachment",
|
||||
filename: "#{get_resource(resource_model)}.csv" }
|
||||
|
||||
@@ -60,7 +60,7 @@ module Dashboard::GroupSupports
|
||||
end
|
||||
|
||||
def calculate_year_of_week(date)
|
||||
year = date.year
|
||||
year = date.year
|
||||
if first_week_of_year?(date) && date.end_of_week.year != date.year
|
||||
year = year + 1
|
||||
elsif last_week_of_year?(date) && date.beginning_of_week.year != date.year
|
||||
|
||||
@@ -19,14 +19,14 @@ module ModerateActions
|
||||
@resources = @resources.where(id: params[:resource_ids])
|
||||
|
||||
if params[:hide_resources].present?
|
||||
@resources.accessible_by(current_ability, :hide).each {|resource| hide_resource resource}
|
||||
@resources.accessible_by(current_ability, :hide).each { |resource| hide_resource resource }
|
||||
|
||||
elsif params[:ignore_flags].present?
|
||||
@resources.accessible_by(current_ability, :ignore_flag).each(&:ignore_flag)
|
||||
|
||||
elsif params[:block_authors].present?
|
||||
author_ids = @resources.pluck(author_id).uniq
|
||||
User.where(id: author_ids).accessible_by(current_ability, :block).each {|user| block_user user}
|
||||
User.where(id: author_ids).accessible_by(current_ability, :block).each { |user| block_user user }
|
||||
end
|
||||
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
|
||||
@@ -20,7 +20,7 @@ class Dashboard::ActionsController < Dashboard::BaseController
|
||||
Dashboard::AdministratorTask.create(source: @dashboard_executed_action)
|
||||
|
||||
redirect_to progress_proposal_dashboard_path(proposal.to_param),
|
||||
{ flash: { info: t("dashboard.create_request.success") } }
|
||||
{ flash: { info: t("dashboard.create_request.success") }}
|
||||
else
|
||||
flash.now[:alert] = @dashboard_executed_action.errors.full_messages.join("<br>")
|
||||
render :new_request
|
||||
|
||||
@@ -18,7 +18,7 @@ class DirectUploadsController < ApplicationController
|
||||
render json: { cached_attachment: @direct_upload.relation.cached_attachment,
|
||||
filename: @direct_upload.relation.attachment.original_filename,
|
||||
destroy_link: render_destroy_upload_link(@direct_upload).html_safe,
|
||||
attachment_url: @direct_upload.relation.attachment.url}
|
||||
attachment_url: @direct_upload.relation.attachment.url }
|
||||
else
|
||||
@direct_upload.destroy_attachment
|
||||
render json: { errors: @direct_upload.errors[:attachment].join(", ") },
|
||||
|
||||
@@ -111,7 +111,7 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
@phase = :resume
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xlsx {render xlsx: "resume_to_xlsx", filename: ("resume-" + Date.current.to_s + ".xlsx")}
|
||||
format.xlsx { render xlsx: "resume_to_xlsx", filename: ("resume-" + Date.current.to_s + ".xlsx") }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ class Management::SessionsController < ActionController::Base
|
||||
|
||||
def admin?
|
||||
if current_user.try(:administrator?)
|
||||
session[:manager] = {login: "admin_user_#{current_user.id}"}
|
||||
session[:manager] = { login: "admin_user_#{current_user.id}" }
|
||||
end
|
||||
end
|
||||
|
||||
def manager?
|
||||
if current_user.try(:manager?)
|
||||
session[:manager] = {login: "manager_user_#{current_user.id}"}
|
||||
session[:manager] = { login: "manager_user_#{current_user.id}" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ class Officing::PollsController < Officing::BaseController
|
||||
|
||||
def index
|
||||
@polls = current_user.poll_officer? ? current_user.poll_officer.voting_days_assigned_polls : []
|
||||
@polls = @polls.select {|poll| poll.current?(Time.current) || poll.current?(1.day.ago)}
|
||||
@polls = @polls.select { |poll| poll.current?(Time.current) || poll.current?(1.day.ago) }
|
||||
end
|
||||
|
||||
def final
|
||||
|
||||
@@ -19,7 +19,7 @@ class Polls::AnswersController < ApplicationController
|
||||
load_for_answers
|
||||
if @question.enum_type&.include?("answer_couples")
|
||||
last_pair ||= generate_and_store_new_pair(@question)
|
||||
@last_pair_question_answers = {@question.id => last_pair}
|
||||
@last_pair_question_answers = { @question.id => last_pair }
|
||||
end
|
||||
render "polls/questions/answer", format: :js
|
||||
end
|
||||
@@ -34,7 +34,7 @@ class Polls::AnswersController < ApplicationController
|
||||
load_for_answers
|
||||
if @question.enum_type&.include?("answer_couples")
|
||||
last_pair ||= generate_and_store_new_pair(@question)
|
||||
@last_pair_question_answers = {@question.id => last_pair}
|
||||
@last_pair_question_answers = { @question.id => last_pair }
|
||||
end
|
||||
render "polls/questions/answer", format: :js
|
||||
end
|
||||
@@ -53,10 +53,10 @@ class Polls::AnswersController < ApplicationController
|
||||
def load_for_answers
|
||||
@page = params[:page].present? ? params[:page] : 1
|
||||
question_answers
|
||||
@answers_by_question_id = {@question.id => @question.answers
|
||||
@answers_by_question_id = { @question.id => @question.answers
|
||||
.by_author(current_user)
|
||||
.order(:order)
|
||||
.pluck(:answer)}
|
||||
.pluck(:answer) }
|
||||
end
|
||||
|
||||
def question_answers
|
||||
|
||||
@@ -11,7 +11,7 @@ class Polls::QuestionsController < ApplicationController
|
||||
load_for_answers
|
||||
if @question.enum_type&.include?("answer_couples")
|
||||
last_pair ||= generate_and_store_new_pair(@question)
|
||||
@last_pair_question_answers = {@question.id => last_pair}
|
||||
@last_pair_question_answers = { @question.id => last_pair }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,10 +39,10 @@ class Polls::QuestionsController < ApplicationController
|
||||
def load_for_answers
|
||||
@page = params[:page].present? ? params[:page] : 1
|
||||
question_answers
|
||||
@answers_by_question_id = {@question.id => @question.answers
|
||||
@answers_by_question_id = { @question.id => @question.answers
|
||||
.by_author(current_user)
|
||||
.order(:order)
|
||||
.pluck(:answer)}
|
||||
.pluck(:answer) }
|
||||
end
|
||||
|
||||
def vote_stored(answer, new_answer, token)
|
||||
|
||||
@@ -98,7 +98,7 @@ class ProposalsController < ApplicationController
|
||||
private
|
||||
|
||||
def proposal_params
|
||||
attributes = [:video_url,:responsible_name, :tag_list,
|
||||
attributes = [:video_url, :responsible_name, :tag_list,
|
||||
:terms_of_service, :geozone_id, :skip_map,
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment,
|
||||
|
||||
@@ -20,7 +20,7 @@ class RemoteTranslationsController < ApplicationController
|
||||
def set_remote_translations
|
||||
remote_translations = remote_translations_params["remote_translations"]
|
||||
decoded_remote_translations = ActiveSupport::JSON.decode(remote_translations)
|
||||
@remote_translations = decoded_remote_translations.map{ |remote_translation|
|
||||
@remote_translations = decoded_remote_translations.map { |remote_translation|
|
||||
remote_translation.slice("remote_translatable_id",
|
||||
"remote_translatable_type",
|
||||
"locale")
|
||||
|
||||
@@ -63,7 +63,7 @@ class Tracking::BudgetInvestmentsController < Tracking::BaseController
|
||||
filters << {
|
||||
name: heading.name,
|
||||
id: heading.id,
|
||||
count: investments.select{|i| i.heading_id == heading.id}.size
|
||||
count: investments.select { |i| i.heading_id == heading.id }.size
|
||||
}
|
||||
end
|
||||
filters.uniq
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Tracking::ProposalProgressBarsController < Tracking::ProgressBarsController
|
||||
class Tracking::ProposalProgressBarsController < Tracking::ProgressBarsController
|
||||
|
||||
private
|
||||
def progressable
|
||||
|
||||
@@ -19,7 +19,7 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
|
||||
end
|
||||
else
|
||||
resource.errors.add(:email, :password_already_set)
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,14 +33,14 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
|
||||
|
||||
# New condition added to if: when no password was given, display the "show" view (which uses "update" above)
|
||||
if resource.encrypted_password.blank?
|
||||
respond_with_navigational(resource){ render :show }
|
||||
respond_with_navigational(resource) { render :show }
|
||||
elsif resource.errors.empty?
|
||||
set_official_position if resource.has_official_email?
|
||||
resource.confirm # Last change: confirm happens here for people with passwords instead of af the top of the show action
|
||||
set_flash_message(:notice, :confirmed) if is_flashing_format?
|
||||
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
|
||||
respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) }
|
||||
else
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||
|
||||
def check_username
|
||||
if User.find_by username: params[:username]
|
||||
render json: {available: false, message: t("devise_views.users.registrations.new.username_is_not_available")}
|
||||
render json: { available: false, message: t("devise_views.users.registrations.new.username_is_not_available") }
|
||||
else
|
||||
render json: {available: true, message: t("devise_views.users.registrations.new.username_is_available")}
|
||||
render json: { available: true, message: t("devise_views.users.registrations.new.username_is_available") }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
||||
filters << {
|
||||
name: heading.name,
|
||||
id: heading.id,
|
||||
count: investments.select{|i| i.heading_id == heading.id}.size
|
||||
count: investments.select { |i| i.heading_id == heading.id }.size
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user