Enable the Layout/IndentHash cop

This commit is contained in:
gregoirenovel 2018-01-15 19:02:12 +01:00
parent 3363e21427
commit 0be657c0d7
21 changed files with 163 additions and 155 deletions

View file

@ -105,7 +105,8 @@ Layout/IndentAssignment:
Enabled: true
Layout/IndentHash:
Enabled: false
Enabled: true
EnforcedStyle: consistent
Layout/IndentHeredoc:
Enabled: false

View file

@ -1,9 +1,9 @@
class API::StatistiquesController < ApplicationController
def dossiers_stats
render json: {
total: total_dossiers,
mois: dossiers_mois
}
total: total_dossiers,
mois: dossiers_mois
}
end
private

View file

@ -34,9 +34,9 @@ class API::V1::DossiersController < APIController
def pagination(dossiers)
{
page: dossiers.current_page,
resultats_par_page: dossiers.limit_value,
nombre_de_page: dossiers.total_pages
page: dossiers.current_page,
resultats_par_page: dossiers.limit_value,
nombre_de_page: dossiers.total_pages
}
end

View file

@ -61,8 +61,8 @@ class Users::CarteController < UsersController
def self.route_authorization
{
states: [:brouillon, :en_construction],
api_carto: true
states: [:brouillon, :en_construction],
api_carto: true
}
end
end

View file

@ -95,7 +95,7 @@ class Users::DescriptionController < UsersController
def self.route_authorization
{
states: [:brouillon, :en_construction]
states: [:brouillon, :en_construction]
}
end

View file

@ -151,7 +151,7 @@ class Users::DossiersController < UsersController
def self.route_authorization
{
states: [:brouillon]
states: [:brouillon]
}
end

View file

@ -18,7 +18,7 @@ class Users::RecapitulatifController < UsersController
def self.route_authorization
{
states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse]
states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse]
}
end

View file

@ -18,15 +18,15 @@ class CARTO::SGMAP::Cadastre::Adapter
def filter_properties properties
{
surface_intersection: properties[:surface_intersection],
surface_parcelle: properties[:surface_parcelle],
numero: properties[:numero],
feuille: properties[:feuille],
section: properties[:section],
code_dep: properties[:code_dep],
nom_com: properties[:nom_com],
code_com: properties[:code_com],
code_arr: properties[:code_arr]
surface_intersection: properties[:surface_intersection],
surface_parcelle: properties[:surface_parcelle],
numero: properties[:numero],
feuille: properties[:feuille],
section: properties[:section],
code_dep: properties[:code_dep],
nom_com: properties[:nom_com],
code_com: properties[:code_com],
code_arr: properties[:code_arr]
}
end
end

View file

@ -1,3 +1,3 @@
BROWSER = Hashie::Mash.new ({
value: nil
})
value: nil
})

View file

@ -1,4 +1,4 @@
CLAMAV = Hashie::Mash.new ({
mock?: true,
response: true
})
mock?: true,
response: true
})

View file

@ -18,19 +18,19 @@ Rails.application.routes.draw do
}
devise_for :administrateurs, controllers: {
sessions: 'administrateurs/sessions'
}, skip: [:password, :registrations]
sessions: 'administrateurs/sessions'
}, skip: [:password, :registrations]
devise_for :gestionnaires, controllers: {
sessions: 'gestionnaires/sessions',
passwords: 'gestionnaires/passwords'
}, skip: [:registrations]
sessions: 'gestionnaires/sessions',
passwords: 'gestionnaires/passwords'
}, skip: [:registrations]
devise_for :users, controllers: {
sessions: 'users/sessions',
registrations: 'users/registrations',
passwords: 'users/passwords'
}
sessions: 'users/sessions',
registrations: 'users/registrations',
passwords: 'users/passwords'
}
devise_scope :user do
get '/users/sign_in/demo' => redirect("/users/sign_in")

View file

@ -50,11 +50,11 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
class PreferenceListDossier < ActiveRecord::Base
def self.available_columns
{
dossier: columns_dossier,
procedure: columns_procedure,
entreprise: columns_entreprise,
etablissement: columns_etablissement,
user: columns_user
dossier: columns_dossier,
procedure: columns_procedure,
entreprise: columns_entreprise,
etablissement: columns_etablissement,
user: columns_user
}
end
@ -62,10 +62,10 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = nil
{
dossier_id: create_column('ID', table, 'id', 'id', 1),
created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2),
updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2),
state: create_column('Statut', table, 'state', 'display_state', 1)
dossier_id: create_column('ID', table, 'id', 'id', 1),
created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2),
updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2),
state: create_column('Statut', table, 'state', 'display_state', 1)
}
end
@ -73,9 +73,9 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'procedure'
{
libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4),
organisation: create_column('Organisation', table, 'organisation', 'organisation', 3),
direction: create_column('Direction', table, 'direction', 'direction', 3)
libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4),
organisation: create_column('Organisation', table, 'organisation', 'organisation', 3),
direction: create_column('Direction', table, 'direction', 'direction', 3)
}
end
@ -83,12 +83,12 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'entreprise'
{
siren: create_column('SIREN', table, 'siren', 'siren', 2),
forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3),
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
siren: create_column('SIREN', table, 'siren', 'siren', 2),
forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3),
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
}
end
@ -96,9 +96,9 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'etablissement'
{
siret: create_column('SIRET', table, 'siret', 'siret', 2),
libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3),
code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1)
siret: create_column('SIRET', table, 'siret', 'siret', 2),
libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3),
code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1)
}
end
@ -106,19 +106,19 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'user'
{
email: create_column('Email', table, 'email', 'email', 2)
email: create_column('Email', table, 'email', 'email', 2)
}
end
def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg
{
libelle: libelle,
table: table,
attr: attr,
attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg,
order: nil,
filter: nil
libelle: libelle,
table: table,
attr: attr,
attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg,
order: nil,
filter: nil
}
end
end

View file

@ -5,12 +5,12 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
def self.available_columns_for procedure_id = nil
columns = {
dossier: columns_dossier,
procedure: columns_procedure,
entreprise: columns_entreprise,
etablissement: columns_etablissement,
user: columns_user,
france_connect: columns_france_connect
dossier: columns_dossier,
procedure: columns_procedure,
entreprise: columns_entreprise,
etablissement: columns_etablissement,
user: columns_user,
france_connect: columns_france_connect
}
columns
end
@ -21,10 +21,10 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = nil
{
dossier_id: create_column('ID', table, 'id', 'id', 1),
created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2),
updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2),
state: create_column('Statut', table, 'state', 'display_state', 1)
dossier_id: create_column('ID', table, 'id', 'id', 1),
created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2),
updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2),
state: create_column('Statut', table, 'state', 'display_state', 1)
}
end
@ -32,9 +32,9 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'procedure'
{
libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4),
organisation: create_column('Organisation', table, 'organisation', 'organisation', 3),
direction: create_column('Direction', table, 'direction', 'direction', 3)
libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4),
organisation: create_column('Organisation', table, 'organisation', 'organisation', 3),
direction: create_column('Direction', table, 'direction', 'direction', 3)
}
end
@ -42,12 +42,12 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'entreprise'
{
siren: create_column('SIREN', table, 'siren', 'siren', 2),
forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3),
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
siren: create_column('SIREN', table, 'siren', 'siren', 2),
forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3),
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
}
end
@ -55,16 +55,16 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'etablissement'
{
siret: create_column('SIRET', table, 'siret', 'siret', 2),
libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3),
code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1)
siret: create_column('SIRET', table, 'siret', 'siret', 2),
libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3),
code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1)
}
end
def self.columns_user
table = 'user'
{
email: create_column('Email', table, 'email', 'email', 2)
email: create_column('Email', table, 'email', 'email', 2)
}
end
@ -72,21 +72,21 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'france_connect_information'
{
gender: create_column('Civilité (FC)', table, 'gender', 'gender_fr', 1),
given_name: create_column('Prénom (FC)', table, 'given_name', 'given_name', 2),
family_name: create_column('Nom (FC)', table, 'family_name', 'family_name', 2)
gender: create_column('Civilité (FC)', table, 'gender', 'gender_fr', 1),
given_name: create_column('Prénom (FC)', table, 'given_name', 'given_name', 2),
family_name: create_column('Nom (FC)', table, 'family_name', 'family_name', 2)
}
end
def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg
{
libelle: libelle,
table: table,
attr: attr,
attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg,
order: nil,
filter: nil
libelle: libelle,
table: table,
attr: attr,
attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg,
order: nil,
filter: nil
}
end
end

View file

@ -36,14 +36,14 @@ describe Admin::PiecesJustificativesController, type: :controller do
let(:description) { "relevé d'identité bancaire" }
let(:update_params) do
{
types_de_piece_justificative_attributes:
types_de_piece_justificative_attributes:
{
'0' =>
{
'0' =>
{
libelle: libelle,
description: description
}
libelle: libelle,
description: description
}
}
}
end

View file

@ -18,17 +18,17 @@ describe Admin::ProceduresController, type: :controller do
let(:procedure_params) {
{
libelle: libelle,
description: description,
organisation: organisation,
direction: direction,
lien_demarche: lien_demarche,
cerfa_flag: cerfa_flag,
module_api_carto_attributes: {
use_api_carto: use_api_carto,
quartiers_prioritaires: quartiers_prioritaires,
cadastre: cadastre
}
libelle: libelle,
description: description,
organisation: organisation,
direction: direction,
lien_demarche: lien_demarche,
cerfa_flag: cerfa_flag,
module_api_carto_attributes: {
use_api_carto: use_api_carto,
quartiers_prioritaires: quartiers_prioritaires,
cadastre: cadastre
}
}
}

View file

@ -21,18 +21,20 @@ describe Gestionnaires::PasswordsController, type: :controller do
put :update, params: {gestionnaire: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
password_confirmation: "supersecret"
}}
expect(subject.current_gestionnaire).to eq(gestionnaire)
expect(subject.current_user).to eq(user)
end
it "also signs administrateur in" do
put :update, params: {gestionnaire: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
}}
put :update, params: {
gestionnaire: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret"
}
}
expect(subject.current_administrateur).to eq(administrateur)
expect(subject.current_user).to eq(user)
end

View file

@ -70,12 +70,13 @@ describe StatsController, type: :controller do
subject { @controller.send(:cumulative_hash, association, :updated_at) }
it { expect(subject).to eq({
it do
expect(subject).to eq({
2.month.ago.beginning_of_month => 2,
1.month.ago.beginning_of_month => 4,
1.hour.ago.beginning_of_month => 5
})
}
end
end
context "while a super admin is not logged in" do
@ -83,11 +84,12 @@ describe StatsController, type: :controller do
subject { @controller.send(:cumulative_hash, association, :updated_at) }
it { expect(subject).to eq({
it do
expect(subject).to eq({
2.month.ago.beginning_of_month => 2,
1.month.ago.beginning_of_month => 4
})
}
end
end
end

View file

@ -18,21 +18,25 @@ describe Users::PasswordsController, type: :controller do
end
it "also signs gestionnaire in" do
put :update, params: {user: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
}}
put :update, params: {
user: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
}
}
expect(subject.current_user).to eq(user)
expect(subject.current_gestionnaire).to eq(gestionnaire)
end
it "also signs administrateur in" do
put :update, params: {user: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
}}
put :update, params: {
user: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
}
}
expect(subject.current_user).to eq(user)
expect(subject.current_administrateur).to eq(administrateur)
end

View file

@ -7,12 +7,11 @@ describe EntrepriseDecorator do
let(:prenom) { 'mon prenom' }
let(:entreprise_params) do
{
capital_social: 123_000,
code_effectif_entreprise: code_effectif,
raison_sociale: raison_sociale,
nom: nom,
prenom: prenom
capital_social: 123_000,
code_effectif_entreprise: code_effectif,
raison_sociale: raison_sociale,
nom: nom,
prenom: prenom
}
end
let(:entreprise) { create(:entreprise, entreprise_params) }

View file

@ -24,8 +24,8 @@ describe FileSizeValidator, lib: true do
describe 'options uses a symbol' do
let(:options) do
{
maximum: :test,
attributes: { content: attachment }
maximum: :test,
attributes: { content: attachment }
}
end

View file

@ -48,10 +48,10 @@ describe TypesDeChampService do
it do
is_expected.to match({
'0' => { 'libelle' => 'a', 'order_place' => '0' },
'1' => { 'libelle' => 'c', 'order_place' => '1' },
'2' => { 'libelle' => 'b', 'order_place' => '2' }
})
'0' => { 'libelle' => 'a', 'order_place' => '0' },
'1' => { 'libelle' => 'c', 'order_place' => '1' },
'2' => { 'libelle' => 'b', 'order_place' => '2' }
})
end
end
@ -66,10 +66,10 @@ describe TypesDeChampService do
it do
is_expected.to match({
'0' => { 'libelle' => 'b', 'order_place' => '0' },
'1' => { 'libelle' => 'a', 'order_place' => '1' },
'2' => { 'libelle' => 'c', 'order_place' => '2' }
})
'0' => { 'libelle' => 'b', 'order_place' => '0' },
'1' => { 'libelle' => 'a', 'order_place' => '1' },
'2' => { 'libelle' => 'c', 'order_place' => '2' }
})
end
end
@ -85,11 +85,11 @@ describe TypesDeChampService do
it 'does not change the natural order' do
is_expected.to match({
'0' => { 'libelle' => 'a', 'order_place' => '0' },
'1' => { 'libelle' => 'b', 'order_place' => '1' },
'2' => { 'libelle' => 'c', 'order_place' => '2' },
'3' => { 'libelle' => 'd', 'order_place' => '3' }
})
'0' => { 'libelle' => 'a', 'order_place' => '0' },
'1' => { 'libelle' => 'b', 'order_place' => '1' },
'2' => { 'libelle' => 'c', 'order_place' => '2' },
'3' => { 'libelle' => 'd', 'order_place' => '3' }
})
end
end
end