Merge pull request #4921 from consul/dependabot/bundler/master/rubocop-1.35.1
Bump rubocop from 1.18.4 to 1.35.1
This commit is contained in:
15
.rubocop.yml
15
.rubocop.yml
@@ -66,6 +66,9 @@ Layout/IndentationWidth:
|
||||
Layout/LeadingEmptyLines:
|
||||
Enabled: true
|
||||
|
||||
Layout/LineEndStringConcatenationIndentation:
|
||||
Enabled: true
|
||||
|
||||
Layout/LineLength:
|
||||
Max: 110
|
||||
Severity: refactor
|
||||
@@ -176,6 +179,9 @@ Lint/EmptyFile:
|
||||
Lint/LiteralAsCondition:
|
||||
Enabled: true
|
||||
|
||||
Lint/NonAtomicFileOperation:
|
||||
Enabled: true
|
||||
|
||||
Lint/ParenthesesAsGroupedExpression:
|
||||
Enabled: true
|
||||
|
||||
@@ -482,6 +488,12 @@ Style/ClassVars:
|
||||
Style/CollectionMethods:
|
||||
Enabled: true
|
||||
|
||||
Style/FileRead:
|
||||
Enabled: true
|
||||
|
||||
Style/FileWrite:
|
||||
Enabled: true
|
||||
|
||||
Style/HashConversion:
|
||||
Enabled: true
|
||||
|
||||
@@ -500,6 +512,9 @@ Style/IdenticalConditionalBranches:
|
||||
Style/IfWithBooleanLiteralBranches:
|
||||
Enabled: true
|
||||
|
||||
Style/MapToHash:
|
||||
Enabled: true
|
||||
|
||||
Style/MethodDefParentheses:
|
||||
Enabled: true
|
||||
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -106,7 +106,7 @@ group :development do
|
||||
gem "pronto-eslint", "~> 0.11.0", require: false
|
||||
gem "pronto-rubocop", "~> 0.11.2", require: false
|
||||
gem "pronto-scss", "~> 0.11.0", require: false
|
||||
gem "rubocop", "~> 1.18.4", require: false
|
||||
gem "rubocop", "~> 1.35.1", require: false
|
||||
gem "rubocop-performance", "~> 1.11.4", require: false
|
||||
gem "rubocop-rails", "~> 2.15.2", require: false
|
||||
gem "rubocop-rspec", "~> 2.4.0", require: false
|
||||
|
||||
11
Gemfile.lock
11
Gemfile.lock
@@ -551,13 +551,14 @@ GEM
|
||||
rspec-mocks (~> 3.10)
|
||||
rspec-support (~> 3.10)
|
||||
rspec-support (3.11.0)
|
||||
rubocop (1.18.4)
|
||||
rubocop (1.35.1)
|
||||
json (~> 2.3)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
parser (>= 3.1.2.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml
|
||||
rubocop-ast (>= 1.8.0, < 2.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.20.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.21.0)
|
||||
@@ -784,7 +785,7 @@ DEPENDENCIES
|
||||
responders (~> 3.0.1)
|
||||
rinku (~> 2.0.6)
|
||||
rspec-rails (~> 5.1.2)
|
||||
rubocop (~> 1.18.4)
|
||||
rubocop (~> 1.35.1)
|
||||
rubocop-performance (~> 1.11.4)
|
||||
rubocop-rails (~> 2.15.2)
|
||||
rubocop-rspec (~> 2.4.0)
|
||||
|
||||
@@ -13,7 +13,7 @@ module SettingsHelper
|
||||
end
|
||||
|
||||
def setting
|
||||
@all_settings ||= Setting.all.map { |s| [s.key, s.value.presence] }.to_h
|
||||
@all_settings ||= Setting.all.to_h { |s| [s.key, s.value.presence] }
|
||||
end
|
||||
|
||||
def display_setting_name(setting_name)
|
||||
|
||||
@@ -2,7 +2,7 @@ module JsonExporter
|
||||
def to_json_file(filename)
|
||||
data = []
|
||||
model.find_each { |record| data << json_values(record) }
|
||||
File.open(filename, "w") { |file| file.write(data.to_json) }
|
||||
File.write(filename, data.to_json)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -95,7 +95,7 @@ module Statisticable
|
||||
end
|
||||
|
||||
def participants_by_age
|
||||
age_groups.map do |start, finish|
|
||||
age_groups.to_h do |start, finish|
|
||||
count = participants.between_ages(start, finish).count
|
||||
|
||||
[
|
||||
@@ -106,11 +106,11 @@ module Statisticable
|
||||
percentage: calculate_percentage(count, total_participants)
|
||||
}
|
||||
]
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
|
||||
def participants_by_geozone
|
||||
geozone_stats.map do |stats|
|
||||
geozone_stats.to_h do |stats|
|
||||
[
|
||||
stats.name,
|
||||
{
|
||||
@@ -118,7 +118,7 @@ module Statisticable
|
||||
percentage: stats.percentage
|
||||
}
|
||||
]
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
|
||||
def calculate_percentage(fraction, total)
|
||||
|
||||
@@ -113,9 +113,9 @@ class I18nContent < ApplicationRecord
|
||||
|
||||
def self.translations_hash(locale)
|
||||
Rails.cache.fetch(translation_class.where(locale: locale)) do
|
||||
all.map do |content|
|
||||
all.to_h do |content|
|
||||
[content.key, translation_class.find_by(i18n_content_id: content, locale: locale)&.value]
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,23 +2,23 @@ section "Creating Geozones" do
|
||||
Geozone.create!(name: I18n.t("seeds.geozones.north_district"),
|
||||
external_code: "001", census_code: "01",
|
||||
html_map_coordinates: "30,139,45,153,77,148,107,165,138,201,146,218,186,198,216,"\
|
||||
"196,233,203,240,215,283,194,329,185,377,184,388,165,369,126,333,113,334,84,320,"\
|
||||
"66,286,73,258,65,265,57,249,47,207,58,159,84,108,85,72,101,51,114")
|
||||
"196,233,203,240,215,283,194,329,185,377,184,388,165,369,126,333,113,334,84,320,"\
|
||||
"66,286,73,258,65,265,57,249,47,207,58,159,84,108,85,72,101,51,114")
|
||||
Geozone.create!(name: I18n.t("seeds.geozones.west_district"),
|
||||
external_code: "002", census_code: "02",
|
||||
html_map_coordinates: "42,153,31,176,24,202,20,221,44,235,59,249,55,320,30,354,"\
|
||||
"31,372,52,396,64,432,89,453,116,432,149,419,162,412,165,377,172,357,189,352,228,"\
|
||||
"327,246,313,262,297,234,291,210,284,193,284,176,294,158,303,154,310,146,289,140,"\
|
||||
"268,138,246,135,236,139,222,151,214,136,197,120,179,99,159,85,149,65,149,56,149")
|
||||
"31,372,52,396,64,432,89,453,116,432,149,419,162,412,165,377,172,357,189,352,228,"\
|
||||
"327,246,313,262,297,234,291,210,284,193,284,176,294,158,303,154,310,146,289,140,"\
|
||||
"268,138,246,135,236,139,222,151,214,136,197,120,179,99,159,85,149,65,149,56,149")
|
||||
Geozone.create!(name: I18n.t("seeds.geozones.east_district"),
|
||||
external_code: "003", census_code: "03",
|
||||
html_map_coordinates: "175,353,162,378,161,407,153,416,167,432,184,447,225,426,"\
|
||||
"250,409,283,390,298,369,344,363,351,334,356,296,361,267,376,245,378,185,327,188,"\
|
||||
"281,195,239,216,245,221,245,232,261,244,281,238,300,242,304,251,285,262,278,277,"\
|
||||
"267,294,249,312,219,333,198,346,184,353")
|
||||
"250,409,283,390,298,369,344,363,351,334,356,296,361,267,376,245,378,185,327,188,"\
|
||||
"281,195,239,216,245,221,245,232,261,244,281,238,300,242,304,251,285,262,278,277,"\
|
||||
"267,294,249,312,219,333,198,346,184,353")
|
||||
Geozone.create!(name: I18n.t("seeds.geozones.central_district"),
|
||||
external_code: "004", census_code: "04",
|
||||
html_map_coordinates: "152,308,137,258,133,235,147,216,152,214,186,194,210,196,"\
|
||||
"228,202,240,216,241,232,263,243,293,241,301,245,302,254,286,265,274,278,267,296,"\
|
||||
"243,293,226,289,209,285,195,283,177,297")
|
||||
"228,202,240,216,241,232,263,243,293,241,301,245,302,254,286,265,274,278,267,296,"\
|
||||
"243,293,226,289,209,285,195,283,177,297")
|
||||
end
|
||||
|
||||
@@ -84,9 +84,9 @@ class UserSegments
|
||||
end
|
||||
|
||||
def self.geozones
|
||||
Geozone.order(:name).map do |geozone|
|
||||
Geozone.order(:name).to_h do |geozone|
|
||||
[geozone.name.gsub(/./) { |char| character_approximation(char) }.underscore.tr(" ", "_"), geozone]
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
|
||||
def self.character_approximation(char)
|
||||
|
||||
@@ -4,7 +4,7 @@ describe "rake sitemap:create", type: :system do
|
||||
let(:file) { Rails.root.join("public", "sitemap.xml") }
|
||||
|
||||
before do
|
||||
File.delete(file) if File.exist?(file)
|
||||
FileUtils.rm_f(file)
|
||||
Rake::Task["sitemap:create"].reenable
|
||||
end
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ describe "Admin administrators" do
|
||||
visit admin_administrators_path
|
||||
|
||||
confirmation = "Are you sure? This action will delete "\
|
||||
"\"#{user_administrator.name}\" and can't be undone."
|
||||
"\"#{user_administrator.name}\" and can't be undone."
|
||||
|
||||
within "#administrator_#{user_administrator.id}" do
|
||||
accept_confirm(confirmation) { click_button "Delete" }
|
||||
|
||||
@@ -140,7 +140,7 @@ describe "Admin local census records", :admin do
|
||||
expect(page).to have_content deleted_document_number
|
||||
|
||||
confirmation = "Are you sure? This action will delete "\
|
||||
"\"#{local_census_record.title}\" and can't be undone."
|
||||
"\"#{local_census_record.title}\" and can't be undone."
|
||||
|
||||
accept_confirm(confirmation) { click_on "Delete" }
|
||||
|
||||
|
||||
@@ -216,9 +216,9 @@ describe "Machine learning" do
|
||||
kind: "comments_summary",
|
||||
updated_at: 2.minutes.from_now)
|
||||
comments_file = MachineLearning::DATA_FOLDER.join(MachineLearning.comments_filename)
|
||||
File.open(comments_file, "w") { |file| file.write([].to_json) }
|
||||
File.write(comments_file, [].to_json)
|
||||
proposals_comments_summary_file = MachineLearning::DATA_FOLDER.join(MachineLearning.proposals_comments_summary_filename)
|
||||
File.open(proposals_comments_summary_file, "w") { |file| file.write([].to_json) }
|
||||
File.write(proposals_comments_summary_file, [].to_json)
|
||||
end
|
||||
|
||||
visit admin_machine_learning_path
|
||||
|
||||
@@ -9,9 +9,9 @@ describe "Admin edit translatable records", :admin do
|
||||
let(:fields) { translatable.translated_attribute_names }
|
||||
|
||||
let(:attributes) do
|
||||
fields.product(%i[en es]).map do |field, locale|
|
||||
fields.product(%i[en es]).to_h do |field, locale|
|
||||
[:"#{field}_#{locale}", text_for(field, locale)]
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
|
||||
context "Add a translation" do
|
||||
|
||||
@@ -604,7 +604,7 @@ describe "Budget Investments" do
|
||||
fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds"
|
||||
fill_in "Location additional info", with: "City center"
|
||||
fill_in "If you are proposing in the name of a collective/organization, "\
|
||||
"or on behalf of more people, write its name", with: "T.I.A."
|
||||
"or on behalf of more people, write its name", with: "T.I.A."
|
||||
fill_in "Tags", with: "Towers"
|
||||
check "I agree to the Privacy Policy and the Terms and conditions of use"
|
||||
|
||||
@@ -669,7 +669,7 @@ describe "Budget Investments" do
|
||||
fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds"
|
||||
fill_in "Location additional info", with: "City center"
|
||||
fill_in "If you are proposing in the name of a collective/organization, "\
|
||||
"or on behalf of more people, write its name", with: "T.I.A."
|
||||
"or on behalf of more people, write its name", with: "T.I.A."
|
||||
fill_in "Tags", with: "Towers"
|
||||
check "I agree to the Privacy Policy and the Terms and conditions of use"
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ describe "Local Targets" do
|
||||
visit sdg_management_local_targets_path
|
||||
|
||||
confirmation = "Are you sure? This action will delete "\
|
||||
"\"#{sdg_local_target.title}\" and can't be undone."
|
||||
"\"#{sdg_local_target.title}\" and can't be undone."
|
||||
|
||||
accept_confirm(confirmation) { click_button "Delete" }
|
||||
|
||||
|
||||
@@ -182,9 +182,9 @@ describe "Public area translatable records" do
|
||||
before { translatable.update(attributes.merge(author: user)) }
|
||||
|
||||
let(:attributes) do
|
||||
translatable.translated_attribute_names.product(%i[en es]).map do |field, locale|
|
||||
translatable.translated_attribute_names.product(%i[en es]).to_h do |field, locale|
|
||||
[:"#{field}_#{locale}", text_for(field, locale)]
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
|
||||
context "Update a translation" do
|
||||
|
||||
Reference in New Issue
Block a user