chore: rubocop

chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
This commit is contained in:
Philipp Rothmann 2023-05-12 13:01:12 +02:00 committed by Philipp Rothmann
parent f6fb804bbe
commit fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions

View file

@ -1,11 +1,11 @@
class OrderByArticles < OrderPdf
def filename
I18n.t('documents.order_by_articles.filename', :name => order.name, :date => order.ends.to_date) + '.pdf'
I18n.t('documents.order_by_articles.filename', name: order.name, date: order.ends.to_date) + '.pdf'
end
def title
I18n.t('documents.order_by_articles.title', :name => order.name,
:date => order.ends.strftime(I18n.t('date.formats.default')))
I18n.t('documents.order_by_articles.title', name: order.name,
date: order.ends.strftime(I18n.t('date.formats.default')))
end
def body

View file

@ -1,11 +1,11 @@
class OrderByGroups < OrderPdf
def filename
I18n.t('documents.order_by_groups.filename', :name => order.name, :date => order.ends.to_date) + '.pdf'
I18n.t('documents.order_by_groups.filename', name: order.name, date: order.ends.to_date) + '.pdf'
end
def title
I18n.t('documents.order_by_groups.title', :name => order.name,
:date => order.ends.strftime(I18n.t('date.formats.default')))
I18n.t('documents.order_by_groups.title', name: order.name,
date: order.ends.strftime(I18n.t('date.formats.default')))
end
def body

View file

@ -2,7 +2,7 @@ class OrderFax < OrderPdf
BATCH_SIZE = 250
def filename
I18n.t('documents.order_fax.filename', :name => order.name, :date => order.ends.to_date) + '.pdf'
I18n.t('documents.order_fax.filename', name: order.name, date: order.ends.to_date) + '.pdf'
end
def title
@ -20,16 +20,18 @@ class OrderFax < OrderPdf
move_down 5
text "#{contact[:zip_code]} #{contact[:city]}", size: fontsize(9), align: :right
move_down 5
unless order.supplier.try(:customer_number).blank?
text "#{Supplier.human_attribute_name :customer_number}: #{order.supplier[:customer_number]}", size: fontsize(9), align: :right
if order.supplier.try(:customer_number).present?
text "#{Supplier.human_attribute_name :customer_number}: #{order.supplier[:customer_number]}",
size: fontsize(9), align: :right
move_down 5
end
unless contact[:phone].blank?
if contact[:phone].present?
text "#{Supplier.human_attribute_name :phone}: #{contact[:phone]}", size: fontsize(9), align: :right
move_down 5
end
unless contact[:email].blank?
text "#{Supplier.human_attribute_name :email}: #{contact[:email]}", size: fontsize(9), align: :right
if contact[:email].present?
text "#{Supplier.human_attribute_name :email}: #{contact[:email]}", size: fontsize(9),
align: :right
end
end
@ -38,7 +40,7 @@ class OrderFax < OrderPdf
text order.name
move_down 5
text order.supplier.try(:address).to_s
unless order.supplier.try(:fax).blank?
if order.supplier.try(:fax).present?
move_down 5
text "#{Supplier.human_attribute_name :fax}: #{order.supplier[:fax]}"
end
@ -50,7 +52,7 @@ class OrderFax < OrderPdf
move_down 10
text "#{Delivery.human_attribute_name :date}:"
move_down 10
unless order.supplier.try(:contact_person).blank?
if order.supplier.try(:contact_person).present?
text "#{Supplier.human_attribute_name :contact_person}: #{order.supplier[:contact_person]}"
move_down 10
end
@ -78,8 +80,8 @@ class OrderFax < OrderPdf
table.row(0).border_bottom_width = 2
table.columns(1).align = :right
table.columns(3..6).align = :right
table.row(data.length - 1).columns(0..5).borders = [:top, :bottom]
table.row(data.length - 1).columns(0).borders = [:top, :bottom, :left]
table.row(data.length - 1).columns(0..5).borders = %i[top bottom]
table.row(data.length - 1).columns(0).borders = %i[top bottom left]
table.row(data.length - 1).border_top_width = 2
end
# font_size: fontsize(8),
@ -98,7 +100,7 @@ class OrderFax < OrderPdf
.preload(:article, :article_price)
end
def each_order_article
order_articles.find_each_with_order(batch_size: BATCH_SIZE) { |oa| yield oa }
def each_order_article(&block)
order_articles.find_each_with_order(batch_size: BATCH_SIZE, &block)
end
end

View file

@ -3,12 +3,12 @@ class OrderMatrix < OrderPdf
PLACEHOLDER_CHAR = 'X'
def filename
I18n.t('documents.order_matrix.filename', :name => @order.name, :date => @order.ends.to_date) + '.pdf'
I18n.t('documents.order_matrix.filename', name: @order.name, date: @order.ends.to_date) + '.pdf'
end
def title
I18n.t('documents.order_matrix.title', :name => @order.name,
:date => @order.ends.strftime(I18n.t('date.formats.default')))
I18n.t('documents.order_matrix.title', name: @order.name,
date: @order.ends.strftime(I18n.t('date.formats.default')))
end
def body
@ -87,7 +87,7 @@ class OrderMatrix < OrderPdf
table.cells.border_width = 0.5
table.cells.border_color = '666666'
table.row(0).borders = [:bottom, :left]
table.row(0).borders = %i[bottom left]
table.row(0).padding = [2, 0, 2, 0]
table.row(1..-1).height = row_height_1
table.column(0..1).borders = []
@ -106,7 +106,7 @@ class OrderMatrix < OrderPdf
table.column(2 + idx).border_width = 2
end
table.row_colors = ['dddddd', 'ffffff']
table.row_colors = %w[dddddd ffffff]
end
first_page = false