Enable the Lint/StringConversionInInterpolation cop

This commit is contained in:
gregoirenovel 2018-12-24 17:43:12 +01:00 committed by Pierre de La Morinerie
parent d473119f9d
commit baf7977786
8 changed files with 12 additions and 12 deletions

View file

@ -444,7 +444,7 @@ Lint/ShadowingOuterLocalVariable:
Enabled: false
Lint/StringConversionInInterpolation:
Enabled: false
Enabled: true
Lint/Syntax:
Enabled: true

View file

@ -211,7 +211,7 @@ class StatsController < ApplicationController
association
.where(date_attribute => min_date..max_date)
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
.group("DATE_TRUNC('month', #{date_attribute})")
.count
.to_a
.sort_by { |a| a[0] }
@ -221,8 +221,8 @@ class StatsController < ApplicationController
def cumulative_hash(association, date_attribute)
sum = 0
association
.where("#{date_attribute.to_s} < ?", max_date)
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
.where("#{date_attribute} < ?", max_date)
.group("DATE_TRUNC('month', #{date_attribute})")
.count
.to_a
.sort_by { |a| a[0] }

View file

@ -31,11 +31,11 @@ class Champs::PieceJustificativeChamp < Champ
if piece_justificative_file.attached? && piece_justificative_file.previous_changes.present?
if piece_justificative_file.blob.byte_size > PIECE_JUSTIFICATIVE_FILE_MAX_SIZE
errors << "Le fichier #{piece_justificative_file.filename.to_s} est trop lourd, il doit faire au plus #{PIECE_JUSTIFICATIVE_FILE_MAX_SIZE.to_s(:human_size, precision: 2)}"
errors << "Le fichier #{piece_justificative_file.filename} est trop lourd, il doit faire au plus #{PIECE_JUSTIFICATIVE_FILE_MAX_SIZE.to_s(:human_size, precision: 2)}"
end
if !piece_justificative_file.blob.content_type.in?(PIECE_JUSTIFICATIVE_FILE_ACCEPTED_FORMATS)
errors << "Le fichier #{piece_justificative_file.filename.to_s} est dans un format que nous n'acceptons pas"
errors << "Le fichier #{piece_justificative_file.filename} est dans un format que nous n'acceptons pas"
end
# FIXME: add Clamav check

View file

@ -31,6 +31,6 @@ class RenderPartialService
end
def retrieve_name
"#{controller.to_s.parameterize.underscore}_#{method.to_s}"
"#{controller.to_s.parameterize.underscore}_#{method}"
end
end

View file

@ -46,7 +46,7 @@ namespace :'2018_09_12_fix_templates' do
.each do |instance|
instance.update(body: instance.body.gsub("--libellé procédure--", "--libellé démarche--"))
rake_puts "Body mis-à-jour pour #{klass.to_s}##{instance.id}"
rake_puts "Body mis-à-jour pour #{klass}##{instance.id}"
end
end
end

View file

@ -47,7 +47,7 @@ namespace :after_party do
def remove_footer(template)
matches = template.body.match(FOOTER_REGEXP)
if matches && FOOTER_EXCEPTIONS.none? { |exception| matches[0].include?(exception) }
rake_puts "#{template.model_name.to_s} \##{template.id}: removing footer"
rake_puts "#{template.model_name} \##{template.id}: removing footer"
template.update(body: matches.pre_match)
end
end

View file

@ -17,7 +17,7 @@ namespace :after_party do
.each do |instance|
instance.update(subject: instance.subject.gsub("--libellé procédure--", "--libellé démarche--"))
rake_puts "Subject mis-à-jour pour #{klass.to_s}##{instance.id}"
rake_puts "Subject mis-à-jour pour #{klass}##{instance.id}"
end
end

View file

@ -8,12 +8,12 @@ describe RenderPartialService do
describe 'navbar' do
subject { service.navbar }
it { is_expected.to eq "layouts/navbars/navbar_#{controller.to_s.parameterize}_#{method.to_s}" }
it { is_expected.to eq "layouts/navbars/navbar_#{controller.to_s.parameterize}_#{method}" }
end
describe 'left_panel' do
subject { service.left_panel }
it { is_expected.to eq "layouts/left_panels/left_panel_#{controller.to_s.parameterize}_#{method.to_s}" }
it { is_expected.to eq "layouts/left_panels/left_panel_#{controller.to_s.parameterize}_#{method}" }
end
end