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
Style/SymbolProc:
Enabled: false
Enabled: true
IgnoredMethods: [after]
Style/TernaryParentheses:
Enabled: false

View file

@ -10,7 +10,7 @@ class FranceConnect::ParticulierController < ApplicationController
fci = FranceConnectInformation
.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?
user = User.find_or_create_by(email: fci.email_france_connect) do |new_user|

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@ class ChampsService
def check_piece_justificative_files(champs)
champs.select do |champ|
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
private

View file

@ -70,6 +70,6 @@ class TypesDeChampService
end
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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
def change
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.each_value do |duplicate_mails|
duplicate_mails.pop

View file

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

View file

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

View file

@ -2,7 +2,7 @@ require Rails.root.join("lib", "tasks", "task_helper")
namespace :'2018_01_18_clean_datetime_in_champs' 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
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
task scan_all: :environment do
Champs::PieceJustificativeChamp.all.each do |pj_champ|
pj_champ.create_virus_scan
end
Champs::PieceJustificativeChamp.all.each(&:create_virus_scan)
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
task preactivate: :environment do
preactivate_users(Gestionnaire, 'accompagnateur') { |g| g.reset_password_token.nil? }
preactivate_users(Administrateur) { |a| a.active? }
preactivate_users(Administrateur, &:active?)
end
def preactivate_users(model, role_name = nil, &block)

View file

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