Enable the Lint/UnusedBlockArgument cop
This commit is contained in:
parent
ddc71cbacf
commit
0596d53ac2
10 changed files with 16 additions and 16 deletions
|
@ -471,7 +471,7 @@ Lint/UnreachableCode:
|
|||
Enabled: true
|
||||
|
||||
Lint/UnusedBlockArgument:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Lint/UnusedMethodArgument:
|
||||
Enabled: false
|
||||
|
|
|
@ -271,7 +271,7 @@ class StatsController < ApplicationController
|
|||
dossiers_grouped_by_procedure = value.group_by { |dossier| dossier[0] }
|
||||
|
||||
# Compute the mean time for this procedure
|
||||
procedure_processing_times = dossiers_grouped_by_procedure.map do |procedure_id, procedure_dossiers|
|
||||
procedure_processing_times = dossiers_grouped_by_procedure.map do |_procedure_id, procedure_dossiers|
|
||||
procedure_dossiers_processing_time = procedure_dossiers.map do |dossier|
|
||||
(dossier[2] - dossier[1]).to_f / (3600 * 24)
|
||||
end
|
||||
|
|
|
@ -91,6 +91,6 @@ class Etablissement < ApplicationRecord
|
|||
def message_for_signature
|
||||
JSON.pretty_generate(as_json(include: {
|
||||
exercices: { only: [:ca, :date_fin_exercice, :date_fin_exercice_timestamp] }
|
||||
}).delete_if { |k, v| v.blank? })
|
||||
}).delete_if { |_k, v| v.blank? })
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
AfterParty.setup do |config|
|
||||
AfterParty.setup do |_config|
|
||||
require "after_party/active_record.rb"
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
if ENV['RAILS_ENV'] != 'test' && File.basename($0) != 'rake'
|
||||
reference_env_file = File.join('config', 'env.example')
|
||||
Dotenv::Environment.new(Rails.root.join(reference_env_file)).each do |key, value|
|
||||
Dotenv::Environment.new(Rails.root.join(reference_env_file)).each do |key, _value|
|
||||
if !ENV.key?(key.to_s)
|
||||
raise "Configuration error: `#{key}` is not present in the process’ environment variables (declared in `#{reference_env_file}`)"
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
|
|||
def change
|
||||
all_mails = MailReceived.all
|
||||
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|
|
||||
duplicate_mails.pop
|
||||
duplicate_mails.each(&:destroy)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
namespace :'2018_02_28_clean_invalid_emails_accounts' do
|
||||
task clean: :environment do
|
||||
Gestionnaire.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
||||
Gestionnaire.pluck(:email, :id).select { |e, _id| e.include?(" ") }.each do |_email, id|
|
||||
Gestionnaire.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
|
||||
end
|
||||
|
||||
User.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
||||
User.pluck(:email, :id).select { |e, _id| e.include?(" ") }.each do |_email, id|
|
||||
User.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
namespace :admin do
|
||||
task :create_admin, [:email] => :environment do |t, args|
|
||||
task :create_admin, [:email] => :environment do |_t, args|
|
||||
email = args[:email]
|
||||
puts "Creating Administration for #{email}"
|
||||
a = Administration.new(email: email, password: Devise.friendly_token[0, 20])
|
||||
|
@ -17,7 +17,7 @@ namespace :admin do
|
|||
end
|
||||
end
|
||||
|
||||
task :delete_admin, [:email] => :environment do |t, args|
|
||||
task :delete_admin, [:email] => :environment do |_t, args|
|
||||
email = args[:email]
|
||||
puts "Deleting Administration for #{email}"
|
||||
a = Administration.find_by(email: email)
|
||||
|
|
|
@ -511,7 +511,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
|
||||
subject { get :new_from_existing }
|
||||
let(:grouped_procedures) { subject; assigns(:grouped_procedures) }
|
||||
let(:response_procedures) { grouped_procedures.map { |o, procedures| procedures }.flatten }
|
||||
let(:response_procedures) { grouped_procedures.map { |_o, procedures| procedures }.flatten }
|
||||
|
||||
describe 'selecting' do
|
||||
let!(:large_draft_procedure) { create(:procedure_with_dossiers, dossiers_count: 2) }
|
||||
|
@ -542,8 +542,8 @@ describe Admin::ProceduresController, type: :controller do
|
|||
|
||||
it 'groups procedures with services as well as procedures with organisations' do
|
||||
expect(grouped_procedures.length).to eq 2
|
||||
expect(grouped_procedures.find { |o, p| o == 'DDT des Vosges' }.last).to contain_exactly(procedure_with_service_1)
|
||||
expect(grouped_procedures.find { |o, p| o == 'DDT du Loiret' }.last).to contain_exactly(procedure_with_service_2, procedure_without_service)
|
||||
expect(grouped_procedures.find { |o, _p| o == 'DDT des Vosges' }.last).to contain_exactly(procedure_with_service_1)
|
||||
expect(grouped_procedures.find { |o, _p| o == 'DDT du Loiret' }.last).to contain_exactly(procedure_with_service_2, procedure_without_service)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ FactoryBot.define do
|
|||
end
|
||||
|
||||
trait :with_piece_justificative_file do
|
||||
after(:create) do |champ, evaluator|
|
||||
after(:create) do |champ, _evaluator|
|
||||
champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain")
|
||||
end
|
||||
end
|
||||
|
@ -147,7 +147,7 @@ FactoryBot.define do
|
|||
factory :champ_piece_justificative, class: 'Champs::PieceJustificativeChamp' do
|
||||
type_de_champ { create(:type_de_champ_piece_justificative) }
|
||||
|
||||
after(:create) do |champ, evaluator|
|
||||
after(:create) do |champ, _evaluator|
|
||||
champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain")
|
||||
end
|
||||
end
|
||||
|
@ -161,7 +161,7 @@ FactoryBot.define do
|
|||
association :etablissement, factory: [:etablissement]
|
||||
value { '44011762001530' }
|
||||
|
||||
after(:build) do |champ, evaluator|
|
||||
after(:build) do |champ, _evaluator|
|
||||
champ.etablissement.signature = champ.etablissement.sign
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue