Enable Style/SymbolProc

This commit is contained in:
gregoirenovel 2018-10-01 14:20:14 +02:00
parent 7e4268db67
commit d9d4f6fe20
16 changed files with 17 additions and 26 deletions

View file

@ -1205,7 +1205,8 @@ Style/SymbolLiteral:
Enabled: false Enabled: false
Style/SymbolProc: Style/SymbolProc:
Enabled: false Enabled: true
IgnoredMethods: [after]
Style/TernaryParentheses: Style/TernaryParentheses:
Enabled: false Enabled: false

View file

@ -10,7 +10,7 @@ class FranceConnect::ParticulierController < ApplicationController
fci = FranceConnectInformation fci = FranceConnectInformation
.find_by(france_connect_particulier_id: fetched_fci[:france_connect_particulier_id]) || .find_by(france_connect_particulier_id: fetched_fci[:france_connect_particulier_id]) ||
fetched_fci.tap { |object| object.save } fetched_fci.tap(&:save)
if fci.user.nil? if fci.user.nil?
user = User.find_or_create_by(email: fci.email_france_connect) do |new_user| user = User.find_or_create_by(email: fci.email_france_connect) do |new_user|

View file

@ -6,7 +6,7 @@ module NewUser
.includes(:procedure) .includes(:procedure)
.map(&:procedure) .map(&:procedure)
.uniq .uniq
.select { |p| p.publiee? } .select(&:publiee?)
@popular_demarches = Procedure @popular_demarches = Procedure
.includes(:service) .includes(:service)

View file

@ -2,8 +2,6 @@ class Administrateurs::ActivateBeforeExpirationJob < ApplicationJob
queue_as :cron queue_as :cron
def perform(*args) def perform(*args)
Administrateur.inactive.where(created_at: 3.days.ago.all_day).each do |a| Administrateur.inactive.where(created_at: 3.days.ago.all_day).each(&:remind_invitation!)
a.remind_invitation!
end
end end
end end

View file

@ -3,9 +3,7 @@ class AutoArchiveProcedureJob < ApplicationJob
def perform(*args) def perform(*args)
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure| Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
procedure.dossiers.state_en_construction.each do |dossier| procedure.dossiers.state_en_construction.each(&:en_instruction!)
dossier.en_instruction!
end
procedure.archive! procedure.archive!
end end

View file

@ -14,7 +14,7 @@ class ChampsService
def check_piece_justificative_files(champs) def check_piece_justificative_files(champs)
champs.select do |champ| champs.select do |champ|
champ.type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative) champ.type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative)
end.map { |c| c.piece_justificative_file_errors }.flatten end.map(&:piece_justificative_file_errors).flatten
end end
private private

View file

@ -70,6 +70,6 @@ class TypesDeChampService
end end
def self.clean_value(value) def self.clean_value(value)
value.split("\r\n").map{ |v| v.strip }.join("\r\n") value.split("\r\n").map(&:strip).join("\r\n")
end end
end end

View file

@ -124,9 +124,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
end end
def up def up
Gestionnaire.all.each do |gestionnaire| Gestionnaire.all.each(&:build_default_preferences_list_dossier)
gestionnaire.build_default_preferences_list_dossier
end
end end
def down def down

View file

@ -159,8 +159,6 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
end end
end end
Gestionnaire.all.each do |gestionnaire| Gestionnaire.all.each(&:build_default_preferences_list_dossier)
gestionnaire.build_default_preferences_list_dossier
end
end end
end end

View file

@ -1,7 +1,7 @@
class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0] class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
def change def change
all_mails = MailReceived.all all_mails = MailReceived.all
groupped = all_mails.group_by { |m| m.procedure_id } groupped = all_mails.group_by(&:procedure_id)
filtered = groupped.reject { |k, v| v.length < 2 } filtered = groupped.reject { |k, v| v.length < 2 }
filtered.each_value do |duplicate_mails| filtered.each_value do |duplicate_mails|
duplicate_mails.pop duplicate_mails.pop

View file

@ -119,7 +119,7 @@ module Cellar
doc = Nokogiri::XML(bucket_listing_xml) doc = Nokogiri::XML(bucket_listing_xml)
doc doc
.xpath('//xmlns:Contents/xmlns:Key') .xpath('//xmlns:Contents/xmlns:Key')
.map{ |k| k.text } .map(&:text)
end end
def bulk_deletion_request_body(keys) def bulk_deletion_request_body(keys)

View file

@ -13,7 +13,7 @@ module Mailers
if procedures.count == 1 if procedures.count == 1
procedure_ids = "votre démarche nº #{procedures.first.id}" procedure_ids = "votre démarche nº #{procedures.first.id}"
else else
procedure_ids = 'vos démarches nº ' + procedures.map{ |p| p.id }.join(', ') procedure_ids = 'vos démarches nº ' + procedures.map(&:id).join(', ')
end end
"demarches-simplifiees.fr mise à jour nécessaire de laccusé dacceptation de #{procedure_ids}" "demarches-simplifiees.fr mise à jour nécessaire de laccusé dacceptation de #{procedure_ids}"
end end

View file

@ -2,7 +2,7 @@ require Rails.root.join("lib", "tasks", "task_helper")
namespace :'2018_01_18_clean_datetime_in_champs' do namespace :'2018_01_18_clean_datetime_in_champs' do
task clean: :environment do task clean: :environment do
datetime_champs = TypeDeChamp.where(type_champ: "datetime").flat_map{ |t| t.champ } datetime_champs = TypeDeChamp.where(type_champ: "datetime").flat_map(&:champ)
# Match " HH:MM" => nil a datetime is not valid if not composed by date AND time # Match " HH:MM" => nil a datetime is not valid if not composed by date AND time
datetime_champs.select { |c| /^\s\d{2}:\d{2}$/.match(c.value) }.each do |c| datetime_champs.select { |c| /^\s\d{2}:\d{2}$/.match(c.value) }.each do |c|

View file

@ -1,7 +1,5 @@
namespace :'2018_06_04_scan_pjs' do namespace :'2018_06_04_scan_pjs' do
task scan_all: :environment do task scan_all: :environment do
Champs::PieceJustificativeChamp.all.each do |pj_champ| Champs::PieceJustificativeChamp.all.each(&:create_virus_scan)
pj_champ.create_virus_scan
end
end end
end end

View file

@ -3,7 +3,7 @@ require Rails.root.join("lib", "tasks", "task_helper")
namespace :'2018_06_06_users_for_admins_and_gestionnaires' do namespace :'2018_06_06_users_for_admins_and_gestionnaires' do
task preactivate: :environment do task preactivate: :environment do
preactivate_users(Gestionnaire, 'accompagnateur') { |g| g.reset_password_token.nil? } preactivate_users(Gestionnaire, 'accompagnateur') { |g| g.reset_password_token.nil? }
preactivate_users(Administrateur) { |a| a.active? } preactivate_users(Administrateur, &:active?)
end end
def preactivate_users(model, role_name = nil, &block) def preactivate_users(model, role_name = nil, &block)

View file

@ -45,7 +45,7 @@ namespace :support do
if user.dossiers.state_instruction_commencee.any? if user.dossiers.state_instruction_commencee.any?
fail "Cannot delete this user because instruction has started for some dossiers" fail "Cannot delete this user because instruction has started for some dossiers"
end end
user.dossiers.each { |d| d.delete_and_keep_track } user.dossiers.each(&:delete_and_keep_track)
user.destroy user.destroy
end end
end end