Add and apply rules for multi-line arrays
We were already applying these rules in most cases. Note we aren't enabling the `MultilineArrayLineBreaks` rule because we've got places with many elements whire it isn't clear whether having one element per line would make the code more readable.
This commit is contained in:
10
.rubocop.yml
10
.rubocop.yml
@@ -18,6 +18,9 @@ Bundler/OrderedGems:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
ConsiderPunctuation: true
|
ConsiderPunctuation: true
|
||||||
|
|
||||||
|
Layout/ArrayAlignment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Layout/AssignmentIndentation:
|
Layout/AssignmentIndentation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -57,6 +60,10 @@ Layout/EndOfLine:
|
|||||||
Layout/ExtraSpacing:
|
Layout/ExtraSpacing:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/FirstArrayElementIndentation:
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: consistent
|
||||||
|
|
||||||
Layout/HeredocIndentation:
|
Layout/HeredocIndentation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -79,6 +86,9 @@ Layout/LineLength:
|
|||||||
Max: 110
|
Max: 110
|
||||||
Severity: refactor
|
Severity: refactor
|
||||||
|
|
||||||
|
Layout/MultilineArrayBraceLayout:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Layout/MultilineBlockLayout:
|
Layout/MultilineBlockLayout:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,16 @@ class Shared::AdvancedSearchComponent < ApplicationComponent
|
|||||||
end
|
end
|
||||||
|
|
||||||
def date_range_options
|
def date_range_options
|
||||||
options_for_select([
|
options_for_select(
|
||||||
[t("shared.advanced_search.date_1"), 1],
|
[
|
||||||
[t("shared.advanced_search.date_2"), 2],
|
[t("shared.advanced_search.date_1"), 1],
|
||||||
[t("shared.advanced_search.date_3"), 3],
|
[t("shared.advanced_search.date_2"), 2],
|
||||||
[t("shared.advanced_search.date_4"), 4],
|
[t("shared.advanced_search.date_3"), 3],
|
||||||
[t("shared.advanced_search.date_5"), "custom"]],
|
[t("shared.advanced_search.date_4"), 4],
|
||||||
selected_date_range)
|
[t("shared.advanced_search.date_5"), "custom"]
|
||||||
|
],
|
||||||
|
selected_date_range
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def selected_date_range
|
def selected_date_range
|
||||||
|
|||||||
@@ -60,13 +60,14 @@ class Admin::BudgetsController < Admin::BaseController
|
|||||||
|
|
||||||
def allowed_params
|
def allowed_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,
|
valid_attributes = [
|
||||||
:currency_symbol,
|
:phase,
|
||||||
:voting_style,
|
:currency_symbol,
|
||||||
:hide_money,
|
:voting_style,
|
||||||
administrator_ids: [],
|
:hide_money,
|
||||||
valuator_ids: [],
|
administrator_ids: [],
|
||||||
image_attributes: image_attributes
|
valuator_ids: [],
|
||||||
|
image_attributes: image_attributes
|
||||||
] + descriptions
|
] + descriptions
|
||||||
|
|
||||||
[*valid_attributes, *report_attributes, translation_params(Budget)]
|
[*valid_attributes, *report_attributes, translation_params(Budget)]
|
||||||
|
|||||||
@@ -77,12 +77,12 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
|||||||
investment_headings = Budget::Heading.where(id: investments.pluck(:heading_id)).sort_by(&:name)
|
investment_headings = Budget::Heading.where(id: investments.pluck(:heading_id)).sort_by(&:name)
|
||||||
|
|
||||||
all_headings_filter = [
|
all_headings_filter = [
|
||||||
{
|
{
|
||||||
name: t("valuation.budget_investments.index.headings_filter_all"),
|
name: t("valuation.budget_investments.index.headings_filter_all"),
|
||||||
id: nil,
|
id: nil,
|
||||||
count: investments.size
|
count: investments.size
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
investment_headings.reduce(all_headings_filter) do |filters, heading|
|
investment_headings.reduce(all_headings_filter) do |filters, heading|
|
||||||
filters << {
|
filters << {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class Phase < ApplicationRecord
|
class Phase < ApplicationRecord
|
||||||
PHASE_KINDS = %w[informing accepting reviewing selecting valuating publishing_prices balloting
|
PHASE_KINDS = %w[informing accepting reviewing selecting valuating publishing_prices balloting
|
||||||
reviewing_ballots finished].freeze
|
reviewing_ballots finished].freeze
|
||||||
PUBLISHED_PRICES_PHASES = %w[publishing_prices balloting reviewing_ballots finished].freeze
|
PUBLISHED_PRICES_PHASES = %w[publishing_prices balloting reviewing_ballots finished].freeze
|
||||||
DESCRIPTION_MAX_LENGTH = 2000
|
DESCRIPTION_MAX_LENGTH = 2000
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ class Comment < ApplicationRecord
|
|||||||
include Searchable
|
include Searchable
|
||||||
|
|
||||||
COMMENTABLE_TYPES = %w[Debate Proposal Budget::Investment Poll Topic
|
COMMENTABLE_TYPES = %w[Debate Proposal Budget::Investment Poll Topic
|
||||||
Legislation::Question Legislation::Annotation
|
Legislation::Question Legislation::Annotation
|
||||||
Legislation::Proposal].freeze
|
Legislation::Proposal].freeze
|
||||||
|
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
|
|||||||
@@ -163,8 +163,7 @@ module Statisticable
|
|||||||
[75, 79],
|
[75, 79],
|
||||||
[80, 84],
|
[80, 84],
|
||||||
[85, 89],
|
[85, 89],
|
||||||
[90, 300]
|
[90, 300]]
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def participants_between_ages(from, to)
|
def participants_between_ages(from, to)
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ module Consul
|
|||||||
"uk-UA",
|
"uk-UA",
|
||||||
"val",
|
"val",
|
||||||
"zh-CN",
|
"zh-CN",
|
||||||
"zh-TW"]
|
"zh-TW"
|
||||||
|
]
|
||||||
config.i18n.available_locales = available_locales
|
config.i18n.available_locales = available_locales
|
||||||
config.i18n.fallbacks = [I18n.default_locale, {
|
config.i18n.fallbacks = [I18n.default_locale, {
|
||||||
"ca" => "es",
|
"ca" => "es",
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ describe "rake db:seed" do
|
|||||||
default_locales = I18n.available_locales
|
default_locales = I18n.available_locales
|
||||||
begin
|
begin
|
||||||
I18n.available_locales = [:ar, :bg, :bs, :ca, :cs, :da, :de, :el, :en, :es, :"es-PE", :eu, :fa, :fr,
|
I18n.available_locales = [:ar, :bg, :bs, :ca, :cs, :da, :de, :el, :en, :es, :"es-PE", :eu, :fa, :fr,
|
||||||
:gl, :he, :hr, :id, :it, :ka, :nl, :oc, :pl, :"pt-BR",
|
:gl, :he, :hr, :id, :it, :ka, :nl, :oc, :pl, :"pt-BR",
|
||||||
:ro, :ru, :sl, :sq, :so, :sr, :sv, :tr, :val, :"zh-CN", :"zh-TW"]
|
:ro, :ru, :sl, :sq, :so, :sr, :sv, :tr, :val, :"zh-CN", :"zh-TW"]
|
||||||
SiteCustomization::Page.destroy_all
|
SiteCustomization::Page.destroy_all
|
||||||
load Rails.root.join("db", "pages.rb")
|
load Rails.root.join("db", "pages.rb")
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ describe LocalCensusRecords::Import do
|
|||||||
invalid_records_document_types = [nil, "1", "2", "3", "DNI"]
|
invalid_records_document_types = [nil, "1", "2", "3", "DNI"]
|
||||||
invalid_records_document_numbers = ["44556678T", nil, "22556678T", "X11556678", "Z11556678"]
|
invalid_records_document_numbers = ["44556678T", nil, "22556678T", "X11556678", "Z11556678"]
|
||||||
invalid_records_date_of_births = [Date.parse("07/08/1984"), Date.parse("07/08/1985"), nil,
|
invalid_records_date_of_births = [Date.parse("07/08/1984"), Date.parse("07/08/1985"), nil,
|
||||||
Date.parse("07/08/1987"), Date.parse("07/08/1987")]
|
Date.parse("07/08/1987"), Date.parse("07/08/1987")]
|
||||||
invalid_records_postal_codes = ["7008", "7009", "7010", nil, "7011"]
|
invalid_records_postal_codes = ["7008", "7009", "7010", nil, "7011"]
|
||||||
expect(import.invalid_records.map(&:document_type))
|
expect(import.invalid_records.map(&:document_type))
|
||||||
.to eq(invalid_records_document_types)
|
.to eq(invalid_records_document_types)
|
||||||
|
|||||||
Reference in New Issue
Block a user