commit
a21e26bd82
15 changed files with 74 additions and 54 deletions
37
.rubocop.yml
37
.rubocop.yml
|
@ -289,7 +289,7 @@ Layout/SpaceInsideReferenceBrackets:
|
|||
Layout/SpaceInsideStringInterpolation:
|
||||
Enabled: true
|
||||
|
||||
Layout/Tab:
|
||||
Layout/IndentationStyle:
|
||||
Enabled: true
|
||||
|
||||
Layout/TrailingEmptyLines:
|
||||
|
@ -506,7 +506,7 @@ Lint/UselessAssignment:
|
|||
Exclude:
|
||||
- "spec/**/*"
|
||||
|
||||
Lint/UselessComparison:
|
||||
Lint/BinaryOperatorWithIdenticalOperands:
|
||||
Enabled: true
|
||||
|
||||
Lint/UselessElseWithoutRescue:
|
||||
|
@ -1045,7 +1045,7 @@ Style/MethodCalledOnDoEndBlock:
|
|||
Style/MethodDefParentheses:
|
||||
Enabled: true
|
||||
|
||||
Style/MethodMissingSuper:
|
||||
Lint/MissingSuper:
|
||||
Enabled: false
|
||||
|
||||
Style/MinMax:
|
||||
|
@ -1315,3 +1315,34 @@ Style/YodaCondition:
|
|||
|
||||
Style/ZeroLengthPredicate:
|
||||
Enabled: true
|
||||
|
||||
Rails/ActiveRecordCallbacksOrder:
|
||||
Enabled: false
|
||||
Rails/AfterCommitOverride:
|
||||
Enabled: true
|
||||
Rails/FindById:
|
||||
Enabled: true
|
||||
Rails/Inquiry:
|
||||
Enabled: true
|
||||
Rails/MailerName:
|
||||
Enabled: true
|
||||
Rails/MatchRoute:
|
||||
Enabled: true
|
||||
Rails/NegateInclude:
|
||||
Enabled: false
|
||||
Rails/Pluck:
|
||||
Enabled: false
|
||||
Rails/PluckInWhere:
|
||||
Enabled: true
|
||||
Rails/RenderInline:
|
||||
Enabled: true
|
||||
Rails/RenderPlainText:
|
||||
Enabled: true
|
||||
Rails/ShortI18n:
|
||||
Enabled: true
|
||||
Rails/SquishedSQLHeredocs:
|
||||
Enabled: true
|
||||
Rails/WhereExists:
|
||||
Enabled: true
|
||||
Rails/WhereNot:
|
||||
Enabled: true
|
||||
|
|
8
Gemfile
8
Gemfile
|
@ -3,8 +3,8 @@ source 'https://rubygems.org'
|
|||
gem 'aasm'
|
||||
gem 'active_link_to' # Automatically set a class on active links
|
||||
gem 'active_model_serializers'
|
||||
gem 'active_storage_validations'
|
||||
gem 'activestorage-openstack'
|
||||
gem 'active_storage_validations'
|
||||
gem 'administrate'
|
||||
gem 'after_party'
|
||||
gem 'anchored'
|
||||
|
@ -31,13 +31,13 @@ gem 'flipper-active_record'
|
|||
gem 'flipper-ui'
|
||||
gem 'font-awesome-rails'
|
||||
gem 'fugit'
|
||||
gem 'geo_coord', require: "geo/coord"
|
||||
gem 'geocoder'
|
||||
gem 'geo_coord', require: "geo/coord"
|
||||
gem 'gon'
|
||||
gem 'graphql'
|
||||
gem 'graphql-batch'
|
||||
gem 'graphql-rails_logger'
|
||||
gem 'graphql_playground-rails'
|
||||
gem 'graphql-rails_logger'
|
||||
gem 'groupdate'
|
||||
gem 'haml-rails'
|
||||
gem 'hashie'
|
||||
|
@ -118,8 +118,8 @@ group :development, :test do
|
|||
gem 'graphql-schema_comparator'
|
||||
gem 'mina', git: 'https://github.com/mina-deploy/mina.git', require: false # Deploy
|
||||
gem 'pry-byebug'
|
||||
gem 'rspec-rails'
|
||||
gem 'rspec_junit_formatter', require: false
|
||||
gem 'rspec-rails'
|
||||
gem 'ruby-debug-ide', require: false
|
||||
gem 'simple_xlsx_reader'
|
||||
gem 'spring' # Spring speeds up development by keeping your application running in the background
|
||||
|
|
27
Gemfile.lock
27
Gemfile.lock
|
@ -344,7 +344,6 @@ GEM
|
|||
iban-tools (1.1.0)
|
||||
ice_nine (0.11.2)
|
||||
ipaddress (0.8.3)
|
||||
jaro_winkler (1.5.4)
|
||||
jquery-rails (4.4.0)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
|
@ -554,7 +553,7 @@ GEM
|
|||
execjs
|
||||
railties (>= 3.2)
|
||||
tilt
|
||||
regexp_parser (1.7.1)
|
||||
regexp_parser (1.8.0)
|
||||
request_store (1.5.0)
|
||||
rack (>= 1.4)
|
||||
responders (3.0.1)
|
||||
|
@ -597,23 +596,27 @@ GEM
|
|||
rspec-support (3.9.3)
|
||||
rspec_junit_formatter (0.4.1)
|
||||
rspec-core (>= 2, < 4, != 2.12.0)
|
||||
rubocop (0.81.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
rubocop (0.91.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
parser (>= 2.7.1.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.7)
|
||||
rexml
|
||||
rubocop-ast (>= 0.4.0, < 1.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
rubocop-ast (0.4.2)
|
||||
parser (>= 2.7.1.4)
|
||||
rubocop-performance (1.8.1)
|
||||
rubocop (>= 0.87.0)
|
||||
rubocop-ast (>= 0.4.0)
|
||||
rubocop-rails (2.8.1)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
rubocop-rails_config (0.10.0)
|
||||
rubocop (>= 0.87.0)
|
||||
rubocop-rails_config (0.12.6)
|
||||
railties (>= 5.0)
|
||||
rubocop (~> 0.80)
|
||||
rubocop (~> 0.82)
|
||||
rubocop-performance (~> 1.3)
|
||||
rubocop-rails (~> 2.0)
|
||||
rubocop-rspec-focused (1.0.0)
|
||||
|
|
|
@ -360,7 +360,7 @@ class StatsController < ApplicationController
|
|||
if weekly_dossiers_count == 0
|
||||
result = 0
|
||||
else
|
||||
weekly_dossier_with_avis_count = weekly_dossiers.filter { |dossier| dossier.avis.present? }.count
|
||||
weekly_dossier_with_avis_count = weekly_dossiers.count { |dossier| dossier.avis.present? }
|
||||
result = percentage(weekly_dossier_with_avis_count, weekly_dossiers_count)
|
||||
end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module ChampHelper
|
|||
when GeoArea.sources.fetch(:cadastre)
|
||||
capture do
|
||||
concat "Parcelle n° #{geo_area.numero} - Feuille #{geo_area.code_arr} #{geo_area.section} #{geo_area.feuille} - #{geo_area.surface_parcelle.round} m"
|
||||
concat content_tag(:sup, "2")
|
||||
concat tag.sup("2")
|
||||
end
|
||||
when GeoArea.sources.fetch(:quartier_prioritaire)
|
||||
"#{geo_area.commune} : #{geo_area.nom}"
|
||||
|
@ -48,7 +48,7 @@ module ChampHelper
|
|||
if geo_area.area.present?
|
||||
capture do
|
||||
concat "Une aire de surface #{geo_area.area} m"
|
||||
concat content_tag(:sup, "2")
|
||||
concat tag.sup("2")
|
||||
end
|
||||
else
|
||||
"Une aire de surface inconnue"
|
||||
|
|
|
@ -75,7 +75,7 @@ module DossierHelper
|
|||
def status_badge(state)
|
||||
status_text = dossier_display_state(state, lower: true)
|
||||
status_class = state.tr('_', '-')
|
||||
content_tag(:span, status_text, class: "label #{status_class} ")
|
||||
tag.span(status_text, class: "label #{status_class} ")
|
||||
end
|
||||
|
||||
def deletion_reason_badge(reason)
|
||||
|
@ -87,7 +87,7 @@ module DossierHelper
|
|||
status_class = 'unknown'
|
||||
end
|
||||
|
||||
content_tag(:span, status_text, class: "label #{status_class} ")
|
||||
tag.span(status_text, class: "label #{status_class} ")
|
||||
end
|
||||
|
||||
def demandeur_dossier(dossier)
|
||||
|
|
|
@ -8,7 +8,7 @@ module ProcedureHelper
|
|||
end
|
||||
|
||||
def procedure_libelle(procedure)
|
||||
parts = procedure.brouillon? ? [content_tag(:span, 'démarche en test', class: 'badge')] : []
|
||||
parts = procedure.brouillon? ? [tag.span('démarche en test', class: 'badge')] : []
|
||||
parts << procedure.libelle
|
||||
safe_join(parts, ' ')
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class ApplicationMailer < ActionMailer::Base
|
|||
end
|
||||
|
||||
rescue_from Net::SMTPServerBusy do |error|
|
||||
if error.message =~ /unexpected recipients/
|
||||
if /unexpected recipients/.match?(error.message)
|
||||
message.perform_deliveries = false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class DeviseUserMailer < Devise::Mailer
|
|||
end
|
||||
|
||||
rescue_from Net::SMTPServerBusy do |error|
|
||||
if error.message =~ /unexpected recipients/
|
||||
if /unexpected recipients/.match?(error.message)
|
||||
message.perform_deliveries = false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -295,8 +295,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
def valid_columns_for_table(table)
|
||||
@column_whitelist ||= fields
|
||||
.group_by { |field| field['table'] }
|
||||
.map { |table, fields| [table, Set.new(fields.pluck('column'))] }
|
||||
.to_h
|
||||
.transform_values { |fields| Set.new(fields.pluck('column')) }
|
||||
|
||||
@column_whitelist[table] || []
|
||||
end
|
||||
|
|
|
@ -81,16 +81,12 @@ class AdministrateurUsageStatisticsService
|
|||
with_default(
|
||||
0,
|
||||
nb_dossiers_by_administrateur_id_and_procedure_id_and_synthetic_state[administrateur_id]
|
||||
.map do |procedure_id, nb_dossiers_by_synthetic_state|
|
||||
[
|
||||
procedure_id,
|
||||
nb_dossiers_by_synthetic_state
|
||||
.transform_values do |nb_dossiers_by_synthetic_state|
|
||||
nb_dossiers_by_synthetic_state
|
||||
.reject { |synthetic_state, _count| ['brouillon', 'archive'].include?(synthetic_state) }
|
||||
.map { |_synthetic_state, count| count }
|
||||
.sum
|
||||
]
|
||||
end
|
||||
.to_h
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -105,8 +101,7 @@ class AdministrateurUsageStatisticsService
|
|||
.reject { |procedure_id, _nb_dossiers_by_synthetic_state| is_brouillon(procedure_id) }
|
||||
.flat_map { |_procedure_id, nb_dossiers_by_synthetic_state| nb_dossiers_by_synthetic_state.to_a }
|
||||
.group_by { |synthetic_state, _count| synthetic_state }
|
||||
.map { |synthetic_state, synthetic_states_and_counts| [synthetic_state, synthetic_states_and_counts.map { |_synthetic_state, count| count }.sum] }
|
||||
.to_h
|
||||
.transform_values { |synthetic_states_and_counts| synthetic_states_and_counts.map { |_synthetic_state, count| count }.sum }
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
require ::File.expand_path('config/environment', __dir__)
|
||||
|
||||
run Rails.application
|
||||
|
|
|
@ -213,8 +213,7 @@ feature 'The routing', js: true do
|
|||
|
||||
def register_instructeur_and_log_in(email)
|
||||
confirmation_email = emails_sent_to(email)
|
||||
.filter { |m| m.subject == 'Activez votre compte instructeur' }
|
||||
.first
|
||||
.find { |m| m.subject == 'Activez votre compte instructeur' }
|
||||
token_params = confirmation_email.body.match(/token=[^"]+/)
|
||||
|
||||
visit "users/activate?#{token_params}"
|
||||
|
|
|
@ -151,13 +151,11 @@ describe AttestationTemplate, type: :model do
|
|||
context 'and their value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleA' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleA' }
|
||||
.update(value: 'libelle1')
|
||||
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleB' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleB' }
|
||||
.update(value: 'libelle2')
|
||||
end
|
||||
|
||||
|
|
|
@ -123,13 +123,11 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
context 'and their value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleA' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleA' }
|
||||
.update(value: 'libelle1')
|
||||
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleB' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleB' }
|
||||
.update(value: 'libelle2')
|
||||
end
|
||||
|
||||
|
@ -151,8 +149,7 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
context 'and their value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == "Intitulé de l'‘«\"évènement\"»’" }
|
||||
.first
|
||||
.find { |champ| champ.libelle == "Intitulé de l'‘«\"évènement\"»’" }
|
||||
.update(value: 'ceci est mon évènement')
|
||||
end
|
||||
|
||||
|
@ -302,13 +299,11 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
context 'and its value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:date) }
|
||||
.first
|
||||
.find { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:date) }
|
||||
.update(value: '2017-04-15')
|
||||
|
||||
dossier.champs
|
||||
.filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:datetime) }
|
||||
.first
|
||||
.find { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:datetime) }
|
||||
.update(value: '2017-09-13 09:00')
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue