From 7d70e17cd818958eac09f68c8886b9664aa4ad8c Mon Sep 17 00:00:00 2001 From: Paul Kmiec Date: Mon, 15 May 2023 23:33:15 -0700 Subject: Fix rubocop offenses We still need Style/OptionalBooleanParameter as Ruby 2.7.5 gets confused with, ``` def serialized_attributes(str = +'', additional_attributes = {}, camelize_value: true) ``` --- .rubocop_todo.yml | 8 +------- lib/axlsx/util/serialized_attributes.rb | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2385ecb2..dde13026 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -79,7 +79,6 @@ Lint/UnusedBlockArgument: Lint/UnusedMethodArgument: Exclude: - 'lib/axlsx/package.rb' - - 'lib/axlsx/util/serialized_attributes.rb' - 'lib/axlsx/util/validators.rb' Lint/UselessAssignment: @@ -95,11 +94,6 @@ Lint/Void: - 'lib/axlsx/workbook/worksheet/data_bar.rb' - 'lib/axlsx/workbook/worksheet/pivot_table.rb' -# This cop supports safe autocorrection (--autocorrect). -Performance/BlockGivenWithExplicitBlock: - Exclude: - - 'lib/axlsx/util/serialized_attributes.rb' - # Configuration parameters: MinSize. Performance/CollectionLiteralInLoop: Exclude: @@ -369,7 +363,6 @@ Style/Next: Style/NonNilCheck: Exclude: - 'lib/axlsx/drawing/d_lbls.rb' - - 'lib/axlsx/util/serialized_attributes.rb' - 'lib/axlsx/workbook/worksheet/col.rb' - 'lib/axlsx/workbook/worksheet/page_setup.rb' @@ -398,6 +391,7 @@ Style/OptionalBooleanParameter: Exclude: - 'lib/axlsx.rb' - 'lib/axlsx/package.rb' + - 'lib/axlsx/util/serialized_attributes.rb' - 'lib/axlsx/util/validators.rb' - 'lib/axlsx/workbook/workbook.rb' - 'lib/axlsx/workbook/worksheet/cell.rb' diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index b2b63fe1..27e19904 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -41,7 +41,7 @@ module Axlsx # creates a XML tag with serialized attributes # @see SerializedAttributes#serialized_attributes - def serialized_tag(tagname, str, additional_attributes = {}, &block) + def serialized_tag(tagname, str, additional_attributes = {}) str << '<' << tagname << ' ' serialized_attributes(str, additional_attributes) if block_given? @@ -96,7 +96,7 @@ module Axlsx # @param [String] str The string instance to which serialized data is appended # @param [Array] additional_attributes An array of additional attribute names. # @return [String] The serialized output. - def serialized_element_attributes(str = +'', additional_attributes = [], &block) + def serialized_element_attributes(str = +'', additional_attributes = []) attrs = self.class.xml_element_attributes + additional_attributes values = Axlsx.instance_values_for(self) attrs.each do |attribute_name| -- cgit v1.2.3