From 5125cf839694b695fa6224e99ab30f91ea966ffa Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 15 Jan 2018 18:48:14 +0100 Subject: [PATCH] Enable the Layout/FirstParameterIndentation cop --- .rubocop.yml | 2 +- .../admin/gestionnaires_controller.rb | 8 +++++--- app/controllers/admin/procedures_controller.rb | 11 ++++++----- .../new_gestionnaire/recherche_controller.rb | 6 +++--- app/controllers/root_controller.rb | 8 ++++---- app/services/module_api_carto_service.rb | 4 ++-- app/services/sync_credentials_service.rb | 12 ++++++------ ...12_build_default_preference_list_dossier.rb | 16 ++++++++-------- ...095443_reset_all_preference_list_dossier.rb | 18 +++++++++--------- lib/tasks/cloud_storage.rake | 18 +++++++++--------- 10 files changed, 53 insertions(+), 50 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7653b091c..c7d98218a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -95,7 +95,7 @@ Layout/FirstMethodParameterLineBreak: Enabled: false Layout/FirstParameterIndentation: - Enabled: false + Enabled: true Layout/IndentArray: Enabled: false diff --git a/app/controllers/admin/gestionnaires_controller.rb b/app/controllers/admin/gestionnaires_controller.rb index 1e4ebabe4..6319e2569 100644 --- a/app/controllers/admin/gestionnaires_controller.rb +++ b/app/controllers/admin/gestionnaires_controller.rb @@ -40,9 +40,11 @@ class Admin::GestionnairesController < AdminController attributes = params.require(:gestionnaire).permit(:email) .merge(password: SecureRandom.hex(5)) - @gestionnaire = Gestionnaire.create(attributes.merge( - administrateurs: [current_administrateur] - )) + @gestionnaire = Gestionnaire.create( + attributes.merge( + administrateurs: [current_administrateur] + ) + ) if @gestionnaire.errors.messages.empty? User.create(attributes) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index 80904fcfb..d38758eec 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -96,11 +96,12 @@ class Admin::ProceduresController < AdminController procedure = current_administrateur.procedures.find(params[:procedure_id]) new_procedure_path = ProcedurePath.new( - { - path: params[:procedure_path], - procedure: procedure, - administrateur: procedure.administrateur - }) + { + path: params[:procedure_path], + procedure: procedure, + administrateur: procedure.administrateur + }) + if new_procedure_path.validate new_procedure_path.delete else diff --git a/app/controllers/new_gestionnaire/recherche_controller.rb b/app/controllers/new_gestionnaire/recherche_controller.rb index 4d4ce7798..243e0d55b 100644 --- a/app/controllers/new_gestionnaire/recherche_controller.rb +++ b/app/controllers/new_gestionnaire/recherche_controller.rb @@ -13,9 +13,9 @@ module NewGestionnaire # full text search if @dossiers.empty? @dossiers = Search.new( - gestionnaire: current_gestionnaire, - query: @search_terms, - page: params[:page] + gestionnaire: current_gestionnaire, + query: @search_terms, + page: params[:page] ).results end end diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 51ff9066f..7137999c5 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -35,10 +35,10 @@ class RootController < ApplicationController .each do |champ| champ.type_de_champ.drop_down_list = DropDownList.new(type_de_champ: champ.type_de_champ) champ.drop_down_list.value = -"option A -option B --- avant l'option C -- -option C" + "option A + option B + -- avant l'option C -- + option C" champ.value = '["option B", "option C"]' end diff --git a/app/services/module_api_carto_service.rb b/app/services/module_api_carto_service.rb index 2cff27de4..252ad1c2e 100644 --- a/app/services/module_api_carto_service.rb +++ b/app/services/module_api_carto_service.rb @@ -26,14 +26,14 @@ class ModuleApiCartoService def self.generate_qp coordinates coordinates.inject({}) { |acc, coordinate| acc.merge CARTO::SGMAP::QuartiersPrioritaires::Adapter.new( - coordinate.map { |element| [element['lng'], element['lat']] }).to_params + coordinate.map { |element| [element['lng'], element['lat']] }).to_params } end def self.generate_cadastre coordinates (coordinates.inject([]) { |acc, coordinate| acc << CARTO::SGMAP::Cadastre::Adapter.new( - coordinate.map { |element| [element['lng'], element['lat']] }).to_params + coordinate.map { |element| [element['lng'], element['lat']] }).to_params }).flatten end end diff --git a/app/services/sync_credentials_service.rb b/app/services/sync_credentials_service.rb index 43c556c98..983f6a1bd 100644 --- a/app/services/sync_credentials_service.rb +++ b/app/services/sync_credentials_service.rb @@ -11,8 +11,8 @@ class SyncCredentialsService user = User.find_by(email: @email_was) if user return false if !user.update_columns( - email: @email, - encrypted_password: @encrypted_password) + email: @email, + encrypted_password: @encrypted_password) end end @@ -20,8 +20,8 @@ class SyncCredentialsService gestionnaire = Gestionnaire.find_by(email: @email_was) if gestionnaire return false if !gestionnaire.update_columns( - email: @email, - encrypted_password: @encrypted_password) + email: @email, + encrypted_password: @encrypted_password) end end @@ -29,8 +29,8 @@ class SyncCredentialsService administrateur = Administrateur.find_by(email: @email_was) if administrateur return false if !administrateur.update_columns( - email: @email, - encrypted_password: @encrypted_password) + email: @email, + encrypted_password: @encrypted_password) end end diff --git a/db/migrate/20160802113112_build_default_preference_list_dossier.rb b/db/migrate/20160802113112_build_default_preference_list_dossier.rb index 66d344fe8..4f73c4263 100644 --- a/db/migrate/20160802113112_build_default_preference_list_dossier.rb +++ b/db/migrate/20160802113112_build_default_preference_list_dossier.rb @@ -5,14 +5,14 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration table.second.each do |column| if valid_couple_table_attr? table.first, column.first PreferenceListDossier.create( - libelle: column.second[:libelle], - table: column.second[:table], - attr: column.second[:attr], - attr_decorate: column.second[:attr_decorate], - bootstrap_lg: column.second[:bootstrap_lg], - order: nil, - filter: nil, - gestionnaire_id: self.id + libelle: column.second[:libelle], + table: column.second[:table], + attr: column.second[:attr], + attr_decorate: column.second[:attr_decorate], + bootstrap_lg: column.second[:bootstrap_lg], + order: nil, + filter: nil, + gestionnaire_id: self.id ) end end diff --git a/db/migrate/20161007095443_reset_all_preference_list_dossier.rb b/db/migrate/20161007095443_reset_all_preference_list_dossier.rb index 172ee1fbb..629822722 100644 --- a/db/migrate/20161007095443_reset_all_preference_list_dossier.rb +++ b/db/migrate/20161007095443_reset_all_preference_list_dossier.rb @@ -100,15 +100,15 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration table.second.each do |column| if valid_couple_table_attr? table.first, column.first PreferenceListDossier.create( - libelle: column.second[:libelle], - table: column.second[:table], - attr: column.second[:attr], - attr_decorate: column.second[:attr_decorate], - bootstrap_lg: column.second[:bootstrap_lg], - order: nil, - filter: nil, - procedure_id: procedure_id, - gestionnaire: self + libelle: column.second[:libelle], + table: column.second[:table], + attr: column.second[:attr], + attr_decorate: column.second[:attr_decorate], + bootstrap_lg: column.second[:bootstrap_lg], + order: nil, + filter: nil, + procedure_id: procedure_id, + gestionnaire: self ) end end diff --git a/lib/tasks/cloud_storage.rake b/lib/tasks/cloud_storage.rake index 878d3acce..f4cfb11cf 100644 --- a/lib/tasks/cloud_storage.rake +++ b/lib/tasks/cloud_storage.rake @@ -2,15 +2,15 @@ namespace :cloudstorage do task init: :environment do os_config = (YAML.load_file(Fog.credentials_path))['default'] @os = OpenStack::Connection.create( - { - username: os_config['openstack_username'], - api_key: os_config['openstack_api_key'], - auth_method: "password", - auth_url: "https://auth.cloud.ovh.net/v2.0/", - authtenant_name: os_config['openstack_tenant'], - service_type: "object-store", - region: os_config['openstack_region'] - } + { + username: os_config['openstack_username'], + api_key: os_config['openstack_api_key'], + auth_method: "password", + auth_url: "https://auth.cloud.ovh.net/v2.0/", + authtenant_name: os_config['openstack_tenant'], + service_type: "object-store", + region: os_config['openstack_region'] + } ) @cont = @os.container(CarrierWave::Uploader::Base.fog_directory) end