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