Enable the Layout/IndentArray cop

This commit is contained in:
gregoirenovel 2018-01-15 18:54:57 +01:00
parent 5125cf8396
commit 9e0e553f80
10 changed files with 129 additions and 128 deletions

View file

@ -98,7 +98,8 @@ Layout/FirstParameterIndentation:
Enabled: true Enabled: true
Layout/IndentArray: Layout/IndentArray:
Enabled: false Enabled: true
EnforcedStyle: consistent
Layout/IndentAssignment: Layout/IndentAssignment:
Enabled: false Enabled: false

View file

@ -217,6 +217,6 @@ class Gestionnaire < ActiveRecord::Base
updated_annotations, updated_annotations,
updated_avis, updated_avis,
updated_messagerie updated_messagerie
].map { |query| query.distinct.ids }.flatten.uniq ].map { |query| query.distinct.ids }.flatten.uniq
end end
end end

View file

@ -1,10 +1,10 @@
class GeojsonService class GeojsonService
def self.to_json_polygon_for_qp coordinates def self.to_json_polygon_for_qp coordinates
polygon = { polygon = {
geo: { geo: {
type: "Polygon", type: "Polygon",
coordinates: [coordinates] coordinates: [coordinates]
} }
} }
polygon.to_json polygon.to_json
@ -12,15 +12,15 @@ class GeojsonService
def self.to_json_polygon_for_cadastre coordinates def self.to_json_polygon_for_cadastre coordinates
polygon = { polygon = {
geom: { geom: {
type: "Feature", type: "Feature",
geometry: { geometry: {
type: "Polygon", type: "Polygon",
coordinates: [ coordinates: [
coordinates coordinates
] ]
}
} }
}
} }
polygon.to_json polygon.to_json

View file

@ -45,30 +45,30 @@ set :rails_env, ENV["to"]
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. # Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step. # They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, [ set :shared_paths, [
'log', 'log',
'bin', 'bin',
'uploads', 'uploads',
'tmp/pids', 'tmp/pids',
'tmp/cache', 'tmp/cache',
'tmp/sockets', 'tmp/sockets',
'public/system', 'public/system',
'public/uploads', 'public/uploads',
'config/database.yml', 'config/database.yml',
"config/skylight.yml", "config/skylight.yml",
"config/fog_credentials.yml", "config/fog_credentials.yml",
'config/initializers/secret_token.rb', 'config/initializers/secret_token.rb',
'config/initializers/features.yml', 'config/initializers/features.yml',
"config/environments/#{rails_env}.rb", "config/environments/#{rails_env}.rb",
"config/initializers/token.rb", "config/initializers/token.rb",
"config/initializers/urls.rb", "config/initializers/urls.rb",
"config/initializers/super_admin.rb", "config/initializers/super_admin.rb",
"config/unicorn.rb", "config/unicorn.rb",
"config/initializers/raven.rb", "config/initializers/raven.rb",
'config/france_connect.yml', 'config/france_connect.yml',
'config/github_secrets.yml', 'config/github_secrets.yml',
'config/initializers/mailjet.rb', 'config/initializers/mailjet.rb',
'config/initializers/storage_url.rb' 'config/initializers/storage_url.rb'
] ]
set :rbenv_path, "/usr/local/rbenv/bin/rbenv" set :rbenv_path, "/usr/local/rbenv/bin/rbenv"

View file

@ -21,27 +21,27 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
def valid_couple_table_attr? table, column def valid_couple_table_attr? table, column
couples = [ couples = [
{ {
table: :dossier, table: :dossier,
column: :dossier_id column: :dossier_id
}, },
{ {
table: :procedure, table: :procedure,
column: :libelle column: :libelle
}, },
{ {
table: :etablissement, table: :etablissement,
column: :siret column: :siret
}, },
{ {
table: :entreprise, table: :entreprise,
column: :raison_sociale column: :raison_sociale
}, },
{ {
table: :dossier, table: :dossier,
column: :state column: :state
} }
] ]
couples.include?({table: table, column: column}) couples.include?({table: table, column: column})
end end

View file

@ -119,27 +119,27 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
def valid_couple_table_attr? table, column def valid_couple_table_attr? table, column
couples = [ couples = [
{ {
table: :dossier, table: :dossier,
column: :dossier_id column: :dossier_id
}, },
{ {
table: :procedure, table: :procedure,
column: :libelle column: :libelle
}, },
{ {
table: :etablissement, table: :etablissement,
column: :siret column: :siret
}, },
{ {
table: :entreprise, table: :entreprise,
column: :raison_sociale column: :raison_sociale
}, },
{ {
table: :dossier, table: :dossier,
column: :state column: :state
} }
] ]
couples.include?({table: table, column: column}) couples.include?({table: table, column: column})
end end

View file

@ -132,7 +132,8 @@ describe API::V1::DossiersController do
it { expect(subject.keys).to match_array(field_list) } it { expect(subject.keys).to match_array(field_list) }
describe 'entreprise' do describe 'entreprise' do
let(:field_list) { [ let(:field_list) {
[
:siren, :siren,
:capital_social, :capital_social,
:numero_tva_intracommunautaire, :numero_tva_intracommunautaire,
@ -144,7 +145,8 @@ describe API::V1::DossiersController do
:code_effectif_entreprise, :code_effectif_entreprise,
:date_creation, :date_creation,
:nom, :nom,
:prenom] :prenom
]
} }
subject { super()[:entreprise] } subject { super()[:entreprise] }
@ -162,11 +164,7 @@ describe API::V1::DossiersController do
end end
describe 'types_de_piece_justificative' do describe 'types_de_piece_justificative' do
let(:field_list) { [ let(:field_list) { [:id, :libelle, :description] }
:id,
:libelle,
:description]
}
subject { super()[:types_de_piece_justificative] } subject { super()[:types_de_piece_justificative] }
it { expect(subject.length).to eq 2 } it { expect(subject.length).to eq 2 }
@ -185,9 +183,7 @@ describe API::V1::DossiersController do
create :piece_justificative, :rib, dossier: dossier, type_de_piece_justificative: dossier.procedure.types_de_piece_justificative.first, user: dossier.user create :piece_justificative, :rib, dossier: dossier, type_de_piece_justificative: dossier.procedure.types_de_piece_justificative.first, user: dossier.user
end end
let(:field_list) { [ let(:field_list) { [:url, :created_at, :type_de_piece_justificative_id] }
:url, :created_at, :type_de_piece_justificative_id]
}
subject { super()[:pieces_justificatives].first } subject { super()[:pieces_justificatives].first }
it { expect(subject.keys.include?(:content_url)).to be_truthy } it { expect(subject.keys.include?(:content_url)).to be_truthy }
@ -204,8 +200,7 @@ describe API::V1::DossiersController do
end end
describe 'champs' do describe 'champs' do
let(:field_list) { [ let(:field_list) { [:url]
:url]
} }
subject { super()[:champs] } subject { super()[:champs] }
@ -218,12 +213,14 @@ describe API::V1::DossiersController do
it { expect(subject.keys.include?(:type_de_champ)).to be_truthy } it { expect(subject.keys.include?(:type_de_champ)).to be_truthy }
describe 'type de champ' do describe 'type de champ' do
let(:field_list) { [ let(:field_list) {
[
:id, :id,
:libelle, :libelle,
:description, :description,
:order_place, :order_place,
:type] :type
]
} }
subject { super()[:type_de_champ] } subject { super()[:type_de_champ] }
@ -277,9 +274,7 @@ describe API::V1::DossiersController do
end end
describe 'champs_private' do describe 'champs_private' do
let(:field_list) { [ let(:field_list) { [:url] }
:url]
}
subject { super()[:champs_private] } subject { super()[:champs_private] }
it { expect(subject.length).to eq 1 } it { expect(subject.length).to eq 1 }
@ -291,12 +286,14 @@ describe API::V1::DossiersController do
it { expect(subject.keys.include?(:type_de_champ)).to be_truthy } it { expect(subject.keys.include?(:type_de_champ)).to be_truthy }
describe 'type de champ' do describe 'type de champ' do
let(:field_list) { [ let(:field_list) {
[
:id, :id,
:libelle, :libelle,
:description, :description,
:order_place, :order_place,
:type] :type
]
} }
subject { super()[:type_de_champ] } subject { super()[:type_de_champ] }
@ -343,9 +340,7 @@ describe API::V1::DossiersController do
end end
describe 'user' do describe 'user' do
let(:field_list) { [ let(:field_list) { [:url, :created_at, :type_de_piece_justificative_id] }
:url, :created_at, :type_de_piece_justificative_id]
}
subject { super()[:user] } subject { super()[:user] }
it { expect(subject[:email]).not_to be_nil } it { expect(subject[:email]).not_to be_nil }
@ -353,7 +348,8 @@ describe API::V1::DossiersController do
end end
describe 'etablissement' do describe 'etablissement' do
let(:field_list) { [ let(:field_list) {
[
:siret, :siret,
:siege_social, :siege_social,
:naf, :naf,

View file

@ -18,11 +18,12 @@ describe StatsController, type: :controller do
subject { @controller.send(:last_four_months_hash, association, :updated_at) } subject { @controller.send(:last_four_months_hash, association, :updated_at) }
it { expect(subject).to match_array([ it do
[I18n.l(62.days.ago.beginning_of_month, format: "%B %Y"), 2], expect(subject).to match_array([
[I18n.l(31.days.ago.beginning_of_month, format: "%B %Y"), 1] [I18n.l(62.days.ago.beginning_of_month, format: "%B %Y"), 2],
[I18n.l(31.days.ago.beginning_of_month, format: "%B %Y"), 1]
]) ])
} end
end end
context "while a super admin is logged in" do context "while a super admin is logged in" do
@ -41,11 +42,12 @@ describe StatsController, type: :controller do
subject { @controller.send(:last_four_months_hash, association, :updated_at) } subject { @controller.send(:last_four_months_hash, association, :updated_at) }
it { expect(subject).to eq([ it do
[I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 1], expect(subject).to eq([
[I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 2] [I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 1],
[I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 2]
]) ])
} end
end end
end end

View file

@ -23,18 +23,20 @@ describe CARTO::SGMAP::Cadastre::Adapter do
subject { adapter.filter_properties adapter.data_source } subject { adapter.filter_properties adapter.data_source }
it { expect(subject.size).to eq 9 } it { expect(subject.size).to eq 9 }
it { expect(subject.keys).to eq [ it do
:surface_intersection, expect(subject.keys).to eq
:surface_parcelle, [
:numero, :surface_intersection,
:feuille, :surface_parcelle,
:section, :numero,
:code_dep, :feuille,
:nom_com, :section,
:code_com, :code_dep,
:code_arr :nom_com,
] :code_com,
} :code_arr
]
end
end end
describe 'Attributes' do describe 'Attributes' do

View file

@ -3,11 +3,11 @@ require 'spec_helper'
describe GeojsonService do describe GeojsonService do
let(:good_coordinates) { let(:good_coordinates) {
[ [
[5.93536376953125, 48.91888968903368], [5.93536376953125, 48.91888968903368],
[5.93536376953125, 49.26780455063753], [5.93536376953125, 49.26780455063753],
[7.094421386718749, 49.26780455063753], [7.094421386718749, 49.26780455063753],
[7.094421386718749, 48.91888968903368], [7.094421386718749, 48.91888968903368],
[5.93536376953125, 48.91888968903368] [5.93536376953125, 48.91888968903368]
] ]
} }