Apply PercentLiteralDelimiters rubocop rule

This commit is contained in:
Javi Martín
2019-06-18 02:09:10 +02:00
parent 17c36c6c6c
commit b5b07bccd3
49 changed files with 79 additions and 79 deletions

View File

@@ -353,6 +353,3 @@ Security/MarshalLoad:
Security/YAMLLoad:
Enabled: true
Style/PercentLiteralDelimiters:
Enabled: true

View File

@@ -68,5 +68,8 @@ Rails/TimeZone:
RSpec/NotToNot:
Enabled: true
Style/PercentLiteralDelimiters:
Enabled: true
Style/StringLiterals:
EnforcedStyle: double_quotes

View File

@@ -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)

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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]

View File

@@ -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]

View File

@@ -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

View File

@@ -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]

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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?

View File

@@ -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"

View File

@@ -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}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -93,7 +93,7 @@ class Signature < ApplicationRecord
end
def document_types
%w(1 2 3 4)
%w[1 2 3 4]
end
end

View File

@@ -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

View File

@@ -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?

View File

@@ -58,7 +58,7 @@
<strong><%= t("admin.menu.title_booths") %></strong>
</a>
<ul id="booths_menu" <%= "class=is-active" if menu_booths? || controller_name == "polls" && action_name == "booth_assignments" %>>
<li <%= "class=is-active" if %w(officers officer_assignments).include?(controller_name) %>>
<li <%= "class=is-active" if %w[officers officer_assignments].include?(controller_name) %>>
<%= link_to t("admin.menu.poll_officers"), admin_officers_path %>
</li>
@@ -74,8 +74,8 @@
<%= link_to t("admin.menu.poll_booth_assignments"), booth_assignments_admin_polls_path %>
</li>
<li <%= "class=is-active" if %w(shifts booths).include?(controller_name) &&
%w(available new).include?(action_name) %>>
<li <%= "class=is-active" if %w[shifts booths].include?(controller_name) &&
%w[available new].include?(action_name) %>>
<%= link_to t("admin.menu.poll_shifts"), available_admin_booths_path %>
</li>
</ul>
@@ -90,7 +90,7 @@
</li>
<% 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) %>
<li class="section-title" <%= "class=is-active" if messages_menu_active %>>
<a href="#">

View File

@@ -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 }

View File

@@ -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]

View File

@@ -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)

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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) }

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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