Enable the Layout/AlignParameters cop

This commit is contained in:
gregoirenovel 2017-06-12 13:49:51 +02:00
parent 50fad54538
commit 9439e1abb1
39 changed files with 221 additions and 220 deletions

View file

@ -14,7 +14,8 @@ Layout/AlignHash:
Enabled: false
Layout/AlignParameters:
Enabled: false
Enabled: true
EnforcedStyle: with_fixed_indentation
Layout/BlockEndNewline:
Enabled: false

View file

@ -7,17 +7,17 @@ class Admin::AccompagnateursController < AdminController
def show
assign_scope = @procedure.gestionnaires
@accompagnateurs_assign = smart_listing_create :accompagnateurs_assign,
assign_scope,
partial: "admin/accompagnateurs/list_assign",
array: true
assign_scope,
partial: "admin/accompagnateurs/list_assign",
array: true
not_assign_scope = current_administrateur.gestionnaires.where.not(id: assign_scope.ids)
not_assign_scope = not_assign_scope.where("email LIKE '%#{params[:filter]}%'") if params[:filter]
@accompagnateurs_not_assign = smart_listing_create :accompagnateurs_not_assign,
not_assign_scope,
partial: "admin/accompagnateurs/list_not_assign",
array: true
not_assign_scope,
partial: "admin/accompagnateurs/list_not_assign",
array: true
@gestionnaire ||= Gestionnaire.new
end

View file

@ -4,9 +4,10 @@ class Admin::GestionnairesController < AdminController
def index
@gestionnaires = smart_listing_create :gestionnaires,
current_administrateur.gestionnaires,
partial: "admin/gestionnaires/list",
array: true
current_administrateur.gestionnaires,
partial: "admin/gestionnaires/list",
array: true
@gestionnaire ||= Gestionnaire.new
end

View file

@ -6,18 +6,18 @@ class Admin::ProceduresController < AdminController
def index
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.where(published: true, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
current_administrateur.procedures.where(published: true, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
active_class
end
def archived
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.where(archived: true).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
current_administrateur.procedures.where(archived: true).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
archived_class
@ -26,9 +26,9 @@ class Admin::ProceduresController < AdminController
def draft
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.where(published: false, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
current_administrateur.procedures.where(published: false, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
draft_class

View file

@ -8,11 +8,9 @@ class AdministrationsController < ApplicationController
@admin = Administrateur.new
@admins = smart_listing_create :admins,
Administrateur.all.order(:email),
partial: "administrations/list",
array: true
Administrateur.all.order(:email),
partial: "administrations/list",
array: true
end
def create

View file

@ -79,17 +79,17 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
end
smart_listing_create :search,
@dossiers,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
@dossiers,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
rescue RuntimeError
smart_listing_create :search,
[],
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
[],
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
def receive

View file

@ -48,10 +48,10 @@ class Backoffice::DossiersListController < ApplicationController
def default_smart_listing_create name, collection
smart_listing_create name,
collection,
partial: 'backoffice/dossiers/list',
array: true,
default_sort: dossiers_list_facade.service.default_sort
collection,
partial: 'backoffice/dossiers/list',
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
def param_smart_listing

View file

@ -15,14 +15,14 @@ class BackofficeController < ApplicationController
def invitations
pending_avis = current_gestionnaire.avis.without_answer.includes(dossier: [:procedure]).by_latest
@pending_avis = smart_listing_create :pending_avis,
pending_avis,
partial: 'backoffice/dossiers/list_invitations',
array: true
pending_avis,
partial: 'backoffice/dossiers/list_invitations',
array: true
avis_with_answer = current_gestionnaire.avis.with_answer.includes(dossier: [:procedure]).by_latest
@avis_with_answer = smart_listing_create :avis_with_answer,
avis_with_answer,
partial: 'backoffice/dossiers/list_invitations',
array: true
avis_with_answer,
partial: 'backoffice/dossiers/list_invitations',
array: true
end
end

View file

@ -1,9 +1,9 @@
class CommentairesController < ApplicationController
def index
@facade = DossierFacades.new(
params[:dossier_id],
(current_gestionnaire || current_user).email,
params[:champs_id]
params[:dossier_id],
(current_gestionnaire || current_user).email,
params[:champs_id]
)
render layout: false
rescue ActiveRecord::RecordNotFound

View file

@ -6,8 +6,8 @@ class DemoController < ApplicationController
return redirect_to root_path if Rails.env.production?
smart_listing_create :procedures,
Procedure.where(archived: false, published: true).order("id DESC"),
partial: "demo/list",
array: true
Procedure.where(archived: false, published: true).order("id DESC"),
partial: "demo/list",
array: true
end
end

View file

@ -30,9 +30,9 @@ class Users::DossiersController < UsersController
end
@dossiers = smart_listing_create :dossiers,
@dossiers_filtered,
partial: "users/dossiers/list",
array: true
@dossiers_filtered,
partial: "users/dossiers/list",
array: true
end
def commencer

View file

@ -17,8 +17,8 @@ class UsersController < ApplicationController
def authorized_routes? controller
redirect_to_root_path 'Le status de votre dossier n\'autorise pas cette URL' unless UserRoutesAuthorizationService.authorized_route?(
controller,
current_user_dossier)
controller,
current_user_dossier)
rescue ActiveRecord::RecordNotFound
redirect_to_root_path 'Vous navez pas accès à ce dossier.'
end

View file

@ -18,8 +18,8 @@ class CARTO::SGMAP::API
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE
RestClient::Resource.new(
url,
verify_ssl: verify_ssl_mode,
url,
verify_ssl: verify_ssl_mode,
).post params[:geojson], content_type: 'application/json'
rescue RestClient::InternalServerError

View file

@ -1,6 +1,6 @@
class Administrateur < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
:recoverable, :rememberable, :trackable, :validatable
has_and_belongs_to_many :gestionnaires
has_many :procedures

View file

@ -1,6 +1,6 @@
class Gestionnaire < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
:recoverable, :rememberable, :trackable, :validatable
has_and_belongs_to_many :administrateurs

View file

@ -33,7 +33,7 @@ class PieceJustificative < ActiveRecord::Base
(RemoteDownloader.new content.filename).url
else
(LocalDownloader.new content.path,
(type_de_piece_justificative.nil? ? content.original_filename : type_de_piece_justificative.libelle)).url
(type_de_piece_justificative.nil? ? content.original_filename : type_de_piece_justificative.libelle)).url
end
end
end

View file

@ -7,7 +7,7 @@ class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
:recoverable, :rememberable, :trackable, :validatable
has_many :dossiers, dependent: :destroy
has_many :invites, dependent: :destroy

View file

@ -1,6 +1,6 @@
class CerfaSerializer < ActiveModel::Serializer
attributes :created_at,
:content_url
:content_url
has_one :user
end

View file

@ -1,5 +1,5 @@
class CommentaireSerializer < ActiveModel::Serializer
attributes :email,
:body,
:created_at
:body,
:created_at
end

View file

@ -1,16 +1,16 @@
class DossierSerializer < ActiveModel::Serializer
attributes :id,
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:simplified_state,
:initiated_at,
:received_at,
:processed_at,
:accompagnateurs,
:invites
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:simplified_state,
:initiated_at,
:received_at,
:processed_at,
:accompagnateurs,
:invites
has_one :entreprise
has_one :etablissement

View file

@ -1,20 +1,20 @@
class DossierTableExportSerializer < ActiveModel::Serializer
attributes :id,
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:initiated_at,
:received_at,
:processed_at
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:initiated_at,
:received_at,
:processed_at
attribute :emails_accompagnateurs
attributes :individual_gender,
:individual_prenom,
:individual_nom,
:individual_birthdate
:individual_prenom,
:individual_nom,
:individual_birthdate
def individual_prenom
object.individual.try(:prenom)

View file

@ -1,4 +1,4 @@
class DossiersSerializer < ActiveModel::Serializer
attributes :id,
:updated_at
:updated_at
end

View file

@ -1,14 +1,14 @@
class EntrepriseSerializer < ActiveModel::Serializer
attributes :siren,
:capital_social,
:numero_tva_intracommunautaire,
:forme_juridique,
:forme_juridique_code,
:nom_commercial,
:raison_sociale,
:siret_siege_social,
:code_effectif_entreprise,
:date_creation,
:nom,
:prenom
:capital_social,
:numero_tva_intracommunautaire,
:forme_juridique,
:forme_juridique_code,
:nom_commercial,
:raison_sociale,
:siret_siege_social,
:code_effectif_entreprise,
:date_creation,
:nom,
:prenom
end

View file

@ -1,15 +1,14 @@
class EtablissementSerializer < ActiveModel::Serializer
attributes :siret,
:siege_social,
:naf,
:libelle_naf,
:adresse,
:numero_voie,
:type_voie,
:nom_voie,
:complement_adresse,
:code_postal,
:localite,
:code_insee_localite
:siege_social,
:naf,
:libelle_naf,
:adresse,
:numero_voie,
:type_voie,
:nom_voie,
:complement_adresse,
:code_postal,
:localite,
:code_insee_localite
end

View file

@ -1,7 +1,5 @@
class ModuleApiCartoSerializer < ActiveModel::Serializer
attributes :use_api_carto,
:quartiers_prioritaires,
:cadastre
:quartiers_prioritaires,
:cadastre
end

View file

@ -1,7 +1,7 @@
class PieceJustificativeSerializer < ActiveModel::Serializer
attributes :created_at,
:type_de_piece_justificative_id,
:content_url
:type_de_piece_justificative_id,
:content_url
has_one :user
end

View file

@ -3,13 +3,12 @@ class ProcedureSerializer < ActiveModel::Serializer
attribute :lien_demarche, key: :link
attributes :id,
:description,
:organisation,
:direction,
:archived,
:geographic_information,
:total_dossier
:description,
:organisation,
:direction,
:archived,
:geographic_information,
:total_dossier
has_one :geographic_information, serializer: ModuleApiCartoSerializer
has_many :types_de_champ, serializer: TypeDeChampSerializer

View file

@ -1,7 +1,7 @@
class TypeDeChampSerializer < ActiveModel::Serializer
attributes :id,
:libelle,
:type_champ,
:order_place,
:description
:libelle,
:type_champ,
:order_place,
:description
end

View file

@ -1,7 +1,7 @@
class TypeDePieceJustificativeSerializer < ActiveModel::Serializer
attributes :id,
:libelle,
:description,
:order_place,
:lien_demarche
:libelle,
:description,
:order_place,
:lien_demarche
end

View file

@ -14,11 +14,14 @@ describe Backoffice::PreferenceListDossierController, type: :controller do
describe '#POST add' do
subject { post :add,
params: {libelle: libelle,
table: table,
attr: attr,
attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg} }
params: {
libelle: libelle,
table: table,
attr: attr,
attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg
}
}
it { expect(subject.status).to eq 200 }
it { expect { subject }.to change(PreferenceListDossier, :count).by(1) }

View file

@ -13,10 +13,13 @@ describe Backoffice::PrivateFormulairesController, type: :controller do
describe '#PATCH update' do
subject { patch :update,
params: {dossier_id: dossier.id,
champs: {
"'#{dossier.champs_private.first.id}'" => dossier_champs_first
}} }
params: {
dossier_id: dossier.id,
champs: {
"'#{dossier.champs_private.first.id}'" => dossier_champs_first
}
}
}
before do
subject

View file

@ -7,17 +7,17 @@ describe DossiersListFacades do
let(:procedure_2) { create :procedure, libelle: 'Ma seconde procédure' }
let!(:preference) { create :preference_list_dossier,
gestionnaire: gestionnaire,
table: nil,
attr: 'state',
attr_decorate: 'display_state' }
gestionnaire: gestionnaire,
table: nil,
attr: 'state',
attr_decorate: 'display_state' }
let!(:preference_2) { create :preference_list_dossier,
gestionnaire: gestionnaire,
table: 'champs',
attr: 'state',
attr_decorate: 'display_state',
procedure_id: procedure.id }
gestionnaire: gestionnaire,
table: 'champs',
attr: 'state',
attr_decorate: 'display_state',
procedure_id: procedure.id }
before do
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
@ -58,12 +58,12 @@ describe DossiersListFacades do
let(:facade) { described_class.new gestionnaire, 'nouveaux', procedure_2 }
let!(:preference) { create :preference_list_dossier,
gestionnaire: gestionnaire,
table: table,
attr: 'state',
attr_decorate: 'display_state',
filter: filter,
procedure_id: procedure_id }
gestionnaire: gestionnaire,
table: table,
attr: 'state',
attr_decorate: 'display_state',
filter: filter,
procedure_id: procedure_id }
subject { facade.active_filter? preference }
@ -99,12 +99,12 @@ describe DossiersListFacades do
before do
create :preference_list_dossier,
gestionnaire: gestionnaire,
table: 'champs',
attr: 'state',
attr_decorate: 'display_state',
filter: 'plop',
procedure_id: procedure_id
gestionnaire: gestionnaire,
table: 'champs',
attr: 'state',
attr_decorate: 'display_state',
filter: 'plop',
procedure_id: procedure_id
end
it { is_expected.to be_falsey }

View file

@ -34,13 +34,13 @@ feature 'France Connect Particulier Connexion' do
context 'when authentification is ok' do
let(:france_connect_information) { create(:france_connect_information,
france_connect_particulier_id: france_connect_particulier_id,
given_name: given_name,
family_name: family_name,
birthdate: birthdate,
birthplace: birthplace,
gender: gender,
email_france_connect: email) }
france_connect_particulier_id: france_connect_particulier_id,
given_name: given_name,
family_name: family_name,
birthdate: birthdate,
birthplace: birthplace,
gender: gender,
email_france_connect: email) }
before do
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code))

View file

@ -231,12 +231,12 @@ describe DossiersListGestionnaireService do
context 'when preference list contain a champ' do
before do
create :preference_list_dossier,
gestionnaire: gestionnaire,
table: 'champs',
attr: '34',
attr_decorate: '',
filter: 'plop',
procedure_id: create(:procedure)
gestionnaire: gestionnaire,
table: 'champs',
attr: '34',
attr_decorate: '',
filter: 'plop',
procedure_id: create(:procedure)
end
it { is_expected.to eq "CAST(dossiers.id as TEXT) LIKE '%23%' AND CAST(entreprises.raison_sociale as TEXT) LIKE '%plop%' AND champs.type_de_champ_id = 34 AND CAST(champs.value as TEXT) LIKE '%plop%'" }

View file

@ -12,14 +12,14 @@ describe 'admin/accompagnateurs/show.html.haml', type: :view do
assign(:gestionnaire, Gestionnaire.new)
assign(:accompagnateurs_assign, (smart_listing_create :accompagnateurs_assign,
assign_gestionnaires,
partial: "admin/accompagnateurs/list_assign",
array: true))
assign_gestionnaires,
partial: "admin/accompagnateurs/list_assign",
array: true))
assign(:accompagnateurs_not_assign, (smart_listing_create :accompagnateurs_not_assign,
not_assign_gestionnaires,
partial: "admin/accompagnateurs/list_not_assign",
array: true))
not_assign_gestionnaires,
partial: "admin/accompagnateurs/list_not_assign",
array: true))
end
context 'when admin have none accompagnateur ' do
@ -43,14 +43,14 @@ describe 'admin/accompagnateurs/show.html.haml', type: :view do
assign_gestionnaires.reload
assign(:accompagnateurs_assign, (smart_listing_create :accompagnateurs_assign,
assign_gestionnaires,
partial: "admin/accompagnateurs/list_assign",
array: true))
assign_gestionnaires,
partial: "admin/accompagnateurs/list_assign",
array: true))
assign(:accompagnateurs_not_assign, (smart_listing_create :accompagnateurs_not_assign,
not_assign_gestionnaires,
partial: "admin/accompagnateurs/list_not_assign",
array: true))
not_assign_gestionnaires,
partial: "admin/accompagnateurs/list_not_assign",
array: true))
render
end

View file

@ -6,9 +6,9 @@ describe 'admin/gestionnaires/index.html.haml', type: :view do
before do
assign(:gestionnaires, (smart_listing_create :gestionnaires,
admin.gestionnaires,
partial: "admin/gestionnaires/list",
array: true))
admin.gestionnaires,
partial: "admin/gestionnaires/list",
array: true))
assign(:gestionnaire, Gestionnaire.new())
end
@ -24,9 +24,9 @@ describe 'admin/gestionnaires/index.html.haml', type: :view do
create(:gestionnaire, administrateurs: [admin])
admin.reload
assign(:gestionnaires, (smart_listing_create :gestionnaires,
admin.gestionnaires,
partial: "admin/gestionnaires/list",
array: true))
admin.gestionnaires,
partial: "admin/gestionnaires/list",
array: true))
render
end
it { expect(rendered).to match(/gest\d+@gest.com/) }

View file

@ -65,8 +65,7 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
context 'les valeurs sont réaffichées si elles sont présentes dans la BDD' do
let!(:dossier) do
create(:dossier,
user: user)
create(:dossier, user: user)
end
before do

View file

@ -29,28 +29,28 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
decorate_dossier_without_continuation.entreprise.update_column(:raison_sociale, 'plnp')
create :preference_list_dossier,
gestionnaire: gestionnaire,
table: nil,
attr: 'state',
attr_decorate: 'display_state'
gestionnaire: gestionnaire,
table: nil,
attr: 'state',
attr_decorate: 'display_state'
create :preference_list_dossier,
gestionnaire: gestionnaire,
table: 'procedure',
attr: 'libelle',
attr_decorate: 'libelle'
gestionnaire: gestionnaire,
table: 'procedure',
attr: 'libelle',
attr_decorate: 'libelle'
create :preference_list_dossier,
gestionnaire: gestionnaire,
table: 'entreprise',
attr: 'raison_sociale',
attr_decorate: 'raison_sociale'
gestionnaire: gestionnaire,
table: 'entreprise',
attr: 'raison_sociale',
attr_decorate: 'raison_sociale'
create :preference_list_dossier,
gestionnaire: gestionnaire,
table: nil,
attr: 'last_update',
attr_decorate: 'last_update'
gestionnaire: gestionnaire,
table: nil,
attr: 'last_update',
attr_decorate: 'last_update'
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
sign_in gestionnaire
@ -58,19 +58,19 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
assign :facade_data_view, dossiers_list_facade
assign(:new_dossiers, (smart_listing_create :new_dossiers,
new_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
new_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
assign(:follow_dossiers, (smart_listing_create :follow_dossiers,
follow_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
follow_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
assign(:all_state_dossiers, (smart_listing_create :all_state_dossiers,
all_state_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
all_state_dossiers_list,
partial: "backoffice/dossiers/list",
array: true))
render
end

View file

@ -22,9 +22,9 @@ describe 'users/dossiers/index.html.haml', type: :view do
assign :dossiers_list_facade, (DossiersListFacades.new user, liste)
assign(:dossiers, (smart_listing_create :dossiers,
dossiers_to_display,
partial: "users/dossiers/list",
array: true))
dossiers_to_display,
partial: "users/dossiers/list",
array: true))
render
end