Add and apply Style/MapIntoArray rubocop rule

This rule was added in rubocop 1.63.0.
This commit is contained in:
Javi Martín
2024-07-02 17:48:35 +02:00
committed by taitus
parent 71d0faf237
commit 46dc4a3163
3 changed files with 8 additions and 8 deletions

View File

@@ -715,6 +715,9 @@ Style/InvertibleUnlessCondition:
Style/LineEndConcatenation:
Enabled: true
Style/MapIntoArray:
Enabled: true
Style/MapToHash:
Enabled: true

View File

@@ -1,8 +1,7 @@
module OfficingHelper
def booths_for_officer_select_options(officer_assignments)
options = []
officer_assignments.each do |oa|
options << [oa.booth_assignment.booth.name.to_s, oa.id]
options = officer_assignments.map do |oa|
[oa.booth_assignment.booth.name.to_s, oa.id]
end
options.sort_by! { |x| x[0] }
options_for_select(options, params[:oa])

View File

@@ -191,14 +191,12 @@ class MachineLearning
end
def scripts_info
scripts_info = []
Dir[SCRIPTS_FOLDER.join("*.py")].each do |full_path_filename|
scripts_info << {
Dir[SCRIPTS_FOLDER.join("*.py")].map do |full_path_filename|
{
name: full_path_filename.split("/").last,
description: description_from(full_path_filename)
}
end
scripts_info.sort_by { |script_info| script_info[:name] }
end.sort_by { |script_info| script_info[:name] }
end
def description_from(script_filename)