diff --git a/.rubocop.yml b/.rubocop.yml index 0ca1f41c4..0852a6e43 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -471,7 +471,7 @@ Lint/UnreachableCode: Enabled: true Lint/UnusedBlockArgument: - Enabled: false + Enabled: true Lint/UnusedMethodArgument: Enabled: false diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 28d24a4b8..750d46be1 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -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 diff --git a/app/models/etablissement.rb b/app/models/etablissement.rb index 1656f1f74..44e5142e9 100644 --- a/app/models/etablissement.rb +++ b/app/models/etablissement.rb @@ -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 diff --git a/config/initializers/after_party.rb b/config/initializers/after_party.rb index 66c8b1071..e9ef95728 100644 --- a/config/initializers/after_party.rb +++ b/config/initializers/after_party.rb @@ -1,3 +1,3 @@ -AfterParty.setup do |config| +AfterParty.setup do |_config| require "after_party/active_record.rb" end diff --git a/config/initializers/env_vars.rb b/config/initializers/env_vars.rb index 9046a8c80..a3a7cd20b 100644 --- a/config/initializers/env_vars.rb +++ b/config/initializers/env_vars.rb @@ -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 diff --git a/db/migrate/20170215102943_remove_duplicate_email_received.rb b/db/migrate/20170215102943_remove_duplicate_email_received.rb index 93f052b10..af2c6badd 100644 --- a/db/migrate/20170215102943_remove_duplicate_email_received.rb +++ b/db/migrate/20170215102943_remove_duplicate_email_received.rb @@ -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) diff --git a/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake b/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake index dc3c581bc..6106ae5ab 100644 --- a/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake +++ b/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake @@ -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 diff --git a/lib/tasks/admin.rake b/lib/tasks/admin.rake index 569b6559a..01dd504e6 100644 --- a/lib/tasks/admin.rake +++ b/lib/tasks/admin.rake @@ -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) diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb index 10c7f2828..7a0a0483c 100644 --- a/spec/controllers/admin/procedures_controller_spec.rb +++ b/spec/controllers/admin/procedures_controller_spec.rb @@ -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 diff --git a/spec/factories/champ.rb b/spec/factories/champ.rb index 20d04628d..c1cb471e7 100644 --- a/spec/factories/champ.rb +++ b/spec/factories/champ.rb @@ -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