Add and apply MultilineMethodCallIndentation rule

This commit is contained in:
Javi Martín
2023-07-01 18:08:54 +02:00
parent 629e208e9d
commit 5b6de96241
35 changed files with 131 additions and 110 deletions

View File

@@ -108,6 +108,9 @@ Layout/MultilineHashBraceLayout:
Layout/MultilineHashKeyLineBreaks: Layout/MultilineHashKeyLineBreaks:
Enabled: true Enabled: true
Layout/MultilineMethodCallIndentation:
Enabled: true
Layout/MultilineOperationIndentation: Layout/MultilineOperationIndentation:
Enabled: true Enabled: true

View File

@@ -9,7 +9,9 @@ class Budgets::Executions::ImageComponent < ApplicationComponent
private private
def milestone def milestone
investment.milestones.order_by_publication_date investment.milestones
.select { |milestone| milestone.image.present? }.last .order_by_publication_date
.select { |milestone| milestone.image.present? }
.last
end end
end end

View File

@@ -8,7 +8,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
load_and_authorize_resource :process, class: "Legislation::Process" load_and_authorize_resource :process, class: "Legislation::Process"
def index def index
@processes = ::Legislation::Process.send(@current_filter).order(start_date: :desc) @processes = ::Legislation::Process.send(@current_filter)
.order(start_date: :desc)
.page(params[:page]) .page(params[:page])
end end

View File

@@ -7,9 +7,9 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
@officers = ::Poll::Officer @officers = ::Poll::Officer
.includes(:user) .includes(:user)
.order("users.username") .order("users.username")
.where( .where(id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id))
id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id) .page(params[:page])
).page(params[:page]).per(50) .per(50)
end end
def by_officer def by_officer

View File

@@ -4,7 +4,8 @@ class Admin::VerificationsController < Admin::BaseController
end end
def search def search
@users = User.incomplete_verification.search(params[:search]) @users = User.incomplete_verification
.search(params[:search])
.page(params[:page]) .page(params[:page])
.for_render .for_render
render :index render :index

View File

@@ -10,8 +10,11 @@ class Legislation::ProcessesController < Legislation::BaseController
def index def index
@current_filter ||= "open" @current_filter ||= "open"
@processes = ::Legislation::Process.send(@current_filter).published @processes = ::Legislation::Process.send(@current_filter)
.not_in_draft.order(start_date: :desc).page(params[:page]) .published
.not_in_draft
.order(start_date: :desc)
.page(params[:page])
end end
def show def show

View File

@@ -155,8 +155,10 @@ class ProposalsController < ApplicationController
return unless !@advanced_search_terms && @search_terms.blank? && params[:retired].blank? && @current_order != "recommendations" return unless !@advanced_search_terms && @search_terms.blank? && params[:retired].blank? && @current_order != "recommendations"
if Setting["feature.featured_proposals"] if Setting["feature.featured_proposals"]
@featured_proposals = Proposal.not_archived.unsuccessful @featured_proposals = Proposal.not_archived
.sort_by_confidence_score.limit(Setting["featured_proposals_number"]) .unsuccessful
.sort_by_confidence_score
.limit(Setting["featured_proposals_number"])
if @featured_proposals.present? if @featured_proposals.present?
@resources = @resources.where.not(id: @featured_proposals) @resources = @resources.where.not(id: @featured_proposals)
end end

View File

@@ -108,7 +108,8 @@ class Dashboard::Action < ApplicationRecord
end end
def self.calculate_actions(proposal_votes, day_offset, proposal) def self.calculate_actions(proposal_votes, day_offset, proposal)
Dashboard::Action.active.where("required_supports <= ?", proposal_votes) Dashboard::Action.active
.where("required_supports <= ?", proposal_votes)
.where("day_offset <= ?", day_offset) .where("day_offset <= ?", day_offset)
.by_published_proposal(proposal.published?) .by_published_proposal(proposal.published?)
end end

View File

@@ -16,14 +16,16 @@ class Poll
end end
def voting_days_assigned_polls def voting_days_assigned_polls
officer_assignments.voting_days.includes(booth_assignment: :poll) officer_assignments.voting_days
.includes(booth_assignment: :poll)
.map(&:booth_assignment) .map(&:booth_assignment)
.map(&:poll).uniq.compact .map(&:poll).uniq.compact
.sort { |x, y| y.ends_at <=> x.ends_at } .sort { |x, y| y.ends_at <=> x.ends_at }
end end
def final_days_assigned_polls def final_days_assigned_polls
officer_assignments.final.includes(booth_assignment: :poll) officer_assignments.final
.includes(booth_assignment: :poll)
.map(&:booth_assignment) .map(&:booth_assignment)
.map(&:poll).uniq.compact .map(&:poll).uniq.compact
.sort { |x, y| y.ends_at <=> x.ends_at } .sort { |x, y| y.ends_at <=> x.ends_at }

View File

@@ -1,5 +1,8 @@
<% annotation.comments.roots.sort_by_most_voted <% annotation.comments
.limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %> .roots
.sort_by_most_voted
.limit(Legislation::Annotation::COMMENTS_PAGE_SIZE)
.each do |comment| %>
<div class="comment"> <div class="comment">
<div class="comment-text"> <div class="comment-text">
<p><%= truncate comment.body, length: 250 %></p> <p><%= truncate comment.body, length: 250 %></p>

View File

@@ -10,7 +10,8 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
before do before do
Setting["feature.remote_translations"] = true Setting["feature.remote_translations"] = true
available_locales_response = %w[de en es fr pt zh-Hans] available_locales_response = %w[de en es fr pt zh-Hans]
expect(RemoteTranslations::Microsoft::AvailableLocales).to receive(:available_locales).at_most(4).times expect(RemoteTranslations::Microsoft::AvailableLocales)
.to receive(:available_locales).at_most(4).times
.and_return(available_locales_response) .and_return(available_locales_response)
allow(Rails.application.secrets).to receive(:microsoft_api_key).and_return("123") allow(Rails.application.secrets).to receive(:microsoft_api_key).and_return("123")
end end

View File

@@ -32,7 +32,8 @@ describe "DocumentVerifications" do
describe "Verifying througth Census" do describe "Verifying througth Census" do
context "Census API" do context "Census API" do
scenario "Verifying a user which does not exist and is not in the census shows an error" do scenario "Verifying a user which does not exist and is not in the census shows an error" do
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?) expect_any_instance_of(Verification::Management::Document)
.to receive(:in_census?)
.and_return(false) .and_return(false)
login_as_manager login_as_manager
@@ -55,7 +56,8 @@ describe "DocumentVerifications" do
context "Remote Census API", :remote_census do context "Remote Census API", :remote_census do
scenario "Verifying a user which does not exist and is not in the census shows an error" do scenario "Verifying a user which does not exist and is not in the census shows an error" do
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?) expect_any_instance_of(Verification::Management::Document)
.to receive(:in_census?)
.and_return(false) .and_return(false)
login_as_manager login_as_manager