Merge pull request #953 from sgmap/rubocop-perf
Enable all the rubicop perf cops
This commit is contained in:
commit
e8d7322ee3
9 changed files with 36 additions and 36 deletions
48
.rubocop.yml
48
.rubocop.yml
|
@ -444,76 +444,76 @@ Metrics/PerceivedComplexity:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Performance/Caller:
|
Performance/Caller:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/CaseWhenSplat:
|
Performance/CaseWhenSplat:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/Casecmp:
|
Performance/Casecmp:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/CompareWithBlock:
|
Performance/CompareWithBlock:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/Count:
|
Performance/Count:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/Detect:
|
Performance/Detect:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/DoubleStartEndWith:
|
Performance/DoubleStartEndWith:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/EndWith:
|
Performance/EndWith:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/FixedSize:
|
Performance/FixedSize:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/FlatMap:
|
Performance/FlatMap:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/HashEachMethods:
|
Performance/HashEachMethods:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/LstripRstrip:
|
Performance/LstripRstrip:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/RangeInclude:
|
Performance/RangeInclude:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/RedundantBlockCall:
|
Performance/RedundantBlockCall:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/RedundantMatch:
|
Performance/RedundantMatch:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/RedundantMerge:
|
Performance/RedundantMerge:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/RedundantSortBy:
|
Performance/RedundantSortBy:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/RegexpMatch:
|
Performance/RegexpMatch:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/ReverseEach:
|
Performance/ReverseEach:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/Sample:
|
Performance/Sample:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/Size:
|
Performance/Size:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/StartWith:
|
Performance/StartWith:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/StringReplacement:
|
Performance/StringReplacement:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Performance/TimesMap:
|
Performance/TimesMap:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/ActionFilter:
|
Rails/ActionFilter:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
|
@ -63,8 +63,8 @@ class Admin::AttestationTemplatesController < AdminController
|
||||||
.permit(:title, :body, :footer, :signature)
|
.permit(:title, :body, :footer, :signature)
|
||||||
.merge(activated: true)
|
.merge(activated: true)
|
||||||
|
|
||||||
@activated_attestation_params.merge!(logo: uninterlaced_png(params['attestation_template']['logo']))
|
@activated_attestation_params[:logo] = uninterlaced_png(params['attestation_template']['logo'])
|
||||||
@activated_attestation_params.merge!(signature: uninterlaced_png(params['attestation_template']['signature']))
|
@activated_attestation_params[:signature] = uninterlaced_png(params['attestation_template']['signature'])
|
||||||
end
|
end
|
||||||
|
|
||||||
@activated_attestation_params
|
@activated_attestation_params
|
||||||
|
|
|
@ -52,7 +52,7 @@ class StatsController < ApplicationController
|
||||||
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
|
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
|
||||||
.count
|
.count
|
||||||
.to_a
|
.to_a
|
||||||
.sort{ |x, y| x[0] <=> y[0] }
|
.sort_by { |a| a[0] }
|
||||||
.map { |e| [I18n.l(e.first, format: "%B %Y"), e.last] }
|
.map { |e| [I18n.l(e.first, format: "%B %Y"), e.last] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class StatsController < ApplicationController
|
||||||
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
|
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
|
||||||
.count
|
.count
|
||||||
.to_a
|
.to_a
|
||||||
.sort{ |x, y| x[0] <=> y[0] }
|
.sort_by { |a| a[0] }
|
||||||
.map { |x, y| { x => (sum += y)} }
|
.map { |x, y| { x => (sum += y)} }
|
||||||
.reduce({}, :merge)
|
.reduce({}, :merge)
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@ class SIADE::API
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.call(url, params = {})
|
def self.call(url, params = {})
|
||||||
params.merge!(token: SIADETOKEN)
|
params[:token] = SIADETOKEN
|
||||||
|
|
||||||
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE
|
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class EtablissementCsvSerializer < EtablissementSerializer
|
class EtablissementCsvSerializer < EtablissementSerializer
|
||||||
def adresse
|
def adresse
|
||||||
object.adresse.chomp.gsub("\r\n", ' ').gsub("\r", '')
|
object.adresse.chomp.gsub("\r\n", ' ').delete("\r")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,8 +43,8 @@ class DossierService
|
||||||
unless @france_connect_information.nil?
|
unless @france_connect_information.nil?
|
||||||
|
|
||||||
mandataires_list.each do |mandataire|
|
mandataires_list.each do |mandataire|
|
||||||
return true if mandataire[:nom].upcase == @france_connect_information.family_name.upcase &&
|
return true if mandataire[:nom].casecmp(@france_connect_information.family_name).zero? &&
|
||||||
mandataire[:prenom].upcase == @france_connect_information.given_name.upcase &&
|
mandataire[:prenom].casecmp(@france_connect_information.given_name).zero? &&
|
||||||
mandataire[:date_naissance_timestamp] == @france_connect_information.birthdate.to_time.to_i
|
mandataire[:date_naissance_timestamp] == @france_connect_information.birthdate.to_time.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -132,7 +132,7 @@ class DossiersListGestionnaireService
|
||||||
def where_filter
|
def where_filter
|
||||||
filter_preference_list.inject('') do |acc, preference|
|
filter_preference_list.inject('') do |acc, preference|
|
||||||
unless preference.filter.blank?
|
unless preference.filter.blank?
|
||||||
filter = preference.filter.gsub('*', '%').gsub("'", "''")
|
filter = preference.filter.tr('*', '%').gsub("'", "''")
|
||||||
filter = "%" + filter + "%" unless filter.include? '%'
|
filter = "%" + filter + "%" unless filter.include? '%'
|
||||||
|
|
||||||
value = preference.table_with_s_attr
|
value = preference.table_with_s_attr
|
||||||
|
|
|
@ -4,7 +4,7 @@ class ModuleApiCartoService
|
||||||
qp_list = generate_qp JSON.parse(json_latlngs)
|
qp_list = generate_qp JSON.parse(json_latlngs)
|
||||||
|
|
||||||
qp_list.each_value do |qp|
|
qp_list.each_value do |qp|
|
||||||
qp.merge!({dossier_id: dossier.id})
|
qp[:dossier_id] = dossier.id
|
||||||
qp[:geometry] = qp[:geometry].to_json
|
qp[:geometry] = qp[:geometry].to_json
|
||||||
QuartierPrioritaire.create(qp)
|
QuartierPrioritaire.create(qp)
|
||||||
end
|
end
|
||||||
|
@ -16,7 +16,7 @@ class ModuleApiCartoService
|
||||||
cadastre_list = generate_cadastre JSON.parse(json_latlngs)
|
cadastre_list = generate_cadastre JSON.parse(json_latlngs)
|
||||||
|
|
||||||
cadastre_list.each do |cadastre|
|
cadastre_list.each do |cadastre|
|
||||||
cadastre.merge!({dossier_id: dossier.id})
|
cadastre[:dossier_id] = dossier.id
|
||||||
cadastre[:geometry] = cadastre[:geometry].to_json
|
cadastre[:geometry] = cadastre[:geometry].to_json
|
||||||
Cadastre.create(cadastre)
|
Cadastre.create(cadastre)
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace :dev do
|
||||||
|
|
||||||
task :generate_token_file do
|
task :generate_token_file do
|
||||||
puts 'creating token.rb file'
|
puts 'creating token.rb file'
|
||||||
res = `rake secret`.gsub("\n", '')
|
res = `rake secret`.delete("\n")
|
||||||
file = File.new('config/initializers/token.rb', 'w+')
|
file = File.new('config/initializers/token.rb', 'w+')
|
||||||
comment = <<EOF
|
comment = <<EOF
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in a new issue