Enable the Layout/SpaceAfterComma cop

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

View file

@ -200,7 +200,7 @@ Layout/SpaceAfterColon:
Enabled: true Enabled: true
Layout/SpaceAfterComma: Layout/SpaceAfterComma:
Enabled: false Enabled: true
Layout/SpaceAfterMethodName: Layout/SpaceAfterMethodName:
Enabled: true Enabled: true

View file

@ -12,7 +12,7 @@ class Champs::DatetimeChamp < Champ
self.value = self.value =
begin begin
hash_date = YAML.safe_load(value.gsub('=>', ': ')) hash_date = YAML.safe_load(value.gsub('=>', ': '))
year, month, day, hour, minute = hash_date.values_at(1,2,3,4,5) year, month, day, hour, minute = hash_date.values_at(1, 2, 3, 4, 5)
Time.zone.local(year, month, day, hour, minute).strftime("%d/%m/%Y %H:%M") Time.zone.local(year, month, day, hour, minute).strftime("%d/%m/%Y %H:%M")
rescue rescue
nil nil

View file

@ -91,6 +91,6 @@ class Etablissement < ApplicationRecord
def message_for_signature def message_for_signature
JSON.pretty_generate(as_json(include: { JSON.pretty_generate(as_json(include: {
exercices: { only: [:ca, :date_fin_exercice, :date_fin_exercice_timestamp] } exercices: { only: [:ca, :date_fin_exercice, :date_fin_exercice_timestamp] }
}).delete_if { |k,v| v.blank? }) }).delete_if { |k, v| v.blank? })
end end
end end

View file

@ -17,7 +17,7 @@ class RenderPartialService
def self.left_panel_exist?(left_panel_url) def self.left_panel_exist?(left_panel_url)
file = left_panel_url.split('/').last file = left_panel_url.split('/').last
File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', "_#{file}.html.haml")) File.exist?(Rails.root.join('app', 'views', 'layouts', 'left_panels', "_#{file}.html.haml"))
end end
private private

View file

@ -22,7 +22,7 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
end end
def sanitize_name(name) # from https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/sanitized_file.rb#L323 def sanitize_name(name) # from https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/sanitized_file.rb#L323
name = name.gsub(/[^[:word:]\.\-\+]/,"_") name = name.gsub(/[^[:word:]\.\-\+]/, "_")
name = "_#{name}" if name.match?(/\A\.+\z/) name = "_#{name}" if name.match?(/\A\.+\z/)
name = "unnamed" if name.empty? name = "unnamed" if name.empty?
return name.mb_chars.to_s return name.mb_chars.to_s

View file

@ -19,11 +19,11 @@ namespace :'2018_01_18_clean_datetime_in_champs' do
# Match "ddmmYYYY HH:MM" => "YYYY-mm-dd HH:MM" # Match "ddmmYYYY HH:MM" => "YYYY-mm-dd HH:MM"
datetime_champs.select { |c| /^\d{8}\s\d{2}:\d{2}$/ =~ c.value }.each do |c| datetime_champs.select { |c| /^\d{8}\s\d{2}:\d{2}$/ =~ c.value }.each do |c|
day = c.value[0,2] day = c.value[0, 2]
month = c.value[2,2] month = c.value[2, 2]
year = c.value[4,4] year = c.value[4, 4]
hours = c.value[9,2] hours = c.value[9, 2]
minutes = c.value[12,2] minutes = c.value[12, 2]
formated_date = "#{year}-#{month}-#{day} #{hours}:#{minutes}" formated_date = "#{year}-#{month}-#{day} #{hours}:#{minutes}"
rake_puts "cleaning #{c.value} => #{formated_date}" rake_puts "cleaning #{c.value} => #{formated_date}"
c.update_columns(value: formated_date) c.update_columns(value: formated_date)

View file

@ -2,7 +2,7 @@ namespace :admin do
task :create_admin, [:email] => :environment do |t, args| task :create_admin, [:email] => :environment do |t, args|
email = args[:email] email = args[:email]
puts "Creating Administration for #{email}" puts "Creating Administration for #{email}"
a = Administration.new(email: email, password: Devise.friendly_token[0,20]) a = Administration.new(email: email, password: Devise.friendly_token[0, 20])
if a.save if a.save
puts "#{a.email} created" puts "#{a.email} created"
else else

View file

@ -11,7 +11,7 @@ describe ProcedurePresentation do
{ "label" => "test1", "table" => "user", "column" => "email" }, { "label" => "test1", "table" => "user", "column" => "email" },
{ "label" => "test2", "table" => "type_de_champ", "column" => first_type_de_champ_id } { "label" => "test2", "table" => "type_de_champ", "column" => first_type_de_champ_id }
], ],
sort: { "table" => "user","column" => "email","order" => "asc" }, sort: { "table" => "user", "column" => "email", "order" => "asc" },
filters: { "a-suivre" => [], "suivis" => [{ "label" => "label1", "table" => "self", "column" => "created_at" }] } filters: { "a-suivre" => [], "suivis" => [{ "label" => "label1", "table" => "self", "column" => "created_at" }] }
).id ).id
} }
@ -22,7 +22,7 @@ describe ProcedurePresentation do
end end
describe "#sort" do describe "#sort" do
it { expect(procedure_presentation.sort).to eq({ "table" => "user","column" => "email","order" => "asc" }) } it { expect(procedure_presentation.sort).to eq({ "table" => "user", "column" => "email", "order" => "asc" }) }
end end
describe "#filters" do describe "#filters" do
@ -78,10 +78,10 @@ describe ProcedurePresentation do
} }
before do before do
procedure.types_de_champ[2].update_attribute(:type_champ,TypeDeChamp.type_champs.fetch(:header_section)) procedure.types_de_champ[2].update_attribute(:type_champ, TypeDeChamp.type_champs.fetch(:header_section))
procedure.types_de_champ[3].update_attribute(:type_champ,TypeDeChamp.type_champs.fetch(:explication)) procedure.types_de_champ[3].update_attribute(:type_champ, TypeDeChamp.type_champs.fetch(:explication))
procedure.types_de_champ_private[2].update_attribute(:type_champ,TypeDeChamp.type_champs.fetch(:header_section)) procedure.types_de_champ_private[2].update_attribute(:type_champ, TypeDeChamp.type_champs.fetch(:header_section))
procedure.types_de_champ_private[3].update_attribute(:type_champ,TypeDeChamp.type_champs.fetch(:explication)) procedure.types_de_champ_private[3].update_attribute(:type_champ, TypeDeChamp.type_champs.fetch(:explication))
end end
subject { create(:procedure_presentation, assign_to: create(:assign_to, procedure: procedure)) } subject { create(:procedure_presentation, assign_to: create(:assign_to, procedure: procedure)) }