From e77648b22708dd5ebb02fa8f4ff347168b1501e5 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 31 Mar 2023 01:23:21 +0200 Subject: Add a default editor config EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. Ref: https://editorconfig.org/ --- .editorconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..f29d257c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true -- cgit v1.2.3 From ea2785941ab1087a0efe42b55ec23130bbdaf434 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:13:49 +0200 Subject: Add RuboCop --- Gemfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 4aa4c3d7..432b4503 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,10 @@ source 'https://rubygems.org' gemspec +group :development, :test do + gem 'rubocop' +end + group :test do gem 'rake' gem 'simplecov', '>= 0.14.1' @@ -9,4 +13,4 @@ end group :profile do gem 'ruby-prof', :platforms => :ruby -end \ No newline at end of file +end -- cgit v1.2.3 From e9496a58dbf17d4b9bb615f3cb630f1e32574ece Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:16:53 +0200 Subject: Fix Layout/EndOfLine offenses ``` rubocop --only Layout/EndOfLine ``` Manually fixed --- lib/axlsx/workbook/worksheet/sheet_format_pr.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index fc9ce3a3..12c2e3b2 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -1,17 +1,17 @@ module Axlsx - #Sheet formatting properties - # - # - # - # - # - # - # - # - # - # - # + # Sheet formatting properties + # + # + # + # + # + # + # + # + # + # + # class SheetFormatPr include Axlsx::SerializedAttributes -- cgit v1.2.3 From 7e90a46d43fefcf5ff7c76c14b29b6998245cfc5 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:17:07 +0200 Subject: Remove Layout/TrailingWhitespace offenses ``` rubocop --only Layout/TrailingWhitespace -a ``` --- lib/axlsx/doc_props/core.rb | 2 +- lib/axlsx/drawing/axes.rb | 8 +- lib/axlsx/drawing/axis.rb | 4 +- lib/axlsx/drawing/d_lbls.rb | 32 +++--- lib/axlsx/drawing/view_3D.rb | 2 +- lib/axlsx/package.rb | 4 +- lib/axlsx/rels/relationship.rb | 36 +++---- lib/axlsx/stylesheet/cell_alignment.rb | 8 +- lib/axlsx/stylesheet/styles.rb | 18 ++-- lib/axlsx/util/accessors.rb | 2 +- lib/axlsx/util/serialized_attributes.rb | 4 +- lib/axlsx/util/simple_typed_list.rb | 16 +-- lib/axlsx/util/storage.rb | 52 +++++----- .../worksheet/auto_filter/filter_column.rb | 2 +- .../workbook/worksheet/auto_filter/filters.rb | 8 +- lib/axlsx/workbook/worksheet/border_creator.rb | 8 +- lib/axlsx/workbook/worksheet/cell.rb | 2 +- lib/axlsx/workbook/worksheet/col_breaks.rb | 4 +- lib/axlsx/workbook/worksheet/color_scale.rb | 2 +- lib/axlsx/workbook/worksheet/comment.rb | 2 +- .../workbook/worksheet/conditional_formatting.rb | 2 +- lib/axlsx/workbook/worksheet/dimension.rb | 4 +- lib/axlsx/workbook/worksheet/pane.rb | 24 ++--- lib/axlsx/workbook/worksheet/protected_range.rb | 2 +- lib/axlsx/workbook/worksheet/row.rb | 8 +- lib/axlsx/workbook/worksheet/row_breaks.rb | 2 +- lib/axlsx/workbook/worksheet/selection.rb | 12 +-- lib/axlsx/workbook/worksheet/sheet_data.rb | 8 +- lib/axlsx/workbook/worksheet/sheet_format_pr.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_pr.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_protection.rb | 6 +- lib/axlsx/workbook/worksheet/sheet_view.rb | 60 +++++------ lib/axlsx/workbook/worksheet/table.rb | 2 +- lib/axlsx/workbook/worksheet/table_style_info.rb | 2 +- lib/axlsx/workbook/worksheet/worksheet_comments.rb | 2 +- test/doc_props/tc_app.rb | 2 +- test/drawing/tc_axis.rb | 6 +- test/drawing/tc_d_lbls.rb | 18 ++-- test/drawing/tc_num_data.rb | 6 +- test/rels/tc_relationship.rb | 10 +- test/rels/tc_relationships.rb | 4 +- test/stylesheet/tc_dxf.rb | 10 +- test/stylesheet/tc_pattern_fill.rb | 4 +- test/stylesheet/tc_styles.rb | 6 +- test/stylesheet/tc_table_style_element.rb | 2 +- test/tc_axlsx.rb | 4 +- test/util/tc_simple_typed_list.rb | 2 +- .../worksheet/auto_filter/tc_filter_column.rb | 14 +-- test/workbook/worksheet/auto_filter/tc_filters.rb | 10 +- test/workbook/worksheet/tc_comments.rb | 2 +- test/workbook/worksheet/tc_data_validation.rb | 110 ++++++++++----------- test/workbook/worksheet/tc_outline_pr.rb | 2 +- test/workbook/worksheet/tc_pane.rb | 10 +- test/workbook/worksheet/tc_pivot_table.rb | 4 +- test/workbook/worksheet/tc_rich_text.rb | 4 +- test/workbook/worksheet/tc_row.rb | 4 +- test/workbook/worksheet/tc_sheet_protection.rb | 8 +- test/workbook/worksheet/tc_table_style_info.rb | 2 +- test/workbook/worksheet/tc_worksheet.rb | 14 +-- test/workbook/worksheet/tc_worksheet_hyperlink.rb | 2 +- 60 files changed, 307 insertions(+), 307 deletions(-) diff --git a/lib/axlsx/doc_props/core.rb b/lib/axlsx/doc_props/core.rb index bb2da676..e0025f12 100644 --- a/lib/axlsx/doc_props/core.rb +++ b/lib/axlsx/doc_props/core.rb @@ -5,7 +5,7 @@ module Axlsx # @note Packages manage their own core object. # @see Package#core class Core - + # Creates a new Core object. # @option options [String] creator # @option options [Time] created diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb index dff87a9b..6e66dcc0 100644 --- a/lib/axlsx/drawing/axes.rb +++ b/lib/axlsx/drawing/axes.rb @@ -1,5 +1,5 @@ module Axlsx - + # The Axes class creates and manages axis information and # serialization for charts. class Axes @@ -16,7 +16,7 @@ module Axlsx end # [] provides assiciative access to a specic axis store in an axes - # instance. + # instance. # @return [Axis] def [](name) axes.assoc(name)[1] @@ -27,12 +27,12 @@ module Axlsx # @param [Hash] options # @option options ids # If the ids option is specified only the axis identifier is - # serialized. Otherwise, each axis is serialized in full. + # serialized. Otherwise, each axis is serialized in full. def to_xml_string(str = '', options = {}) if options[:ids] # CatAxis must come first in the XML (for Microsoft Excel at least) sorted = axes.sort_by { |name, axis| axis.kind_of?(CatAxis) ? 0 : 1 } - sorted.each { |axis| str << ('') } + sorted.each { |axis| str << ('') } else axes.each { |axis| axis[1].to_xml_string(str) } end diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index b2bb8fe7..e4bcf9a4 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -83,14 +83,14 @@ module Axlsx # the title for the axis. This can be a cell or a fixed string. attr_reader :title - # The color for this axis. This value is used when rendering the axis line in the chart. + # The color for this axis. This value is used when rendering the axis line in the chart. # colors should be in 6 character rbg format # @return [String] the rbg color assinged. # @see color def color=(color_rgb) @color = color_rgb end - + # The crossing axis for this axis # @param [Axis] axis def cross_axis=(axis) diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index 0fb3c6ad..0c8185f0 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -7,7 +7,7 @@ module Axlsx class DLbls include Axlsx::Accessors - include Axlsx::OptionsParser + include Axlsx::OptionsParser # creates a new DLbls object def initialize(chart_type, options={}) raise ArgumentError, 'chart_type must inherit from Chart' unless [Chart, LineChart].include?(chart_type.superclass) @@ -18,31 +18,31 @@ module Axlsx # These attributes are all boolean so I'm doing a bit of a hand # waving magic show to set up the attriubte accessors - # @note - # not all charts support all methods! + # @note + # not all charts support all methods! # Bar3DChart and Line3DChart and ScatterChart do not support d_lbl_pos or show_leader_lines - # - boolean_attr_accessor :show_legend_key, - :show_val, - :show_cat_name, - :show_ser_name, - :show_percent, - :show_bubble_size, + # + boolean_attr_accessor :show_legend_key, + :show_val, + :show_cat_name, + :show_ser_name, + :show_percent, + :show_bubble_size, :show_leader_lines # Initialize all the values to false as Excel requires them to # explicitly be disabled or all will show. def initialize_defaults - [:show_legend_key, :show_val, :show_cat_name, - :show_ser_name, :show_percent, :show_bubble_size, + [:show_legend_key, :show_val, :show_cat_name, + :show_ser_name, :show_percent, :show_bubble_size, :show_leader_lines].each do |attr| self.send("#{attr}=", false) end end - # The chart type that is using this data lables instance. + # The chart type that is using this data lables instance. # This affects the xml output as not all chart types support the - # same data label attributes. + # same data label attributes. attr_reader :chart_type # The position of the data labels in the chart @@ -65,7 +65,7 @@ module Axlsx @d_lbl_pos = label_position end - + # serializes the data labels # @return [String] def to_xml_string(str = '') @@ -74,7 +74,7 @@ module Axlsx instance_vals = Axlsx.instance_values_for(self) %w(d_lbl_pos show_legend_key show_val show_cat_name show_ser_name show_percent show_bubble_size show_leader_lines).each do |key| next unless instance_vals.keys.include?(key) && instance_vals[key] != nil - str << "" + str << "" end str << '' end diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 2223d501..cfb44166 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -71,7 +71,7 @@ module Axlsx alias :hPercent= :h_percent= # @see rot_y - def rot_y=(v) + def rot_y=(v) RangeValidator.validate "View3D.rot_y", 0, 360, v @rot_y = v end diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 6baaa173..613c92de 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -102,7 +102,7 @@ module Axlsx # File.open('example_streamed.xlsx', 'wb') { |f| f.write(s.read) } def serialize(output, options = {}, secondary_options = nil) if !workbook.styles_applied - workbook.apply_styles + workbook.apply_styles end confirm_valid, zip_command = parse_serialize_options(options, secondary_options) @@ -127,7 +127,7 @@ module Axlsx # @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not. def to_stream(confirm_valid=false) if !workbook.styles_applied - workbook.apply_styles + workbook.apply_styles end return false unless !confirm_valid || self.validate.empty? diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index 157f316e..dc7c5307 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -3,7 +3,7 @@ module Axlsx # A relationship defines a reference between package parts. # @note Packages automatically manage relationships. class Relationship - + class << self # Keeps track of relationship ids in use. # @return [Array] @@ -12,27 +12,27 @@ module Axlsx end # Initialize cached ids. - # + # # This should be called before serializing a package (see {Package#serialize} and - # {Package#to_stream}) to make sure that serialization is idempotent (i.e. + # {Package#to_stream}) to make sure that serialization is idempotent (i.e. # Relationship instances are generated with the same IDs everytime the package # is serialized). def initialize_ids_cache Thread.current[:axlsx_relationship_ids_cache] = {} end - + # Clear cached ids. - # + # # This should be called after serializing a package (see {Package#serialize} and # {Package#to_stream}) to free the memory allocated for cache. - # - # Also, calling this avoids memory leaks (cached ids lingering around - # forever). + # + # Also, calling this avoids memory leaks (cached ids lingering around + # forever). def clear_ids_cache Thread.current[:axlsx_relationship_ids_cache] = nil end - - # Generate and return a unique id (eg. `rId123`) Used for setting {#Id}. + + # Generate and return a unique id (eg. `rId123`) Used for setting {#Id}. # # The generated id depends on the number of previously cached ids, so using # {clear_ids_cache} will automatically reset the generated ids, too. @@ -42,12 +42,12 @@ module Axlsx end end - # The id of the relationship (eg. "rId123"). Most instances get their own unique id. + # The id of the relationship (eg. "rId123"). Most instances get their own unique id. # However, some instances need to share the same id – see {#should_use_same_id_as?} # for details. # @return [String] attr_reader :Id - + # The location of the relationship target # @return [String] attr_reader :Target @@ -77,8 +77,8 @@ module Axlsx # The source object the relations belongs to (e.g. a hyperlink, drawing, ...). Needed when # looking up the relationship for a specific object (see {Relationships#for}). attr_reader :source_obj - - # Initializes a new relationship. + + # Initializes a new relationship. # @param [Object] source_obj see {#source_obj} # @param [String] type The type of the relationship # @param [String] target The target for the relationship @@ -108,12 +108,12 @@ module Axlsx str << (h.map { |key, value| '' << key.to_s << '="' << Axlsx::coder.encode(value.to_s) << '"'}.join(' ')) str << '/>' end - + # A key that determines whether this relationship should use already generated id. # # Instances designating the same relationship need to use the same id. We can not simply - # compare the {#Target} attribute, though: `foo/bar.xml`, `../foo/bar.xml`, - # `../../foo/bar.xml` etc. are all different but probably mean the same file (this + # compare the {#Target} attribute, though: `foo/bar.xml`, `../foo/bar.xml`, + # `../../foo/bar.xml` etc. are all different but probably mean the same file (this # is especially an issue for relationships in the context of pivot tables). So lets # just ignore this attribute for now (except when {#TargetMode} is set to `:External` – # then {#Target} will be an absolute URL and thus can safely be compared). @@ -125,6 +125,6 @@ module Axlsx key << self.Target if self.TargetMode == :External key end - + end end diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb index 715a0b3e..f1675141 100644 --- a/lib/axlsx/stylesheet/cell_alignment.rb +++ b/lib/axlsx/stylesheet/cell_alignment.rb @@ -1,16 +1,16 @@ # encoding: UTF-8 module Axlsx - - + + # CellAlignment stores information about the cell alignment of a style Xf Object. # @note Using Styles#add_style is the recommended way to manage cell alignment. # @see Styles#add_style class CellAlignment - + include Axlsx::SerializedAttributes include Axlsx::OptionsParser - + serializable_attributes :horizontal, :vertical, :text_rotation, :wrap_text, :indent, :relative_indent, :justify_last_line, :shrink_to_fit, :reading_order # Create a new cell_alignment object # @option options [Symbol] horizontal diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index f6305fa9..188f0960 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -137,7 +137,7 @@ module Axlsx # @option options [Integer] family The font family to use. # @option options [String] font_name The name of the font to use # @option options [Integer] num_fmt The number format to apply - # @option options [String] format_code The formatting to apply. + # @option options [String] format_code The formatting to apply. # @option options [Integer|Hash] border The border style to use. # borders support style, color and edges options @see parse_border_options # @option options [String] bg_color The background color to apply to the cell @@ -241,8 +241,8 @@ module Axlsx if options[:type] == :xf # Check to see if style in cache already - - font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family} + + font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family} raw_style = {type: :xf}.merge(font_defaults).merge(options) @@ -349,12 +349,12 @@ module Axlsx # parses Style#add_style options for borders. # @note noop if :border is not specified in options - # @option options [Hash|Integer] A border style definition hash or the index of an existing border. - # Border style definition hashes must include :style and :color key-value entries and - # may include an :edges entry that references an array of symbols identifying which border edges + # @option options [Hash|Integer] A border style definition hash or the index of an existing border. + # Border style definition hashes must include :style and :color key-value entries and + # may include an :edges entry that references an array of symbols identifying which border edges # you wish to apply the style or any other valid Border initializer options. # If the :edges entity is not provided the style is applied to all edges of cells that reference this style. - # Also available :border_top, :border_right, :border_bottom and :border_left options with :style and/or :color + # Also available :border_top, :border_right, :border_bottom and :border_left options with :style and/or :color # key-value entries, which override :border values. # @example # #apply a thick red border to the top and bottom @@ -444,8 +444,8 @@ module Axlsx end border.prs << BorderPr.new({ - :name => edge, - :style => edge_b_opts[:style], + :name => edge, + :style => edge_b_opts[:style], :color => Color.new(:rgb => edge_b_opts[:color]) }, ) end diff --git a/lib/axlsx/util/accessors.rb b/lib/axlsx/util/accessors.rb index a678b041..5062b0d4 100644 --- a/lib/axlsx/util/accessors.rb +++ b/lib/axlsx/util/accessors.rb @@ -51,7 +51,7 @@ module Axlsx # @param [Array] symbols The names of the attributes to create # @param [String] validator The axlsx validation method to use when # validating assignation. - # @see lib/axlsx/util/validators.rb + # @see lib/axlsx/util/validators.rb def validated_attr_accessor(symbols, validator) symbols.each do |symbol| attr_reader symbol diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index 06d1697a..75712de1 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -11,7 +11,7 @@ module Axlsx # class methods applied to all includers module ClassMethods - # This is the method to be used in inheriting classes to specify + # This is the method to be used in inheriting classes to specify # which of the instance values are serializable def serializable_attributes(*symbols) @xml_attributes = symbols @@ -43,7 +43,7 @@ module Axlsx end end - # serializes the instance values of the defining object based on the + # serializes the instance values of the defining object based on the # list of serializable attributes. # @param [String] str The string instance to append this # serialization to. diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 77bed775..5f5dbffa 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -55,7 +55,7 @@ module Axlsx end result end - + # Lock this list at the current size # @return [self] def lock @@ -69,7 +69,7 @@ module Axlsx @locked_at = nil self end - + def to_ary @list end @@ -82,9 +82,9 @@ module Axlsx # one of the allowed types # @return [SimpleTypedList] def +(v) - v.each do |item| + v.each do |item| DataTypeValidator.validate :SimpleTypedList_plus, @allowed_types, item - @list << item + @list << item end end @@ -96,10 +96,10 @@ module Axlsx DataTypeValidator.validate :SimpleTypedList_push, @allowed_types, v @list << v @list.size - 1 - end - + end + alias :push :<< - + # delete the item from the list # @param [Any] v The item to be deleted. @@ -164,7 +164,7 @@ module Axlsx end } end - + def to_xml_string(str = '') classname = @allowed_types[0].name.split('::').last el_name = serialize_as.to_s || (classname[0,1].downcase + classname[1..-1]) diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb index 6c16bdcf..b3815dbb 100644 --- a/lib/axlsx/util/storage.rb +++ b/lib/axlsx/util/storage.rb @@ -16,46 +16,46 @@ module Axlsx }.freeze # Creates a byte string for this storage - # @return [String] + # @return [String] def to_s - data = [@name.concat(Array.new(32-@name.size, 0)), - @name_size, - @type, - @color, - @left, - @right, - @child, + data = [@name.concat(Array.new(32-@name.size, 0)), + @name_size, + @type, + @color, + @left, + @right, + @child, @created, - @modified, - @sector, + @modified, + @sector, @size].flatten data.pack(PACKING) end # storage colors COLORS = { - :red=>0, + :red=>0, :black=>1 } # The color of this node in the directory tree. Defaults to black if not specified # @return [Integer] color attr_reader :color - + # Sets the color for this storage # @param [Integer] v Must be one of the COLORS constant hash values def color=(v) - RestrictionValidator.validate :storage_color, COLORS.values, v + RestrictionValidator.validate :storage_color, COLORS.values, v @color = v end # The size of the name for this node. - # interesting to see that office actually uses 'R' for the root directory and lists the size as 2 bytes - thus is it *NOT* null + # interesting to see that office actually uses 'R' for the root directory and lists the size as 2 bytes - thus is it *NOT* null # terminated. I am making this r/w so that I can override the size # @return [Integer] color attr_reader :name_size - # the name of the stream + # the name of the stream attr_reader :name # sets the name of the stream. @@ -87,16 +87,16 @@ module Axlsx # @return [Integer] sector attr_accessor :sector - # The 0 based index in the directoies chain for this the left sibling of this storage. - + # The 0 based index in the directoies chain for this the left sibling of this storage. + # @return [Integer] left - attr_accessor :left + attr_accessor :left - # The 0 based index in the directoies chain for this the right sibling of this storage. + # The 0 based index in the directoies chain for this the right sibling of this storage. # @return [Integer] right - attr_accessor :right + attr_accessor :right - # The 0 based index in the directoies chain for the child of this storage. + # The 0 based index in the directoies chain for the child of this storage. # @return [Integer] child attr_accessor :child @@ -113,14 +113,14 @@ module Axlsx # @return [Integer] type attr_reader :type - # Sets the type for this storage. - # @param [Integer] v the type to specify must be one of the TYPES constant hash values. + # Sets the type for this storage. + # @param [Integer] v the type to specify must be one of the TYPES constant hash values. def type=(v) - RestrictionValidator.validate :storage_type, TYPES.values, v + RestrictionValidator.validate :storage_type, TYPES.values, v @type = v end - # Creates a new storage object. + # Creates a new storage object. # @param [String] name the name of the storage # @option options [Integer] color (black) # @option options [Integer] type (storage) @@ -141,6 +141,6 @@ module Axlsx @type ||= (data.nil? ? TYPES[:storage] : TYPES[:stream]) self.name = name end - + end end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb index 71f08a2f..61957df0 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb @@ -52,7 +52,7 @@ module Axlsx end # Sets the col_id attribute for this filter column. - # @param [Integer | Cell] column_index The zero based index of the column to which this filter applies. + # @param [Integer | Cell] column_index The zero based index of the column to which this filter applies. # When you specify a cell, the column index will be read off the cell # @return [Integer] def col_id=(column_index) diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index faa22374..215b66fe 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -1,6 +1,6 @@ module Axlsx - # When multiple values are chosen to filter by, or when a group of date values are chosen to filter by, + # When multiple values are chosen to filter by, or when a group of date values are chosen to filter by, # this object groups those criteria together. class Filters include Axlsx::OptionsParser @@ -29,7 +29,7 @@ module Axlsx # @return [Boolean] attr_reader :blank - # Calendar type for date grouped items. + # Calendar type for date grouped items. # Used to interpret the values in dateGroupItem. # This is the calendar type used to evaluate all dates in the filter column, # even when those dates are not using the same calendar system / date formatting. @@ -81,7 +81,7 @@ module Axlsx str << '' end - # not entirely happy with this. + # not entirely happy with this. # filter_items should be a simple typed list that overrides << etc # to create Filter objects from the inserted values. However this # is most likely so rarely used...(really? do you know that?) @@ -200,7 +200,7 @@ include Axlsx::SerializedAttributes end # The day value for the date group item - # This must be between 1 and 31 + # This must be between 1 and 31 # @note no attempt is made to ensure the date value is valid for any given month def day=(value) RangeValidator.validate "DateGroupItem.day", 0, 31, value diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb index bbd30473..2830eaff 100644 --- a/lib/axlsx/workbook/worksheet/border_creator.rb +++ b/lib/axlsx/workbook/worksheet/border_creator.rb @@ -13,7 +13,7 @@ module Axlsx if @edges == :all @edges = Axlsx::Border::EDGES elsif !@edges.is_a?(Array) - raise ArgumentError.new("Invalid edges provided, #{@edges}") + raise ArgumentError.new("Invalid edges provided, #{@edges}") else @edges = @edges.map{|x| x&.to_sym}.uniq @@ -26,15 +26,15 @@ module Axlsx def draw if @cells.size == 1 @worksheet.add_style( - first_cell, + first_cell, { border: {style: @style, color: @color, edges: @edges} } ) else - @edges.each do |edge| + @edges.each do |edge| @worksheet.add_style( - border_cells[edge], + border_cells[edge], { border: {style: @style, color: @color, edges: [edge]} } diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 125ca051..301ce22f 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -104,7 +104,7 @@ module Axlsx self.raw_style = new_style wb = row.worksheet.workbook - + wb.styled_cells << self end diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb index 2f1ec1b0..c803fc70 100644 --- a/lib/axlsx/workbook/worksheet/col_breaks.rb +++ b/lib/axlsx/workbook/worksheet/col_breaks.rb @@ -1,7 +1,7 @@ module Axlsx # A collection of Brake objects. - # Please do not use this class directly. Instead use + # Please do not use this class directly. Instead use # Worksheet#add_break class ColBreaks < SimpleTypedList @@ -12,7 +12,7 @@ module Axlsx # A column break specific helper for adding a break. # @param [Hash] options A list of options to pass into the Break object - # The max and man options are fixed, however any other valid option for + # The max and man options are fixed, however any other valid option for # Break will be passed to the created break object. # @see Break def add_break(options) diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb index 287e6869..127b3e96 100644 --- a/lib/axlsx/workbook/worksheet/color_scale.rb +++ b/lib/axlsx/workbook/worksheet/color_scale.rb @@ -28,7 +28,7 @@ module Axlsx # A builder for three tone color gradient # @example # #this creates a three tone color scale - # color_scale = Axlsx::ColorScale.three_tone + # color_scale = Axlsx::ColorScale.three_tone # @see examples/example.rb conditional formatting examples. def three_tone self.new({:type => :min, :val => 0, :color => 'FFF8696B'}, diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index e5dbe41c..5230c940 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -82,7 +82,7 @@ module Axlsx pos = Axlsx::name_to_indices(ref) @vml_shape = VmlShape.new(:row => pos[1], :column => pos[0], :visible => @visible) do |vml| vml.left_column = vml.column - vml.right_column = vml.column + 2 + vml.right_column = vml.column + 2 vml.top_row = vml.row vml.bottom_row = vml.row + 4 end diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb index 7b1783bd..0ed065e6 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb @@ -7,7 +7,7 @@ module Axlsx class ConditionalFormatting include Axlsx::OptionsParser - + # Creates a new {ConditionalFormatting} object # @option options [Array] rules The rules to apply # @option options [String] sqref The range to apply the rules to diff --git a/lib/axlsx/workbook/worksheet/dimension.rb b/lib/axlsx/workbook/worksheet/dimension.rb index a7f9b792..48b3a1c2 100644 --- a/lib/axlsx/workbook/worksheet/dimension.rb +++ b/lib/axlsx/workbook/worksheet/dimension.rb @@ -1,7 +1,7 @@ module Axlsx # This class manages the dimensions for a worksheet. - # While this node is optional in the specification some readers like + # While this node is optional in the specification some readers like # LibraOffice require this node to render the sheet class Dimension @@ -31,7 +31,7 @@ module Axlsx # @return [String] def sqref "#{first_cell_reference}:#{last_cell_reference}" - end + end # serialize the object # @return [String] diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb index 2bc77495..321294da 100644 --- a/lib/axlsx/workbook/worksheet/pane.rb +++ b/lib/axlsx/workbook/worksheet/pane.rb @@ -24,16 +24,16 @@ module Axlsx # Active Pane # The pane that is active. - # Options are + # Options are # * bottom_left: Bottom left pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a horizontal split has been applied, dividing the pane - # into upper and lower regions. In that case, this value + # a horizontal split has been applied, dividing the pane + # into upper and lower regions. In that case, this value # specifies the bottom pane. # * bottom_right: Bottom right pane, when both vertical and horizontal # splits are applied. # * top_left: Top left pane, when both vertical and horizontal splits - # are applied. This value is also used when only a horizontal + # are applied. This value is also used when only a horizontal # split has been applied, dividing the pane into upper and lower # regions. In that case, this value specifies the top pane. # This value is also used when only a vertical split has @@ -41,8 +41,8 @@ module Axlsx # regions. In that case, this value specifies the left pane # * top_right: Top right pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a vertical split has been applied, dividing the pane - # into right and left regions. In that case, this value + # a vertical split has been applied, dividing the pane + # into right and left regions. In that case, this value # specifies the right pane. # @see type # @return [Symbol] @@ -51,12 +51,12 @@ module Axlsx # Split State - # Indicates whether the pane has horizontal / vertical + # Indicates whether the pane has horizontal / vertical # splits, and whether those splits are frozen. - # Options are + # Options are # * frozen: Panes are frozen, but were not split being frozen. In # this state, when the panes are unfrozen again, a single - # pane results, with no split. In this state, the split + # pane results, with no split. In this state, the split # bars are not adjustable. # * frozen_split: Panes are frozen and were split before being frozen. In # this state, when the panes are unfrozen again, the split @@ -69,7 +69,7 @@ module Axlsx attr_reader :state # Top Left Visible Cell - # Location of the top left visible cell in the bottom + # Location of the top left visible cell in the bottom # right pane (when in Left-To-Right mode). # @see type # @return [String] @@ -78,7 +78,7 @@ module Axlsx # Horizontal Split Position # Horizontal position of the split, in 1/20th of a point; 0 (zero) - # if none. If the pane is frozen, this value indicates the number + # if none. If the pane is frozen, this value indicates the number # of columns visible in the top pane. # @see type # @return [Integer] @@ -86,7 +86,7 @@ module Axlsx attr_reader :x_split # Vertical Split Position - # Vertical position of the split, in 1/20th of a point; 0 (zero) + # Vertical position of the split, in 1/20th of a point; 0 (zero) # if none. If the pane is frozen, this value indicates the number # of rows visible in the left pane. # @see type diff --git a/lib/axlsx/workbook/worksheet/protected_range.rb b/lib/axlsx/workbook/worksheet/protected_range.rb index e990f1cb..492b2254 100644 --- a/lib/axlsx/workbook/worksheet/protected_range.rb +++ b/lib/axlsx/workbook/worksheet/protected_range.rb @@ -42,6 +42,6 @@ module Axlsx # objects created during serialization def to_xml_string(str="") serialized_tag 'protectedRange', str - end + end end end diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index 63a8d328..62ceb59c 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -6,7 +6,7 @@ module Axlsx class Row < SimpleTypedList include SerializedAttributes include Accessors - + # No support is provided for the following attributes # spans # thickTop @@ -64,7 +64,7 @@ module Axlsx # @see Row#s def s=(v) Axlsx.validate_unsigned_numeric(v) - @custom_format = true + @custom_format = true @s = v end @@ -73,7 +73,7 @@ module Axlsx Axlsx.validate_unsigned_numeric(v) @outline_level = v end - + alias :outlineLevel= :outline_level= # The index of this row in the worksheet @@ -126,7 +126,7 @@ module Axlsx @ht = v end end - + # return cells def cells self diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb index c6ec89a9..0e6e8646 100644 --- a/lib/axlsx/workbook/worksheet/row_breaks.rb +++ b/lib/axlsx/workbook/worksheet/row_breaks.rb @@ -17,7 +17,7 @@ module Axlsx self << Break.new(options.merge(:max => 16383, :man => true)) last end - + # # # diff --git a/lib/axlsx/workbook/worksheet/selection.rb b/lib/axlsx/workbook/worksheet/selection.rb index fcb06c13..753b3a35 100644 --- a/lib/axlsx/workbook/worksheet/selection.rb +++ b/lib/axlsx/workbook/worksheet/selection.rb @@ -40,16 +40,16 @@ module Axlsx # Pane # The pane to which this selection belongs. - # Options are + # Options are # * bottom_left: Bottom left pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a horizontal split has been applied, dividing the pane - # into upper and lower regions. In that case, this value + # a horizontal split has been applied, dividing the pane + # into upper and lower regions. In that case, this value # specifies the bottom pane. # * bottom_right: Bottom right pane, when both vertical and horizontal # splits are applied. # * top_left: Top left pane, when both vertical and horizontal splits - # are applied. This value is also used when only a horizontal + # are applied. This value is also used when only a horizontal # split has been applied, dividing the pane into upper and lower # regions. In that case, this value specifies the top pane. # This value is also used when only a vertical split has @@ -57,8 +57,8 @@ module Axlsx # regions. In that case, this value specifies the left pane # * top_right: Top right pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a vertical split has been applied, dividing the pane - # into right and left regions. In that case, this value + # a vertical split has been applied, dividing the pane + # into right and left regions. In that case, this value # specifies the right pane. # @see type # @return [Symbol] diff --git a/lib/axlsx/workbook/worksheet/sheet_data.rb b/lib/axlsx/workbook/worksheet/sheet_data.rb index a7b8735b..0b697fbb 100644 --- a/lib/axlsx/workbook/worksheet/sheet_data.rb +++ b/lib/axlsx/workbook/worksheet/sheet_data.rb @@ -9,7 +9,7 @@ module Axlsx raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @worksheet = worksheet end - + attr_reader :worksheet # Serialize the sheet data @@ -17,11 +17,11 @@ module Axlsx # @return [String] def to_xml_string(str = '') str << '' - worksheet.rows.each_with_index do |row, index| - row.to_xml_string(index, str) + worksheet.rows.each_with_index do |row, index| + row.to_xml_string(index, str) end str << '' end - + end end diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index 12c2e3b2..f7cff58c 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -42,7 +42,7 @@ module Axlsx boolean_attr_accessor :custom_height, :zero_height, :thick_top, :thick_bottom - unsigned_int_attr_accessor :base_col_width, :outline_level_row, :outline_level_col + unsigned_int_attr_accessor :base_col_width, :outline_level_row, :outline_level_col # serializes this object to an xml string # @param [String] str The string this objects serialization will be appended to diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb index fd6dad2b..e369cb52 100644 --- a/lib/axlsx/workbook/worksheet/sheet_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb @@ -62,7 +62,7 @@ module Axlsx def page_setup_pr @page_setup_pr ||= PageSetUpPr.new end - + # The OutlinePr for this sheet pr object # @return [OutlinePr] def outline_pr diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index c6142be5..b7aa56b6 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -50,9 +50,9 @@ module Axlsx # default nil attr_reader :password - # This block is intended to implement the salt_value, hash_value and spin count as per the ECMA-376 standard. - # However, it does not seem to actually work in EXCEL - instead they are using their old retro algorithm shown below - # defined in the transitional portion of the speck. I am leaving this code in in the hope that someday Ill be able to + # This block is intended to implement the salt_value, hash_value and spin count as per the ECMA-376 standard. + # However, it does not seem to actually work in EXCEL - instead they are using their old retro algorithm shown below + # defined in the transitional portion of the speck. I am leaving this code in in the hope that someday Ill be able to # figure out why it does not work, and if Excel even supports it. # def propper_password=(v) # @algorithm_name = v == nil ? nil : 'SHA-1' diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index 434f7b7a..f7b0f7bf 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -5,7 +5,7 @@ module Axlsx # @note The recommended way to manage the sheet view is via Worksheet#sheet_view # @see Worksheet#sheet_view class SheetView - + include Axlsx::OptionsParser include Axlsx::Accessors include Axlsx::SerializedAttributes @@ -66,11 +66,11 @@ module Axlsx # @return [Hash] attr_reader :selections - # + # # Color Id # Index to the color value for row/column - # text headings and gridlines. This is an - # 'index color value' (ICV) rather than + # text headings and gridlines. This is an + # 'index color value' (ICV) rather than # rgb value. # @see type # @return [Integer] @@ -78,18 +78,18 @@ module Axlsx attr_reader :color_id # Top Left Visible Cell - # Location of the top left visible cell Location + # Location of the top left visible cell Location # of the top left visible cell in the bottom right # pane (when in Left-to-Right mode). # @see type # @return [String] # default nil attr_reader :top_left_cell - - + + # View Type # Indicates the view type. - # Options are + # Options are # * normal: Normal view # * page_break_preview: Page break preview # * page_layout: Page Layout View @@ -99,62 +99,62 @@ module Axlsx attr_reader :view # Workbook View Index - # Zero-based index of this workbook view, pointing + # Zero-based index of this workbook view, pointing # to a workbookView element in the bookViews collection. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :workbook_view_id # Zoom Scale - # Window zoom magnification for current view + # Window zoom magnification for current view # representing percent values. This attribute - # is restricted to values ranging from 10 to 400. + # is restricted to values ranging from 10 to 400. # Horizontal & Vertical scale together. - # Current view can be Normal, Page Layout, or + # Current view can be Normal, Page Layout, or # Page Break Preview. # @see type - # @return [Integer] + # @return [Integer] # default 100 attr_reader :zoom_scale # Zoom Scale Normal View - # Zoom magnification to use when in normal view, - # representing percent values. This attribute is - # restricted to values ranging from 10 to 400. + # Zoom magnification to use when in normal view, + # representing percent values. This attribute is + # restricted to values ranging from 10 to 400. # Horizontal & Vertical scale together. - # Applies for worksheets only; zero implies the + # Applies for worksheets only; zero implies the # automatic setting. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :zoom_scale_normal # Zoom Scale Page Layout View - # Zoom magnification to use when in page layout - # view, representing percent values. This attribute - # is restricted to values ranging from 10 to 400. + # Zoom magnification to use when in page layout + # view, representing percent values. This attribute + # is restricted to values ranging from 10 to 400. # Horizontal & Vertical scale together. - # Applies for worksheets only; zero implies + # Applies for worksheets only; zero implies # the automatic setting. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :zoom_scale_page_layout_view # Zoom Scale Page Break Preview - # Zoom magnification to use when in page break - # preview, representing percent values. This - # attribute is restricted to values ranging + # Zoom magnification to use when in page break + # preview, representing percent values. This + # attribute is restricted to values ranging # from 10 to 400. Horizontal & Vertical scale # together. - # Applies for worksheet only; zero implies + # Applies for worksheet only; zero implies # the automatic setting. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :zoom_scale_sheet_layout_view @@ -172,7 +172,7 @@ module Axlsx # @see top_left_cell def top_left_cell=(v) cell = (v.class == Axlsx::Cell ? v.r_abs : v) - Axlsx::validate_string(cell) + Axlsx::validate_string(cell) @top_left_cell = cell end diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb index 992486d2..881f12e7 100644 --- a/lib/axlsx/workbook/worksheet/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -64,7 +64,7 @@ module Axlsx end end - # TableStyleInfo for the table. + # TableStyleInfo for the table. # initialization can be fed via the :style_info option def table_style_info @table_style_info ||= TableStyleInfo.new diff --git a/lib/axlsx/workbook/worksheet/table_style_info.rb b/lib/axlsx/workbook/worksheet/table_style_info.rb index 22d85d41..c4678310 100644 --- a/lib/axlsx/workbook/worksheet/table_style_info.rb +++ b/lib/axlsx/workbook/worksheet/table_style_info.rb @@ -15,7 +15,7 @@ module Axlsx # @option [Boolean] show_column_stripes indicates if column stripes should # be shown # @option [Boolean] show_row_stripes indicates if row stripes should be shown - # @option [String] name The name of the style to apply to your table. + # @option [String] name The name of the style to apply to your table. # Only predefined styles are currently supported. # @see Annex G. (normative) Predefined SpreadsheetML Style Definitions in part 1 of the specification. def initialize(options = {}) diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb index f9e4c8cd..c6dd5545 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb @@ -24,7 +24,7 @@ module Axlsx # @see Comments#add_comment def add_comment(options={}) comments.add_comment(options) - end + end # The relationships defined by this objects comments collection # @return [Relationships] diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb index ec862c37..31ab3733 100644 --- a/test/doc_props/tc_app.rb +++ b/test/doc_props/tc_app.rb @@ -22,7 +22,7 @@ class TestApp < Test::Unit::TestCase :'CharactersWithSpaces' => 9, :'SharedDoc' => false, :'HyperlinkBase' => 'foo', - :'HyperlInksChanged' => false, + :'HyperlInksChanged' => false, :'Application' => 'axlsx', :'AppVersion' => '1.1.5', :'DocSecurity' => 0 diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb index 5a9fa5a3..71e5b6b2 100644 --- a/test/drawing/tc_axis.rb +++ b/test/drawing/tc_axis.rb @@ -20,7 +20,7 @@ class TestAxis < Test::Unit::TestCase @axis.cross_axis = Axlsx::CatAxis.new str = '' str << '' - doc = Nokogiri::XML(@axis.to_xml_string(str)) + doc = Nokogiri::XML(@axis.to_xml_string(str)) assert(doc.xpath("//a:srgbClr[@val='00FF00']")) end @@ -97,12 +97,12 @@ class TestAxis < Test::Unit::TestCase assert_raise(ArgumentError, "requires valid gridlines") { @axis.gridlines = 'alice' } assert_nothing_raised("accepts valid crosses") { @axis.gridlines = false } end - + def test_to_xml_string @axis.cross_axis = Axlsx::CatAxis.new str = '' str << '' - doc = Nokogiri::XML(@axis.to_xml_string(str)) + doc = Nokogiri::XML(@axis.to_xml_string(str)) assert(doc.xpath('//a:noFill')) assert(doc.xpath("//c:crosses[@val='#{@axis.crosses.to_s}']")) assert(doc.xpath("//c:crossAx[@val='#{@axis.cross_axis.to_s}']")) diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb index dddde3a1..d5474131 100644 --- a/test/drawing/tc_d_lbls.rb +++ b/test/drawing/tc_d_lbls.rb @@ -4,12 +4,12 @@ class TestDLbls < Test::Unit::TestCase def setup @d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart) - @boolean_attributes =[:show_legend_key, - :show_val, - :show_cat_name, - :show_ser_name, - :show_percent, - :show_bubble_size, + @boolean_attributes =[:show_legend_key, + :show_val, + :show_cat_name, + :show_ser_name, + :show_percent, + :show_bubble_size, :show_leader_lines] end @@ -21,11 +21,11 @@ class TestDLbls < Test::Unit::TestCase end def test_initialization_with_optoins - + options_hash = Hash[*[@boolean_attributes.map { |name| [name, true] }] ] d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge( { :d_lbl_pos => :t })) - + @boolean_attributes.each do |attr| assert_equal(true, d_lbls.send(attr), "boolean attributes set by options") end @@ -47,7 +47,7 @@ class TestDLbls < Test::Unit::TestCase def test_to_xml_string str = '' str << '' - @d_lbls.to_xml_string(str) + @d_lbls.to_xml_string(str) str << '' doc = Nokogiri::XML(str) Axlsx.instance_values_for(@d_lbls).each do |name, value| diff --git a/test/drawing/tc_num_data.rb b/test/drawing/tc_num_data.rb index 2549af4d..f2ac64b8 100644 --- a/test/drawing/tc_num_data.rb +++ b/test/drawing/tc_num_data.rb @@ -9,11 +9,11 @@ class TestNumData < Test::Unit::TestCase def test_initialize assert_equal(@num_data.format_code, "General") end - + def test_formula_based_cell - + end - + def test_format_code assert_raise(ArgumentError) {@num_data.format_code = 7} assert_nothing_raised {@num_data.format_code = 'foo_bar'} diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb index f47b6a4d..b9674a19 100644 --- a/test/rels/tc_relationship.rb +++ b/test/rels/tc_relationship.rb @@ -1,13 +1,13 @@ require 'tc_helper.rb' class TestRelationships < Test::Unit::TestCase - + def test_instances_with_different_attributes_have_unique_ids rel_1 = Axlsx::Relationship.new(Object.new, Axlsx::WORKSHEET_R, 'target') rel_2 = Axlsx::Relationship.new(Object.new, Axlsx::COMMENT_R, 'foobar') assert_not_equal rel_1.Id, rel_2.Id end - + def test_instances_with_same_attributes_share_id source_obj = Object.new instance = Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, 'target') @@ -21,18 +21,18 @@ class TestRelationships < Test::Unit::TestCase [t1, t2].each(&:join) assert_not_same(cache1, cache2) end - + def test_target_is_only_considered_for_same_attributes_check_if_target_mode_is_external source_obj = Object.new rel_1 = Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, 'target') rel_2 = Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, '../target') assert_equal rel_1.Id, rel_2.Id - + rel_3 = Axlsx::Relationship.new(source_obj, Axlsx::HYPERLINK_R, 'target', :target_mode => :External) rel_4 = Axlsx::Relationship.new(source_obj, Axlsx::HYPERLINK_R, '../target', :target_mode => :External) assert_not_equal rel_3.Id, rel_4.Id end - + def test_type assert_raise(ArgumentError) { Axlsx::Relationship.new nil, 'type', 'target' } assert_nothing_raised { Axlsx::Relationship.new nil, Axlsx::WORKSHEET_R, 'target' } diff --git a/test/rels/tc_relationships.rb b/test/rels/tc_relationships.rb index fe5a1ce5..768570b1 100644 --- a/test/rels/tc_relationships.rb +++ b/test/rels/tc_relationships.rb @@ -7,12 +7,12 @@ class TestRelationships < Test::Unit::TestCase rel_1 = Axlsx::Relationship.new(source_obj_1, Axlsx::WORKSHEET_R, "bar") rel_2 = Axlsx::Relationship.new(source_obj_2, Axlsx::WORKSHEET_R, "bar") rels = Axlsx::Relationships.new - rels << rel_1 + rels << rel_1 rels << rel_2 assert_equal rel_1, rels.for(source_obj_1) assert_equal rel_2, rels.for(source_obj_2) end - + def test_valid_document @rels = Axlsx::Relationships.new schema = Nokogiri::XML::Schema(File.open(Axlsx::RELS_XSD)) diff --git a/test/stylesheet/tc_dxf.rb b/test/stylesheet/tc_dxf.rb index e94a1614..eb5c4014 100644 --- a/test/stylesheet/tc_dxf.rb +++ b/test/stylesheet/tc_dxf.rb @@ -4,7 +4,7 @@ class TestDxf < Test::Unit::TestCase def setup @item = Axlsx::Dxf.new - @styles = Axlsx::Styles.new + @styles = Axlsx::Styles.new end def teardown @@ -46,7 +46,7 @@ class TestDxf < Test::Unit::TestCase def test_font assert_raise(ArgumentError) { @item.font = 1 } assert_nothing_raised { @item.font = Axlsx::Font.new } - assert @item.font.is_a? Axlsx::Font + assert @item.font.is_a? Axlsx::Font end def test_border @@ -59,7 +59,7 @@ class TestDxf < Test::Unit::TestCase @item.border = Axlsx::Border.new doc = Nokogiri::XML.parse(@item.to_xml_string) assert_equal(1, doc.xpath(".//dxf//border").size) - assert_equal(0, doc.xpath(".//dxf//font").size) + assert_equal(0, doc.xpath(".//dxf//font").size) end def test_many_options_xml @@ -69,13 +69,13 @@ class TestDxf < Test::Unit::TestCase @item.font = Axlsx::Font.new @item.protection = Axlsx::CellProtection.new @item.numFmt = Axlsx::NumFmt.new - + doc = Nokogiri::XML.parse(@item.to_xml_string) assert_equal(1, doc.xpath(".//dxf//fill//patternFill[@patternType='solid']//fgColor[@rgb='FF000000']").size) assert_equal(1, doc.xpath(".//dxf//font").size) assert_equal(1, doc.xpath(".//dxf//protection").size) assert_equal(1, doc.xpath(".//dxf//numFmt[@numFmtId='0'][@formatCode='']").size) assert_equal(1, doc.xpath(".//dxf//alignment").size) - assert_equal(1, doc.xpath(".//dxf//border").size) + assert_equal(1, doc.xpath(".//dxf//border").size) end end diff --git a/test/stylesheet/tc_pattern_fill.rb b/test/stylesheet/tc_pattern_fill.rb index 3895cffb..fef28248 100644 --- a/test/stylesheet/tc_pattern_fill.rb +++ b/test/stylesheet/tc_pattern_fill.rb @@ -33,9 +33,9 @@ class TestPatternFill < Test::Unit::TestCase assert_nothing_raised { @item.patternType = :lightUp } assert_equal(@item.patternType, :lightUp) end - + def test_to_xml_string - @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb=>"00FF00") + @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb=>"00FF00") doc = Nokogiri::XML(@item.to_xml_string) assert(doc.xpath('//color[@rgb="FFFF0000"]')) assert(doc.xpath('//color[@rgb="FF00FF00"]')) diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index 503068c0..b9ccfebd 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -44,7 +44,7 @@ class TestStyles < Test::Unit::TestCase assert_equal(@styles.borders.size, (prev_border_count+1)) current_border = @styles.borders.last - + borders_array.each do |b_opts| if b_opts[:edges] border_pr = current_border.prs.detect{|x| x.name == b_opts[:edges].first } @@ -289,7 +289,7 @@ class TestStyles < Test::Unit::TestCase def test_border_top_without_border_regression ### https://github.com/axlsx-styler-gem/axlsx_styler/issues/31 - + borders = { top: { style: :double, color: '0000FF' }, right: { style: :thick, color: 'FF0000' }, @@ -305,6 +305,6 @@ class TestStyles < Test::Unit::TestCase border_pr = current_border.prs.detect{|x| x.name == edge } assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}") end - + end end diff --git a/test/stylesheet/tc_table_style_element.rb b/test/stylesheet/tc_table_style_element.rb index 9ef54e2f..554636eb 100644 --- a/test/stylesheet/tc_table_style_element.rb +++ b/test/stylesheet/tc_table_style_element.rb @@ -36,7 +36,7 @@ class TestTableStyleElement < Test::Unit::TestCase assert_nothing_raised { @item.dxfId = 7 } assert_equal(@item.dxfId, 7) end - + def test_to_xml_string doc = Nokogiri::XML(@item.to_xml_string) @item.type = :headerRow diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index 3903fc42..35fd5ea5 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -106,7 +106,7 @@ class TestAxlsx < Test::Unit::TestCase assert_equal(sanitized_str, legit_str, 'should preserve value') assert_equal(sanitized_str.object_id, legit_str.object_id, 'should preserve object') end - + class InstanceValuesSubject def initialize(args={}) args.each do |key, v| @@ -130,7 +130,7 @@ class TestAxlsx < Test::Unit::TestCase assert_equal({"obj" => inner_obj}, Axlsx.instance_values_for(complex), 'should pass value of ivar directly') nil_subject = InstanceValuesSubject.new(nil_obj: nil) - assert_equal({"nil_obj" => nil}, Axlsx.instance_values_for(nil_subject), 'should return nil ivars') + assert_equal({"nil_obj" => nil}, Axlsx.instance_values_for(nil_subject), 'should return nil ivars') end def test_hash_deep_merge diff --git a/test/util/tc_simple_typed_list.rb b/test/util/tc_simple_typed_list.rb index 72bd6246..88e75a1c 100644 --- a/test/util/tc_simple_typed_list.rb +++ b/test/util/tc_simple_typed_list.rb @@ -61,7 +61,7 @@ class TestSimpleTypedList < Test::Unit::TestCase assert_nothing_raised { @list.delete 0 } assert_nothing_raised { @list.delete 9 } end - + def test_delete @list.push 1 assert(@list.size == 1) diff --git a/test/workbook/worksheet/auto_filter/tc_filter_column.rb b/test/workbook/worksheet/auto_filter/tc_filter_column.rb index ec74316c..60b726a6 100644 --- a/test/workbook/worksheet/auto_filter/tc_filter_column.rb +++ b/test/workbook/worksheet/auto_filter/tc_filter_column.rb @@ -10,10 +10,10 @@ class TestFilterColumn < Test::Unit::TestCase def test_initialize_col_id assert_raise ArgumentError do Axlsx::FilterColumn.new(0, :bobs_house_of_filter) - end - assert_raise ArgumentError do + end + assert_raise ArgumentError do Axlsx::FilterColumn.new(:penut, :filters) - end + end end def test_initailize_filter_type @@ -44,7 +44,7 @@ class TestFilterColumn < Test::Unit::TestCase def test_show_button assert_raise ArgumentError do - @filter_column.show_button = :foo + @filter_column.show_button = :foo end assert_nothing_raised { @filter_column.show_button = false } end @@ -52,14 +52,14 @@ class TestFilterColumn < Test::Unit::TestCase def test_hidden_button assert_raise ArgumentError do @filter_column.hidden_button = :hoge - end + end assert_nothing_raised { @filter_column.hidden_button = true } end def test_col_id= - assert_raise ArgumentError do + assert_raise ArgumentError do @filter_column.col_id = :bar - end + end assert_nothing_raised { @filter_column.col_id = 7 } end diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb index 3a8759aa..dc0e985c 100644 --- a/test/workbook/worksheet/auto_filter/tc_filters.rb +++ b/test/workbook/worksheet/auto_filter/tc_filters.rb @@ -2,8 +2,8 @@ require 'tc_helper.rb' class TestFilters < Test::Unit::TestCase def setup - @filters = Axlsx::Filters.new(:filter_items => [1, 'a'], - :date_group_items =>[ { :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 } ] , + @filters = Axlsx::Filters.new(:filter_items => [1, 'a'], + :date_group_items =>[ { :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 } ] , :blank => true) end @@ -29,15 +29,15 @@ class TestFilters < Test::Unit::TestCase assert @filters.date_group_items.is_a?(Array) assert_equal 1, @filters.date_group_items.size end - + def test_apply_is_false_for_matching_values keeper = Object.new - def keeper.value; 'a'; end + def keeper.value; 'a'; end assert_equal false, @filters.apply(keeper) end def test_apply_is_true_for_non_matching_values - hidden = Object.new + hidden = Object.new def hidden.value; 'b'; end assert_equal true, @filters.apply(hidden) end diff --git a/test/workbook/worksheet/tc_comments.rb b/test/workbook/worksheet/tc_comments.rb index acadf73d..91fb49a2 100644 --- a/test/workbook/worksheet/tc_comments.rb +++ b/test/workbook/worksheet/tc_comments.rb @@ -28,7 +28,7 @@ class TestComments < Test::Unit::TestCase @ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1') assert_equal(@ws.comments.authors.size, 3) @ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1') - assert_equal(@ws.comments.authors.size, 3, 'only unique authors are returned') + assert_equal(@ws.comments.authors.size, 3, 'only unique authors are returned') end def test_pn assert_equal(@ws.comments.pn, Axlsx::COMMENT_PN % (@ws.index+1).to_s) diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 12fee6ef..3263371a 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -11,114 +11,114 @@ class TestDataValidation < Test::Unit::TestCase @nil_options = { :formula1 => 'foo', :formula2 => 'foo', :errorTitle => 'foo', :operator => :lessThan, :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' } @type_option = { :type => :whole } @error_style_option = { :errorStyle => :warning } - + @string_options = { :formula1 => 'foo', :formula2 => 'foo', :error => 'foo', :errorTitle => 'foo', :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' } @symbol_options = { :errorStyle => :warning, :operator => :lessThan, :type => :whole} - + @options = @boolean_options.merge(@nil_options).merge(@type_option).merge(@error_style_option) - + @dv = Axlsx::DataValidation.new(@options) end - + def test_initialize dv = Axlsx::DataValidation.new - + @boolean_options.each do |key, value| assert_equal(!value, dv.send(key.to_sym), "initialized default #{key} should be #{!value}") assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}") end - + @nil_options.each do |key, value| assert_equal(nil, dv.send(key.to_sym), "initialized default #{key} should be nil") assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}") end - + @type_option.each do |key, value| assert_equal(:none, dv.send(key.to_sym), "initialized default #{key} should be :none") assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}") end - + @error_style_option.each do |key, value| assert_equal(:stop, dv.send(key.to_sym), "initialized default #{key} should be :stop") assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}") end end - + def test_boolean_attribute_validation @boolean_options.each do |key, value| assert_raise(ArgumentError, "#{key} must be boolean") { @dv.send("#{key}=".to_sym, 'A') } assert_nothing_raised { @dv.send("#{key}=".to_sym, true) } end end - + def test_string_attribute_validation @string_options.each do |key, value| assert_raise(ArgumentError, "#{key} must be string") { @dv.send("#{key}=".to_sym, :symbol) } assert_nothing_raised { @dv.send("#{key}=".to_sym, "foo") } end end - + def test_symbol_attribute_validation @symbol_options.each do |key, value| assert_raise(ArgumentError, "#{key} must be symbol") { @dv.send("#{key}=".to_sym, "foo") } assert_nothing_raised { @dv.send("#{key}=".to_sym, value) } end end - + def test_formula1 assert_raise(ArgumentError) { @dv.formula1 = 10 } assert_nothing_raised { @dv.formula1 = "=SUM(A1:A1)" } assert_equal(@dv.formula1, "=SUM(A1:A1)") end - + def test_formula2 assert_raise(ArgumentError) { @dv.formula2 = 10 } assert_nothing_raised { @dv.formula2 = "=SUM(A1:A1)" } assert_equal(@dv.formula2, "=SUM(A1:A1)") end - + def test_allowBlank assert_raise(ArgumentError) { @dv.allowBlank = "foo´" } assert_nothing_raised { @dv.allowBlank = false } assert_equal(@dv.allowBlank, false) end - + def test_error assert_raise(ArgumentError) { @dv.error = :symbol } assert_nothing_raised { @dv.error = "This is a error message" } assert_equal(@dv.error, "This is a error message") end - + def test_errorStyle assert_raise(ArgumentError) { @dv.errorStyle = "foo" } assert_nothing_raised { @dv.errorStyle = :information } assert_equal(@dv.errorStyle, :information) end - + def test_errorTitle assert_raise(ArgumentError) { @dv.errorTitle = :symbol } assert_nothing_raised { @dv.errorTitle = "This is the error title" } assert_equal(@dv.errorTitle, "This is the error title") end - + def test_operator assert_raise(ArgumentError) { @dv.operator = "foo" } assert_nothing_raised { @dv.operator = :greaterThan } assert_equal(@dv.operator, :greaterThan) end - + def test_prompt assert_raise(ArgumentError) { @dv.prompt = :symbol } assert_nothing_raised { @dv.prompt = "This is a prompt message" } assert_equal(@dv.prompt, "This is a prompt message") end - + def test_promptTitle assert_raise(ArgumentError) { @dv.promptTitle = :symbol } assert_nothing_raised { @dv.promptTitle = "This is the prompt title" } assert_equal(@dv.promptTitle, "This is the prompt title") end - + def test_showDropDown warnings = capture_warnings do assert_raise(ArgumentError) { @dv.showDropDown = "foo´" } @@ -137,41 +137,41 @@ class TestDataValidation < Test::Unit::TestCase # As hideDropdown is just an alias for showDropDown, we should test the original value too assert_equal(@dv.showDropDown, false) end - + def test_showErrorMessage assert_raise(ArgumentError) { @dv.showErrorMessage = "foo´" } assert_nothing_raised { @dv.showErrorMessage = false } assert_equal(@dv.showErrorMessage, false) end - + def test_showInputMessage assert_raise(ArgumentError) { @dv.showInputMessage = "foo´" } assert_nothing_raised { @dv.showInputMessage = false } assert_equal(@dv.showInputMessage, false) end - + def test_sqref assert_raise(ArgumentError) { @dv.sqref = 10 } assert_nothing_raised { @dv.sqref = "A1:A1" } assert_equal(@dv.sqref, "A1:A1") end - + def test_type assert_raise(ArgumentError) { @dv.type = "foo" } assert_nothing_raised { @dv.type = :list } assert_equal(@dv.type, :list) end - + def test_whole_decimal_data_time_textLength_to_xml p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"data_validation" - @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', - :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', + @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', + :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', :prompt => 'Only values between 5 and 10'}) - + doc = Nokogiri::XML.parse(@ws.to_xml_string) - + #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] @@ -181,26 +181,26 @@ class TestDataValidation < Test::Unit::TestCase [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1] [@type='whole'][@errorStyle='information']") - + #test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='5'") - + #test forumula2 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula2").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula2='10'") end - + def test_list_to_xml p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"data_validation" @ws.add_data_validation("A1", { :type => :list, :formula1 => 'A1:A5', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', - :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', + :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', :prompt => 'Only values from list', :hideDropDown => true}) - + doc = Nokogiri::XML.parse(@ws.to_xml_string) - + #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] @@ -209,22 +209,22 @@ class TestDataValidation < Test::Unit::TestCase assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'][@errorStyle='stop']") - + #test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='A1:A5'") end - + def test_custom_to_xml p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"data_validation" @ws.add_data_validation("A1", { :type => :custom, :formula1 => '=5/2', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values corresponding formula', - :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values corresponding formula', + :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', :prompt => 'Only values corresponding formula'}) - + doc = Nokogiri::XML.parse(@ws.to_xml_string) - + #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'][@promptTitle='Be carful!'] [@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'][@showErrorMessage=1] @@ -232,26 +232,26 @@ class TestDataValidation < Test::Unit::TestCase assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'][@promptTitle='Be carful!'] [@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'] [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='custom'][@errorStyle='stop']") - + #test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='=5/2'") end - + def test_multiple_datavalidations_to_xml p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"data_validation" - @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', - :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', + @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', + :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', :prompt => 'Only values between 5 and 10'}) @ws.add_data_validation("B1", { :type => :list, :formula1 => 'A1:A5', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', - :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', + :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', :prompt => 'Only values from list', :hideDropDown => true}) - + doc = Nokogiri::XML.parse(@ws.to_xml_string) - + #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] @@ -261,7 +261,7 @@ class TestDataValidation < Test::Unit::TestCase [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1] [@type='whole'][@errorStyle='information']") - + #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='B1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] @@ -271,7 +271,7 @@ class TestDataValidation < Test::Unit::TestCase [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'][@errorStyle='stop']") end - + def test_empty_attributes v = Axlsx::DataValidation.new assert_equal(nil, v.send(:get_valid_attributes)) diff --git a/test/workbook/worksheet/tc_outline_pr.rb b/test/workbook/worksheet/tc_outline_pr.rb index 41a2b4ca..a40108b1 100644 --- a/test/workbook/worksheet/tc_outline_pr.rb +++ b/test/workbook/worksheet/tc_outline_pr.rb @@ -12,7 +12,7 @@ class TestOutlinePr < Test::Unit::TestCase def test_summary_right assert_equal true, @outline_pr.summary_right end - + def test_apply_styles assert_equal false, @outline_pr.apply_styles end diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb index fff0bf7a..3b040778 100644 --- a/test/workbook/worksheet/tc_pane.rb +++ b/test/workbook/worksheet/tc_pane.rb @@ -17,31 +17,31 @@ class TestPane < Test::Unit::TestCase assert_nothing_raised { @pane.active_pane = :top_left } assert_equal(@pane.active_pane, "topLeft") end - + def test_state assert_raise(ArgumentError) { @pane.state = "foo" } assert_nothing_raised { @pane.state = :frozen_split } assert_equal(@pane.state, "frozenSplit") end - + def test_x_split assert_raise(ArgumentError) { @pane.x_split = "foo´" } assert_nothing_raised { @pane.x_split = 200 } assert_equal(@pane.x_split, 200) end - + def test_y_split assert_raise(ArgumentError) { @pane.y_split = 'foo' } assert_nothing_raised { @pane.y_split = 300 } assert_equal(@pane.y_split, 300) end - + def test_top_left_cell assert_raise(ArgumentError) { @pane.top_left_cell = :cell } assert_nothing_raised { @pane.top_left_cell = "A2" } assert_equal(@pane.top_left_cell, "A2") end - + def test_to_xml doc = Nokogiri::XML.parse(@pane.to_xml_string) assert_equal(1, doc.xpath("//pane[@ySplit=2][@xSplit='2'][@topLeftCell='A2'][@state='frozen'][@activePane='bottomLeft']").size) diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb index f676a72d..f01440ad 100644 --- a/test/workbook/worksheet/tc_pivot_table.rb +++ b/test/workbook/worksheet/tc_pivot_table.rb @@ -156,7 +156,7 @@ class TestPivotTable < Test::Unit::TestCase def test_pivot_table_with_more_than_one_data_row ### https://github.com/caxlsx/caxlsx/issues/110 - + pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt| pt.rows = ["Date", "Name"] pt.data = [ @@ -187,7 +187,7 @@ class TestPivotTable < Test::Unit::TestCase def test_pivot_table_with_only_one_data_row ### https://github.com/caxlsx/caxlsx/issues/110 - + pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt| pt.rows = ["Date", "Name"] pt.data = [ diff --git a/test/workbook/worksheet/tc_rich_text.rb b/test/workbook/worksheet/tc_rich_text.rb index d79d3021..1bd3ec76 100644 --- a/test/workbook/worksheet/tc_rich_text.rb +++ b/test/workbook/worksheet/tc_rich_text.rb @@ -24,7 +24,7 @@ class RichText < Test::Unit::TestCase row = @ws.add_row [rt_direct, rt_indirect] assert_equal(row[0].to_xml_string(0,0), row[1].to_xml_string(0,0)) end - + def test_textruns runs = @rt.runs assert_equal(runs.length, 27) @@ -33,7 +33,7 @@ class RichText < Test::Unit::TestCase assert_equal(runs[1].b, true) assert_equal(runs[1].i, false) end - + def test_implicit_richtext rt = Axlsx::RichText.new('a', :b => true) row_rt = @ws.add_row [rt] diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb index 38b13806..3d1a4d4d 100644 --- a/test/workbook/worksheet/tc_row.rb +++ b/test/workbook/worksheet/tc_row.rb @@ -140,7 +140,7 @@ class TestRow < Test::Unit::TestCase offset = 3 values = [1,2,3,4,5] r = @ws.add_row(values, offset: offset, style: 1) - r.cells.each_with_index do |c, index| + r.cells.each_with_index do |c, index| assert_equal(c.style, index < offset ? 0 : 1) assert_equal(c.value, index < offset ? nil : values[index - offset]) end @@ -151,7 +151,7 @@ class TestRow < Test::Unit::TestCase values = [1,2,3,4,5] styles = (1..5).map{ @ws.workbook.styles.add_style } r = @ws.add_row(values, offset: offset, style: styles) - r.cells.each_with_index do |c, index| + r.cells.each_with_index do |c, index| assert_equal(c.style, index < offset ? 0 : styles[index-offset]) assert_equal(c.value, index < offset ? nil : values[index - offset]) end diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb index 0595d2ec..6ca5dafd 100644 --- a/test/workbook/worksheet/tc_sheet_protection.rb +++ b/test/workbook/worksheet/tc_sheet_protection.rb @@ -20,7 +20,7 @@ require 'tc_helper.rb' # # # - + class TestSheetProtection < Test::Unit::TestCase def setup #inverse defaults @@ -30,9 +30,9 @@ class TestSheetProtection < Test::Unit::TestCase :sort => false, :auto_filter => false, :pivot_tables => false, :select_unlocked_cells => true } @string_options = { :password => nil } - + @options = @boolean_options.merge(@string_options) - + @sp = Axlsx::SheetProtection.new(@options) end @@ -56,7 +56,7 @@ class TestSheetProtection < Test::Unit::TestCase @sp.password = 'fish' # -> CA3F doc = Nokogiri::XML(@sp.to_xml_string) @options.each do |key, value| - assert(doc.xpath("//sheetProtection[@#{key.to_s.gsub(/_(.)/){ $1.upcase }}='#{value}']")) + assert(doc.xpath("//sheetProtection[@#{key.to_s.gsub(/_(.)/){ $1.upcase }}='#{value}']")) end end diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb index c0c452c9..f0c6821c 100644 --- a/test/workbook/worksheet/tc_table_style_info.rb +++ b/test/workbook/worksheet/tc_table_style_info.rb @@ -4,7 +4,7 @@ class TestTableStyleInfo < Test::Unit::TestCase def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet - 40.times do + 40.times do @ws.add_row %w(aa bb cc dd ee ff gg hh ii jj kk) end @table = @ws.add_table(Axlsx::cell_range([@ws.rows.first.cells.first,@ws.rows.last.cells.last], false), :name => 'foo') diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 8e0c5696..5a1a870a 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -838,7 +838,7 @@ class TestWorksheet < Test::Unit::TestCase sheet.add_border 'B2:D4', style: :medium sheet.add_style 'D2:D4', border: { style: :thin, color: '000000' } end - + wb.apply_styles assert_equal 8, wb.styled_cells.count @@ -884,15 +884,15 @@ class TestWorksheet < Test::Unit::TestCase wb.apply_styles assert_equal 1, wb.styles.style_index.size - + assert_equal( { - type: :xf, - name: "Times New Roman", - sz: 12, - family: 1, + type: :xf, + name: "Times New Roman", + sz: 12, + family: 1, color: "FFFFFF", - }, + }, wb.styles.style_index.values.first ) end diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb index 88a40bc6..2245996a 100644 --- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb +++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb @@ -22,7 +22,7 @@ class TestWorksheetHyperlink < Test::Unit::TestCase end def test_target - + assert_equal(@options[:target], Axlsx.instance_values_for(@a)['target']) end -- cgit v1.2.3 From f46c7cf4c1cd961557dc5d0abf774e4c78aafb7c Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:26:03 +0200 Subject: Fix Layout/TrailingEmptyLines offenses ``` rubocop --only Layout/TrailingEmptyLines -a ``` --- lib/axlsx/drawing/ax_data_source.rb | 1 - lib/axlsx/drawing/num_data_source.rb | 1 - lib/axlsx/util/accessors.rb | 1 - lib/axlsx/workbook/defined_names.rb | 1 - lib/axlsx/workbook/workbook_views.rb | 2 - lib/axlsx/workbook/worksheet/break.rb | 1 - .../workbook/worksheet/conditional_formattings.rb | 1 - lib/axlsx/workbook/worksheet/data_validations.rb | 2 - test/drawing/tc_axes.rb | 2 +- test/workbook/worksheet/auto_filter/tc_filters.rb | 1 - test/workbook/worksheet/tc_comment.rb | 1 - test/workbook/worksheet/tc_comments.rb | 2 - test/workbook/worksheet/tc_header_footer.rb | 1 - test/workbook/worksheet/tc_sheet_protection.rb | 54 ---------------------- test/workbook/worksheet/tc_worksheet_hyperlink.rb | 2 - 15 files changed, 1 insertion(+), 72 deletions(-) diff --git a/lib/axlsx/drawing/ax_data_source.rb b/lib/axlsx/drawing/ax_data_source.rb index ebbfe2cd..cef683dd 100644 --- a/lib/axlsx/drawing/ax_data_source.rb +++ b/lib/axlsx/drawing/ax_data_source.rb @@ -23,4 +23,3 @@ module Axlsx end end - diff --git a/lib/axlsx/drawing/num_data_source.rb b/lib/axlsx/drawing/num_data_source.rb index e0e97e41..24bb9c4d 100644 --- a/lib/axlsx/drawing/num_data_source.rb +++ b/lib/axlsx/drawing/num_data_source.rb @@ -59,4 +59,3 @@ module Axlsx end end end - diff --git a/lib/axlsx/util/accessors.rb b/lib/axlsx/util/accessors.rb index 5062b0d4..d21388a0 100644 --- a/lib/axlsx/util/accessors.rb +++ b/lib/axlsx/util/accessors.rb @@ -61,4 +61,3 @@ module Axlsx end end end - diff --git a/lib/axlsx/workbook/defined_names.rb b/lib/axlsx/workbook/defined_names.rb index 11f10a56..abe8197a 100644 --- a/lib/axlsx/workbook/defined_names.rb +++ b/lib/axlsx/workbook/defined_names.rb @@ -18,4 +18,3 @@ module Axlsx end end end - diff --git a/lib/axlsx/workbook/workbook_views.rb b/lib/axlsx/workbook/workbook_views.rb index c32bd632..0a059e8a 100644 --- a/lib/axlsx/workbook/workbook_views.rb +++ b/lib/axlsx/workbook/workbook_views.rb @@ -18,5 +18,3 @@ module Axlsx end end end - - diff --git a/lib/axlsx/workbook/worksheet/break.rb b/lib/axlsx/workbook/worksheet/break.rb index 2e40a265..bf019eeb 100644 --- a/lib/axlsx/workbook/worksheet/break.rb +++ b/lib/axlsx/workbook/worksheet/break.rb @@ -32,4 +32,3 @@ module Axlsx end end end - diff --git a/lib/axlsx/workbook/worksheet/conditional_formattings.rb b/lib/axlsx/workbook/worksheet/conditional_formattings.rb index 2fe9f2e8..23301ff8 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formattings.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formattings.rb @@ -22,4 +22,3 @@ module Axlsx end end - diff --git a/lib/axlsx/workbook/worksheet/data_validations.rb b/lib/axlsx/workbook/worksheet/data_validations.rb index cdfcf375..44afadf6 100644 --- a/lib/axlsx/workbook/worksheet/data_validations.rb +++ b/lib/axlsx/workbook/worksheet/data_validations.rb @@ -24,5 +24,3 @@ module Axlsx end end - - diff --git a/test/drawing/tc_axes.rb b/test/drawing/tc_axes.rb index e3c26936..eabf9a8d 100644 --- a/test/drawing/tc_axes.rb +++ b/test/drawing/tc_axes.rb @@ -5,4 +5,4 @@ class TestAxes < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx::Axes.new(:val_axis => Axlsx::ValAxis, :cat_axis => Axlsx::CatAxis) } assert_nothing_raised { Axlsx::Axes.new(:cat_axis => Axlsx::CatAxis, :val_axis => Axlsx::ValAxis) } end -end \ No newline at end of file +end diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb index dc0e985c..5de5d7d1 100644 --- a/test/workbook/worksheet/auto_filter/tc_filters.rb +++ b/test/workbook/worksheet/auto_filter/tc_filters.rb @@ -47,4 +47,3 @@ class TestFilters < Test::Unit::TestCase assert_equal(1, doc.xpath('//filters[@blank=1]').size) end end - diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb index e66abb9a..b736e5c5 100644 --- a/test/workbook/worksheet/tc_comment.rb +++ b/test/workbook/worksheet/tc_comment.rb @@ -69,4 +69,3 @@ class TestComment < Test::Unit::TestCase assert_equal("some text", doc.xpath("//comment/text").text) end end - diff --git a/test/workbook/worksheet/tc_comments.rb b/test/workbook/worksheet/tc_comments.rb index 91fb49a2..68b3ac71 100644 --- a/test/workbook/worksheet/tc_comments.rb +++ b/test/workbook/worksheet/tc_comments.rb @@ -53,5 +53,3 @@ class TestComments < Test::Unit::TestCase # assert_equal(doc.xpath("//comment").size, @ws.comments.size) end end - - diff --git a/test/workbook/worksheet/tc_header_footer.rb b/test/workbook/worksheet/tc_header_footer.rb index caf1b9df..bba879a1 100644 --- a/test/workbook/worksheet/tc_header_footer.rb +++ b/test/workbook/worksheet/tc_header_footer.rb @@ -148,4 +148,3 @@ class TestHeaderFooter < Test::Unit::TestCase assert_equal(0, doc.xpath(".//headerFooter/firstFooter").size) end end - diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb index 6ca5dafd..cf3b8957 100644 --- a/test/workbook/worksheet/tc_sheet_protection.rb +++ b/test/workbook/worksheet/tc_sheet_protection.rb @@ -61,57 +61,3 @@ class TestSheetProtection < Test::Unit::TestCase end end - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb index 2245996a..b456694d 100644 --- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb +++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb @@ -52,5 +52,3 @@ class TestWorksheetHyperlink < Test::Unit::TestCase assert_equal(doc.xpath("//xmlns:hyperlink[@r:id='#{@a.relationship.Id}']").size, 1) end end - - -- cgit v1.2.3 From dc579ba8d01720e0ccfa8b7ba5e86be0bc518056 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:28:36 +0200 Subject: Fix Layout/LeadingEmptyLines offenses ``` rubocop --only Layout/LeadingEmptyLines -a ``` --- lib/axlsx/content_type/override.rb | 1 - lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/axlsx/content_type/override.rb b/lib/axlsx/content_type/override.rb index 7a8e33fa..01baa2f5 100644 --- a/lib/axlsx/content_type/override.rb +++ b/lib/axlsx/content_type/override.rb @@ -1,4 +1,3 @@ - # encoding: UTF-8 module Axlsx diff --git a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb index 9fd6be18..4635ba20 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb @@ -1,4 +1,3 @@ - require 'axlsx/workbook/worksheet/auto_filter/filter_column.rb' require 'axlsx/workbook/worksheet/auto_filter/filters.rb' -- cgit v1.2.3 From 633141067e99fd1798d3591293fe2ac53d157682 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:19:41 +0200 Subject: Fix Style/Encoding offenses ``` rubocop --only Style/Encoding -a ``` --- lib/axlsx.rb | 1 - lib/axlsx/content_type/content_type.rb | 1 - lib/axlsx/content_type/default.rb | 1 - lib/axlsx/content_type/override.rb | 1 - lib/axlsx/doc_props/app.rb | 1 - lib/axlsx/doc_props/core.rb | 1 - lib/axlsx/drawing/area_chart.rb | 1 - lib/axlsx/drawing/area_series.rb | 1 - lib/axlsx/drawing/axis.rb | 1 - lib/axlsx/drawing/bar_3D_chart.rb | 1 - lib/axlsx/drawing/bar_chart.rb | 1 - lib/axlsx/drawing/bar_series.rb | 1 - lib/axlsx/drawing/bubble_chart.rb | 1 - lib/axlsx/drawing/bubble_series.rb | 1 - lib/axlsx/drawing/cat_axis.rb | 1 - lib/axlsx/drawing/chart.rb | 1 - lib/axlsx/drawing/drawing.rb | 1 - lib/axlsx/drawing/graphic_frame.rb | 1 - lib/axlsx/drawing/hyperlink.rb | 1 - lib/axlsx/drawing/line_3D_chart.rb | 1 - lib/axlsx/drawing/line_chart.rb | 1 - lib/axlsx/drawing/line_series.rb | 1 - lib/axlsx/drawing/marker.rb | 1 - lib/axlsx/drawing/num_data.rb | 1 - lib/axlsx/drawing/num_val.rb | 1 - lib/axlsx/drawing/one_cell_anchor.rb | 1 - lib/axlsx/drawing/pic.rb | 1 - lib/axlsx/drawing/picture_locking.rb | 1 - lib/axlsx/drawing/pie_3D_chart.rb | 1 - lib/axlsx/drawing/pie_series.rb | 1 - lib/axlsx/drawing/scaling.rb | 1 - lib/axlsx/drawing/scatter_chart.rb | 1 - lib/axlsx/drawing/scatter_series.rb | 1 - lib/axlsx/drawing/ser_axis.rb | 1 - lib/axlsx/drawing/series.rb | 1 - lib/axlsx/drawing/series_title.rb | 1 - lib/axlsx/drawing/str_data.rb | 1 - lib/axlsx/drawing/str_val.rb | 1 - lib/axlsx/drawing/title.rb | 1 - lib/axlsx/drawing/two_cell_anchor.rb | 1 - lib/axlsx/drawing/val_axis.rb | 1 - lib/axlsx/drawing/view_3D.rb | 1 - lib/axlsx/package.rb | 1 - lib/axlsx/rels/relationship.rb | 1 - lib/axlsx/rels/relationships.rb | 1 - lib/axlsx/stylesheet/border.rb | 1 - lib/axlsx/stylesheet/border_pr.rb | 1 - lib/axlsx/stylesheet/cell_alignment.rb | 1 - lib/axlsx/stylesheet/cell_protection.rb | 1 - lib/axlsx/stylesheet/cell_style.rb | 1 - lib/axlsx/stylesheet/color.rb | 1 - lib/axlsx/stylesheet/dxf.rb | 1 - lib/axlsx/stylesheet/fill.rb | 1 - lib/axlsx/stylesheet/font.rb | 1 - lib/axlsx/stylesheet/gradient_fill.rb | 1 - lib/axlsx/stylesheet/gradient_stop.rb | 1 - lib/axlsx/stylesheet/num_fmt.rb | 1 - lib/axlsx/stylesheet/pattern_fill.rb | 1 - lib/axlsx/stylesheet/styles.rb | 1 - lib/axlsx/stylesheet/table_style.rb | 1 - lib/axlsx/stylesheet/table_style_element.rb | 1 - lib/axlsx/stylesheet/table_styles.rb | 1 - lib/axlsx/stylesheet/xf.rb | 1 - lib/axlsx/util/simple_typed_list.rb | 1 - lib/axlsx/util/storage.rb | 1 - lib/axlsx/util/validators.rb | 1 - lib/axlsx/util/zip_command.rb | 1 - lib/axlsx/workbook/shared_strings_table.rb | 1 - lib/axlsx/workbook/workbook.rb | 1 - lib/axlsx/workbook/worksheet/border_creator.rb | 2 -- lib/axlsx/workbook/worksheet/cell.rb | 1 - lib/axlsx/workbook/worksheet/col.rb | 1 - lib/axlsx/workbook/worksheet/comments.rb | 1 - lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb | 1 - lib/axlsx/workbook/worksheet/data_validation.rb | 1 - lib/axlsx/workbook/worksheet/date_time_converter.rb | 1 - lib/axlsx/workbook/worksheet/pivot_table.rb | 1 - lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb | 1 - lib/axlsx/workbook/worksheet/row.rb | 1 - lib/axlsx/workbook/worksheet/selection.rb | 1 - lib/axlsx/workbook/worksheet/sheet_protection.rb | 1 - lib/axlsx/workbook/worksheet/sheet_view.rb | 1 - lib/axlsx/workbook/worksheet/table.rb | 1 - lib/axlsx/workbook/worksheet/worksheet.rb | 2 -- lib/caxlsx.rb | 1 - test/content_type/tc_content_type.rb | 1 - test/content_type/tc_default.rb | 1 - test/tc_package.rb | 1 - test/workbook/worksheet/tc_data_validation.rb | 1 - test/workbook/worksheet/tc_date_time_converter.rb | 1 - test/workbook/worksheet/tc_pane.rb | 1 - test/workbook/worksheet/tc_protected_range.rb | 1 - test/workbook/worksheet/tc_selection.rb | 1 - test/workbook/worksheet/tc_sheet_protection.rb | 1 - test/workbook/worksheet/tc_sheet_view.rb | 1 - 95 files changed, 97 deletions(-) diff --git a/lib/axlsx.rb b/lib/axlsx.rb index 23082b71..931feb2d 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'htmlentities' require 'axlsx/version.rb' require 'marcel' diff --git a/lib/axlsx/content_type/content_type.rb b/lib/axlsx/content_type/content_type.rb index 5d36d685..e6dfdee5 100644 --- a/lib/axlsx/content_type/content_type.rb +++ b/lib/axlsx/content_type/content_type.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx require 'axlsx/content_type/abstract_content_type.rb' require 'axlsx/content_type/default.rb' diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb index 3fe15609..be3a7c04 100644 --- a/lib/axlsx/content_type/default.rb +++ b/lib/axlsx/content_type/default.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # An default content part. These parts are automatically created by for you based on the content of your package. diff --git a/lib/axlsx/content_type/override.rb b/lib/axlsx/content_type/override.rb index 01baa2f5..39303e80 100644 --- a/lib/axlsx/content_type/override.rb +++ b/lib/axlsx/content_type/override.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # An override content part. These parts are automatically created by for you based on the content of your package. diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb index c7df1fcb..64a193cf 100644 --- a/lib/axlsx/doc_props/app.rb +++ b/lib/axlsx/doc_props/app.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # App represents the app.xml document. The attributes for this object are primarily managed by the application the end user uses to edit the document. None of the attributes are required to serialize a valid xlsx object. diff --git a/lib/axlsx/doc_props/core.rb b/lib/axlsx/doc_props/core.rb index e0025f12..541fa1ad 100644 --- a/lib/axlsx/doc_props/core.rb +++ b/lib/axlsx/doc_props/core.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The core object for the package. diff --git a/lib/axlsx/drawing/area_chart.rb b/lib/axlsx/drawing/area_chart.rb index 2002840c..1834292c 100644 --- a/lib/axlsx/drawing/area_chart.rb +++ b/lib/axlsx/drawing/area_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The AreaChart is a two dimentional line chart (who would have guessed?) that you can add to your worksheet. diff --git a/lib/axlsx/drawing/area_series.rb b/lib/axlsx/drawing/area_series.rb index c039869e..a168bb07 100644 --- a/lib/axlsx/drawing/area_series.rb +++ b/lib/axlsx/drawing/area_series.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A AreaSeries defines the title, data and labels for line charts # @note The recommended way to manage series is to use Chart#add_series diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index e4bcf9a4..eb9a0759 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # the access class defines common properties and values for a chart axis. diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index ae6c2007..33eac167 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Bar3DChart is a three dimentional barchart (who would have guessed?) that you can add to your worksheet. diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb index 67787361..e3260ca0 100644 --- a/lib/axlsx/drawing/bar_chart.rb +++ b/lib/axlsx/drawing/bar_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The BarChart is a two dimentional barchart that you can add to your worksheet. diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb index 0e5d1168..344d3fd8 100644 --- a/lib/axlsx/drawing/bar_series.rb +++ b/lib/axlsx/drawing/bar_series.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A BarSeries defines the title, data and labels for bar charts # @note The recommended way to manage series is to use Chart#add_series diff --git a/lib/axlsx/drawing/bubble_chart.rb b/lib/axlsx/drawing/bubble_chart.rb index e08e6f7c..3f9745f1 100644 --- a/lib/axlsx/drawing/bubble_chart.rb +++ b/lib/axlsx/drawing/bubble_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The BubbleChart allows you to insert a bubble chart into your worksheet diff --git a/lib/axlsx/drawing/bubble_series.rb b/lib/axlsx/drawing/bubble_series.rb index 07b7be61..4fdf86ad 100644 --- a/lib/axlsx/drawing/bubble_series.rb +++ b/lib/axlsx/drawing/bubble_series.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A BubbleSeries defines the x/y position and bubble size of data in the chart diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index 6091b972..0751c827 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx #A CatAxis object defines a chart category axis class CatAxis < Axis diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index 500353cf..45a9113d 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A Chart is the superclass for specific charts diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index e9da37a5..33d38cef 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx require 'axlsx/drawing/d_lbls.rb' require 'axlsx/drawing/title.rb' diff --git a/lib/axlsx/drawing/graphic_frame.rb b/lib/axlsx/drawing/graphic_frame.rb index d44415b9..93216e79 100644 --- a/lib/axlsx/drawing/graphic_frame.rb +++ b/lib/axlsx/drawing/graphic_frame.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A graphic frame defines a container for a chart object # @note The recommended way to manage charts is Worksheet#add_chart diff --git a/lib/axlsx/drawing/hyperlink.rb b/lib/axlsx/drawing/hyperlink.rb index fcabd25b..407e701c 100644 --- a/lib/axlsx/drawing/hyperlink.rb +++ b/lib/axlsx/drawing/hyperlink.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # a hyperlink object adds an action to an image when clicked so that when the image is clicked the link is fecthed. # @note using the hyperlink option when calling add_image on a drawing object is the recommended way to manage hyperlinks diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index 4132655e..57186c2f 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Line3DChart is a three dimentional line chart (who would have guessed?) that you can add to your worksheet. diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb index a86355d5..e1ded225 100644 --- a/lib/axlsx/drawing/line_chart.rb +++ b/lib/axlsx/drawing/line_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The LineChart is a two dimentional line chart (who would have guessed?) that you can add to your worksheet. diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb index 666e67c8..e3c1fa90 100644 --- a/lib/axlsx/drawing/line_series.rb +++ b/lib/axlsx/drawing/line_series.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A LineSeries defines the title, data and labels for line charts # @note The recommended way to manage series is to use Chart#add_series diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index 75876fa3..7307fcc9 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Marker class defines a point in the worksheet that drawing anchors attach to. # @note The recommended way to manage markers is Worksheet#add_chart Markers are created for a two cell anchor based on the :start and :end options. diff --git a/lib/axlsx/drawing/num_data.rb b/lib/axlsx/drawing/num_data.rb index 9b7a2587..27929ee3 100644 --- a/lib/axlsx/drawing/num_data.rb +++ b/lib/axlsx/drawing/num_data.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- module Axlsx #This class specifies data for a particular data point. It is used for both numCache and numLit object diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb index b430c4b6..3b795f21 100644 --- a/lib/axlsx/drawing/num_val.rb +++ b/lib/axlsx/drawing/num_val.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- module Axlsx #This class specifies data for a particular data point. diff --git a/lib/axlsx/drawing/one_cell_anchor.rb b/lib/axlsx/drawing/one_cell_anchor.rb index ffa10a7d..fc3dc48c 100644 --- a/lib/axlsx/drawing/one_cell_anchor.rb +++ b/lib/axlsx/drawing/one_cell_anchor.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # This class details a single cell anchor for drawings. # @note The recommended way to manage drawings, images and charts is Worksheet#add_chart or Worksheet#add_image. diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index e8d0ebd7..385819cb 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # a Pic object represents an image in your worksheet # Worksheet#add_image is the recommended way to manage images in your sheets diff --git a/lib/axlsx/drawing/picture_locking.rb b/lib/axlsx/drawing/picture_locking.rb index d97fb6c2..a9cb5032 100644 --- a/lib/axlsx/drawing/picture_locking.rb +++ b/lib/axlsx/drawing/picture_locking.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The picture locking class defines the locking properties for pictures in your workbook. class PictureLocking diff --git a/lib/axlsx/drawing/pie_3D_chart.rb b/lib/axlsx/drawing/pie_3D_chart.rb index f87e6d4e..3b1e0c5c 100644 --- a/lib/axlsx/drawing/pie_3D_chart.rb +++ b/lib/axlsx/drawing/pie_3D_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx diff --git a/lib/axlsx/drawing/pie_series.rb b/lib/axlsx/drawing/pie_series.rb index fd18ed6a..10755350 100644 --- a/lib/axlsx/drawing/pie_series.rb +++ b/lib/axlsx/drawing/pie_series.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A PieSeries defines the data and labels and explosion for pie charts series. diff --git a/lib/axlsx/drawing/scaling.rb b/lib/axlsx/drawing/scaling.rb index 4c9d6888..9d1ed53e 100644 --- a/lib/axlsx/drawing/scaling.rb +++ b/lib/axlsx/drawing/scaling.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Scaling class defines axis scaling class Scaling diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb index f3df1b3e..2050cb33 100644 --- a/lib/axlsx/drawing/scatter_chart.rb +++ b/lib/axlsx/drawing/scatter_chart.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The ScatterChart allows you to insert a scatter chart into your worksheet diff --git a/lib/axlsx/drawing/scatter_series.rb b/lib/axlsx/drawing/scatter_series.rb index 8158c373..6b65a07b 100644 --- a/lib/axlsx/drawing/scatter_series.rb +++ b/lib/axlsx/drawing/scatter_series.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A ScatterSeries defines the x and y position of data in the chart diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb index fd7f7602..3150adaa 100644 --- a/lib/axlsx/drawing/ser_axis.rb +++ b/lib/axlsx/drawing/ser_axis.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx #A SerAxis object defines a series axis class SerAxis < Axis diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb index 0218f5ce..9404b959 100644 --- a/lib/axlsx/drawing/series.rb +++ b/lib/axlsx/drawing/series.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A Series defines the common series attributes and is the super class for all concrete series types. # @note The recommended way to manage series is to use Chart#add_series diff --git a/lib/axlsx/drawing/series_title.rb b/lib/axlsx/drawing/series_title.rb index 2e730dea..4f58ef4a 100644 --- a/lib/axlsx/drawing/series_title.rb +++ b/lib/axlsx/drawing/series_title.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A series title is a Title with a slightly different serialization than chart titles. class SeriesTitle < Title diff --git a/lib/axlsx/drawing/str_data.rb b/lib/axlsx/drawing/str_data.rb index 4da69ec0..297986d1 100644 --- a/lib/axlsx/drawing/str_data.rb +++ b/lib/axlsx/drawing/str_data.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- module Axlsx #This specifies the last string data used for a chart. (e.g. strLit and strCache) diff --git a/lib/axlsx/drawing/str_val.rb b/lib/axlsx/drawing/str_val.rb index 0687833e..00152bef 100644 --- a/lib/axlsx/drawing/str_val.rb +++ b/lib/axlsx/drawing/str_val.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- module Axlsx #This class specifies data for a particular data point. diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index 88c2f92c..f62422f9 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A Title stores information about the title of a chart class Title diff --git a/lib/axlsx/drawing/two_cell_anchor.rb b/lib/axlsx/drawing/two_cell_anchor.rb index d422c0ce..81a5ca93 100644 --- a/lib/axlsx/drawing/two_cell_anchor.rb +++ b/lib/axlsx/drawing/two_cell_anchor.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # This class details the anchor points for drawings. # @note The recommended way to manage drawings and charts is Worksheet#add_chart. Anchors are specified by the :start_at and :end_at options to that method. diff --git a/lib/axlsx/drawing/val_axis.rb b/lib/axlsx/drawing/val_axis.rb index 430cf70f..b205e1c8 100644 --- a/lib/axlsx/drawing/val_axis.rb +++ b/lib/axlsx/drawing/val_axis.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # the ValAxis class defines a chart value axis. class ValAxis < Axis diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index cfb44166..0424baac 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # 3D attributes for a chart. class View3D diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 613c92de..acd55586 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 module Axlsx # Package is responsible for managing all the bits and peices that Open Office XML requires to make a valid # xlsx document including validation and serialization. diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index dc7c5307..f5bda412 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A relationship defines a reference between package parts. # @note Packages automatically manage relationships. diff --git a/lib/axlsx/rels/relationships.rb b/lib/axlsx/rels/relationships.rb index 5d07f612..5e542e2c 100644 --- a/lib/axlsx/rels/relationships.rb +++ b/lib/axlsx/rels/relationships.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx require 'axlsx/rels/relationship.rb' diff --git a/lib/axlsx/stylesheet/border.rb b/lib/axlsx/stylesheet/border.rb index 0a823c7a..bf342c7f 100644 --- a/lib/axlsx/stylesheet/border.rb +++ b/lib/axlsx/stylesheet/border.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # This class details a border used in Office Open XML spreadsheet styles. class Border diff --git a/lib/axlsx/stylesheet/border_pr.rb b/lib/axlsx/stylesheet/border_pr.rb index cba0e475..7c32af13 100644 --- a/lib/axlsx/stylesheet/border_pr.rb +++ b/lib/axlsx/stylesheet/border_pr.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A border part. class BorderPr diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb index f1675141..8f93f4d7 100644 --- a/lib/axlsx/stylesheet/cell_alignment.rb +++ b/lib/axlsx/stylesheet/cell_alignment.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx diff --git a/lib/axlsx/stylesheet/cell_protection.rb b/lib/axlsx/stylesheet/cell_protection.rb index ac32cb96..94648de3 100644 --- a/lib/axlsx/stylesheet/cell_protection.rb +++ b/lib/axlsx/stylesheet/cell_protection.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # CellProtection stores information about locking or hiding cells in spreadsheet. # @note Using Styles#add_style is the recommended way to manage cell protection. diff --git a/lib/axlsx/stylesheet/cell_style.rb b/lib/axlsx/stylesheet/cell_style.rb index 2e8da880..e1d4e0ff 100644 --- a/lib/axlsx/stylesheet/cell_style.rb +++ b/lib/axlsx/stylesheet/cell_style.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # CellStyle defines named styles that reference defined formatting records and can be used in your worksheet. # @note Using Styles#add_style is the recommended way to manage cell styling. diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index 2b6c126f..32f18063 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The color class represents a color used for borders, fills an fonts class Color diff --git a/lib/axlsx/stylesheet/dxf.rb b/lib/axlsx/stylesheet/dxf.rb index 758b0869..b5423b2a 100644 --- a/lib/axlsx/stylesheet/dxf.rb +++ b/lib/axlsx/stylesheet/dxf.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Dxf class defines an incremental formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style # @see Styles#add_style diff --git a/lib/axlsx/stylesheet/fill.rb b/lib/axlsx/stylesheet/fill.rb index 7bb5a437..4fa58aef 100644 --- a/lib/axlsx/stylesheet/fill.rb +++ b/lib/axlsx/stylesheet/fill.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Fill is a formatting object that manages the background color, and pattern for cells. # @note The recommended way to manage styles in your workbook is to use Styles#add_style. diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index 48d2b584..8a52c810 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Font class details a font instance for use in styling cells. # @note The recommended way to manage fonts, and other styles is Styles#add_style diff --git a/lib/axlsx/stylesheet/gradient_fill.rb b/lib/axlsx/stylesheet/gradient_fill.rb index b077d497..46098b53 100644 --- a/lib/axlsx/stylesheet/gradient_fill.rb +++ b/lib/axlsx/stylesheet/gradient_fill.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A GradientFill defines the color and positioning for gradiant cell fill. # @see Open Office XML Part 1 §18.8.24 diff --git a/lib/axlsx/stylesheet/gradient_stop.rb b/lib/axlsx/stylesheet/gradient_stop.rb index a76da6a6..63778b58 100644 --- a/lib/axlsx/stylesheet/gradient_stop.rb +++ b/lib/axlsx/stylesheet/gradient_stop.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The GradientStop object represents a color point in a gradient. # @see Open Office XML Part 1 §18.8.24 diff --git a/lib/axlsx/stylesheet/num_fmt.rb b/lib/axlsx/stylesheet/num_fmt.rb index 1072d18a..3f99d8d4 100644 --- a/lib/axlsx/stylesheet/num_fmt.rb +++ b/lib/axlsx/stylesheet/num_fmt.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A NumFmt object defines an identifier and formatting code for data in cells. # @note The recommended way to manage styles is Styles#add_style diff --git a/lib/axlsx/stylesheet/pattern_fill.rb b/lib/axlsx/stylesheet/pattern_fill.rb index 059f15bb..96614ecd 100644 --- a/lib/axlsx/stylesheet/pattern_fill.rb +++ b/lib/axlsx/stylesheet/pattern_fill.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A PatternFill is the pattern and solid fill styling for a cell. # @note The recommended way to manage styles is with Styles#add_style diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index 188f0960..72706e3b 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx require 'axlsx/stylesheet/border.rb' require 'axlsx/stylesheet/border_pr.rb' diff --git a/lib/axlsx/stylesheet/table_style.rb b/lib/axlsx/stylesheet/table_style.rb index d330beb2..6be6a9a2 100644 --- a/lib/axlsx/stylesheet/table_style.rb +++ b/lib/axlsx/stylesheet/table_style.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A single table style definition and is a collection for tableStyleElements # @note Table are not supported in this version and only the defaults required for a valid workbook are created. diff --git a/lib/axlsx/stylesheet/table_style_element.rb b/lib/axlsx/stylesheet/table_style_element.rb index 593c5950..1b7b3db9 100644 --- a/lib/axlsx/stylesheet/table_style_element.rb +++ b/lib/axlsx/stylesheet/table_style_element.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # an element of style that belongs to a table style. # @note tables and table styles are not supported in this version. This class exists in preparation for that support. diff --git a/lib/axlsx/stylesheet/table_styles.rb b/lib/axlsx/stylesheet/table_styles.rb index 6ef07c51..f6c6a415 100644 --- a/lib/axlsx/stylesheet/table_styles.rb +++ b/lib/axlsx/stylesheet/table_styles.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # TableStyles represents a collection of style definitions for table styles and pivot table styles. # @note Support for custom table styles does not exist in this version. Many of the classes required are defined in preparation for future release. Please do not attempt to add custom table styles. diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb index 0633da7d..3eb3da06 100644 --- a/lib/axlsx/stylesheet/xf.rb +++ b/lib/axlsx/stylesheet/xf.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Xf class defines a formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style # @see Styles#add_style diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 5f5dbffa..ac8b1679 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A SimpleTypedList is a type restrictive collection that allows some of the methods from Array and supports basic xml serialization. diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb index b3815dbb..dc6cc491 100644 --- a/lib/axlsx/util/storage.rb +++ b/lib/axlsx/util/storage.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Storage class represents a storage object or stream in a compound file. diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index f1bf0ffc..01aef03c 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # Validate a value against a specific list of allowed values. class RestrictionValidator diff --git a/lib/axlsx/util/zip_command.rb b/lib/axlsx/util/zip_command.rb index fb336209..e83b44b0 100644 --- a/lib/axlsx/util/zip_command.rb +++ b/lib/axlsx/util/zip_command.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'open3' require 'shellwords' diff --git a/lib/axlsx/workbook/shared_strings_table.rb b/lib/axlsx/workbook/shared_strings_table.rb index 7e9402b2..bae33d9a 100644 --- a/lib/axlsx/workbook/shared_strings_table.rb +++ b/lib/axlsx/workbook/shared_strings_table.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Shared String Table class is responsible for managing and serializing common strings in a workbook. diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index 938d4aee..9797cb09 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- module Axlsx require 'axlsx/workbook/worksheet/sheet_calc_pr.rb' require 'axlsx/workbook/worksheet/auto_filter/auto_filter.rb' diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb index 2830eaff..ef4e5aea 100644 --- a/lib/axlsx/workbook/worksheet/border_creator.rb +++ b/lib/axlsx/workbook/worksheet/border_creator.rb @@ -1,5 +1,3 @@ -# encoding: UTF-8 - module Axlsx class BorderCreator def initialize(worksheet:, cells:, edges: nil, style: nil, color: nil) diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 301ce22f..59b0b300 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'cgi' module Axlsx # A cell in a worksheet. diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index 3b3775c4..ff4c67b9 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The Col class defines column attributes for columns in sheets. diff --git a/lib/axlsx/workbook/worksheet/comments.rb b/lib/axlsx/workbook/worksheet/comments.rb index dfc6d143..72281f58 100644 --- a/lib/axlsx/workbook/worksheet/comments.rb +++ b/lib/axlsx/workbook/worksheet/comments.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- module Axlsx # Comments is a collection of Comment objects for a worksheet diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb index 13374bc4..a3959fe5 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- module Axlsx # Conditional formatting rules specify formulas whose evaluations # format cells diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb index 71f9bbe6..94a9e0c9 100644 --- a/lib/axlsx/workbook/worksheet/data_validation.rb +++ b/lib/axlsx/workbook/worksheet/data_validation.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # Data validation allows the validation of cell data # diff --git a/lib/axlsx/workbook/worksheet/date_time_converter.rb b/lib/axlsx/workbook/worksheet/date_time_converter.rb index 44f9fec4..74199f2d 100644 --- a/lib/axlsx/workbook/worksheet/date_time_converter.rb +++ b/lib/axlsx/workbook/worksheet/date_time_converter.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require "date" module Axlsx diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb index 455665a5..1a3682af 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # Table # @note Worksheet#add_pivot_table is the recommended way to create tables for your worksheets. diff --git a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb index 969b0bf2..b0e764ca 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # Table # @note Worksheet#add_pivot_table is the recommended way to create tables for your worksheets. diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index 62ceb59c..4c8c27b7 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # A Row is a single row in a worksheet. # @note The recommended way to manage rows and cells is to use Worksheet#add_row diff --git a/lib/axlsx/workbook/worksheet/selection.rb b/lib/axlsx/workbook/worksheet/selection.rb index 753b3a35..4c02d286 100644 --- a/lib/axlsx/workbook/worksheet/selection.rb +++ b/lib/axlsx/workbook/worksheet/selection.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # Selection options for worksheet panes. # diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index b7aa56b6..9e27c8d8 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # The SheetProtection object manages worksheet protection options per sheet. diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index f7b0f7bf..e6e114d7 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # View options for a worksheet. # diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb index 881f12e7..e660d26c 100644 --- a/lib/axlsx/workbook/worksheet/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 module Axlsx # Table # @note Worksheet#add_table is the recommended way to create tables for your worksheets. diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index dca483dc..cb176455 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -1,5 +1,3 @@ -# encoding: UTF-8 - require_relative "border_creator" module Axlsx diff --git a/lib/caxlsx.rb b/lib/caxlsx.rb index a82d49fb..047ed28f 100644 --- a/lib/caxlsx.rb +++ b/lib/caxlsx.rb @@ -1,2 +1 @@ -# encoding: UTF-8 require 'axlsx.rb' diff --git a/test/content_type/tc_content_type.rb b/test/content_type/tc_content_type.rb index e0dd0a5e..60fa9c76 100644 --- a/test/content_type/tc_content_type.rb +++ b/test/content_type/tc_content_type.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'tc_helper.rb' class TestContentType < Test::Unit::TestCase diff --git a/test/content_type/tc_default.rb b/test/content_type/tc_default.rb index d765a904..b6c040ac 100644 --- a/test/content_type/tc_default.rb +++ b/test/content_type/tc_default.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'tc_helper.rb' class TestDefault < Test::Unit::TestCase diff --git a/test/tc_package.rb b/test/tc_package.rb index 0788d029..f7de1992 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'tc_helper.rb' require 'support/capture_warnings' diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 3263371a..1d55aca3 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'tc_helper.rb' require 'support/capture_warnings' diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index 1bdee04b..d6b3fed2 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- require 'tc_helper.rb' class TestDateTimeConverter < Test::Unit::TestCase diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb index 3b040778..13795668 100644 --- a/test/workbook/worksheet/tc_pane.rb +++ b/test/workbook/worksheet/tc_pane.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../" require 'tc_helper.rb' diff --git a/test/workbook/worksheet/tc_protected_range.rb b/test/workbook/worksheet/tc_protected_range.rb index 4ae942b3..52d07d77 100644 --- a/test/workbook/worksheet/tc_protected_range.rb +++ b/test/workbook/worksheet/tc_protected_range.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'tc_helper.rb' class TestProtectedRange < Test::Unit::TestCase def setup diff --git a/test/workbook/worksheet/tc_selection.rb b/test/workbook/worksheet/tc_selection.rb index 696b67eb..5f65adcd 100644 --- a/test/workbook/worksheet/tc_selection.rb +++ b/test/workbook/worksheet/tc_selection.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'tc_helper.rb' class TestSelection < Test::Unit::TestCase diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb index cf3b8957..78969d34 100644 --- a/test/workbook/worksheet/tc_sheet_protection.rb +++ b/test/workbook/worksheet/tc_sheet_protection.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'tc_helper.rb' # diff --git a/test/workbook/worksheet/tc_sheet_view.rb b/test/workbook/worksheet/tc_sheet_view.rb index 3a8e0a06..4481f127 100644 --- a/test/workbook/worksheet/tc_sheet_view.rb +++ b/test/workbook/worksheet/tc_sheet_view.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../" require 'tc_helper.rb' -- cgit v1.2.3 From 9b246ec6395d49f09ab85ce0a2c024bf8d086d0c Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:31:03 +0200 Subject: Fix Layout/InitialIndentation offense ``` rubocop --only Layout/InitialIndentation -a ``` --- test/drawing/tc_data_source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/drawing/tc_data_source.rb b/test/drawing/tc_data_source.rb index e9bed095..9ec260d8 100644 --- a/test/drawing/tc_data_source.rb +++ b/test/drawing/tc_data_source.rb @@ -1,4 +1,4 @@ - require 'tc_helper.rb' +require 'tc_helper.rb' class TestNumDataSource < Test::Unit::TestCase -- cgit v1.2.3 From b5d7a7a1917adb12e3ea04abe261a37f8aff7f56 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:34:58 +0200 Subject: Fix Layout/EmptyLines offenses ``` rubocop --only Layout/EmptyLines -a ``` --- Rakefile | 1 - lib/axlsx/drawing/bar_series.rb | 1 - lib/axlsx/drawing/cat_axis.rb | 1 - lib/axlsx/drawing/d_lbls.rb | 2 -- lib/axlsx/drawing/drawing.rb | 1 - lib/axlsx/drawing/line_3D_chart.rb | 1 - lib/axlsx/drawing/marker.rb | 1 - lib/axlsx/drawing/num_data_source.rb | 1 - lib/axlsx/drawing/pie_3D_chart.rb | 1 - lib/axlsx/drawing/ser_axis.rb | 1 - lib/axlsx/package.rb | 4 ---- lib/axlsx/stylesheet/cell_alignment.rb | 4 ---- lib/axlsx/stylesheet/fill.rb | 1 - lib/axlsx/stylesheet/xf.rb | 1 - lib/axlsx/util/accessors.rb | 1 - lib/axlsx/util/constants.rb | 1 - lib/axlsx/util/simple_typed_list.rb | 2 -- lib/axlsx/util/validators.rb | 1 - lib/axlsx/workbook/workbook.rb | 6 ------ lib/axlsx/workbook/workbook_view.rb | 3 --- lib/axlsx/workbook/worksheet/auto_filter/filters.rb | 2 -- lib/axlsx/workbook/worksheet/color_scale.rb | 1 - lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb | 2 -- lib/axlsx/workbook/worksheet/data_validation.rb | 1 - lib/axlsx/workbook/worksheet/page_setup.rb | 2 -- lib/axlsx/workbook/worksheet/pane.rb | 1 - lib/axlsx/workbook/worksheet/pivot_table.rb | 1 - lib/axlsx/workbook/worksheet/sheet_view.rb | 5 ----- lib/axlsx/workbook/worksheet/worksheet.rb | 2 -- lib/axlsx/workbook/worksheet/worksheet_comments.rb | 1 - test/drawing/tc_axis.rb | 1 - test/drawing/tc_hyperlink.rb | 1 - test/drawing/tc_line_3d_chart.rb | 1 - test/drawing/tc_picture_locking.rb | 3 --- test/drawing/tc_scaling.rb | 1 - test/drawing/tc_ser_axis.rb | 2 -- test/drawing/tc_view_3D.rb | 3 --- test/stylesheet/tc_color.rb | 1 - test/stylesheet/tc_font.rb | 3 --- test/stylesheet/tc_gradient_fill.rb | 1 - test/stylesheet/tc_gradient_stop.rb | 1 - test/stylesheet/tc_num_fmt.rb | 1 - test/stylesheet/tc_pattern_fill.rb | 1 - test/stylesheet/tc_styles.rb | 1 - test/tc_axlsx.rb | 1 - test/tc_package.rb | 1 - test/workbook/worksheet/auto_filter/tc_filter_column.rb | 3 --- test/workbook/worksheet/tc_border_creator.rb | 1 - test/workbook/worksheet/tc_break.rb | 1 - test/workbook/worksheet/tc_conditional_formatting.rb | 1 - test/workbook/worksheet/tc_data_bar.rb | 1 - test/workbook/worksheet/tc_page_margins.rb | 1 - test/workbook/worksheet/tc_page_setup.rb | 1 - test/workbook/worksheet/tc_pane.rb | 1 - test/workbook/worksheet/tc_pivot_table.rb | 1 - test/workbook/worksheet/tc_row.rb | 1 - test/workbook/worksheet/tc_sheet_pr.rb | 1 - test/workbook/worksheet/tc_sheet_view.rb | 1 - test/workbook/worksheet/tc_table_style_info.rb | 1 - test/workbook/worksheet/tc_worksheet.rb | 5 ----- 60 files changed, 96 deletions(-) diff --git a/Rakefile b/Rakefile index aa71e48e..dd31d33d 100644 --- a/Rakefile +++ b/Rakefile @@ -13,7 +13,6 @@ task :gendoc do system "yard stats --list-undoc" end - require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'test' diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb index 344d3fd8..e90a2818 100644 --- a/lib/axlsx/drawing/bar_series.rb +++ b/lib/axlsx/drawing/bar_series.rb @@ -5,7 +5,6 @@ module Axlsx # @see Chart#add_series class BarSeries < Series - # The data for this series. # @return [NumDataSource] attr_reader :data diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index 0751c827..6e61d336 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -80,5 +80,4 @@ module Axlsx end - end diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index 0c8185f0..8623fd8a 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -65,7 +65,6 @@ module Axlsx @d_lbl_pos = label_position end - # serializes the data labels # @return [String] def to_xml_string(str = '') @@ -86,6 +85,5 @@ module Axlsx @show_leader_lines = nil end - end end diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index 33d38cef..87937d72 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -76,7 +76,6 @@ module Axlsx @anchors = SimpleTypedList.new [TwoCellAnchor, OneCellAnchor] end - # Adds an image to the chart If th end_at option is specified we create a two cell anchor. By default we use a one cell anchor. # @note The recommended way to manage images is to use Worksheet.add_image. Please refer to that method for documentation. # @see Worksheet#add_image diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index 57186c2f..8816d2e7 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -47,7 +47,6 @@ module Axlsx axes.add_axis :ser_axis, SerAxis end - # @see gapDepth def gap_depth=(v) RegexValidator.validate "Line3DChart.gapWidth", GAP_AMOUNT_PERCENT, v diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index 7307fcc9..7ef77f21 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -77,7 +77,6 @@ module Axlsx [x, y] end - end end diff --git a/lib/axlsx/drawing/num_data_source.rb b/lib/axlsx/drawing/num_data_source.rb index 24bb9c4d..028b75d2 100644 --- a/lib/axlsx/drawing/num_data_source.rb +++ b/lib/axlsx/drawing/num_data_source.rb @@ -22,7 +22,6 @@ module Axlsx parse_options options end - # The tag name to use when serializing this data source. # Only items defined in allowed_tag_names are allowed # @return [Symbol] diff --git a/lib/axlsx/drawing/pie_3D_chart.rb b/lib/axlsx/drawing/pie_3D_chart.rb index 3b1e0c5c..e06e8d57 100644 --- a/lib/axlsx/drawing/pie_3D_chart.rb +++ b/lib/axlsx/drawing/pie_3D_chart.rb @@ -1,6 +1,5 @@ module Axlsx - # The Pie3DChart is a three dimentional piechart (who would have guessed?) that you can add to your worksheet. # @see Worksheet#add_chart # @see Chart#add_series diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb index 3150adaa..805e4244 100644 --- a/lib/axlsx/drawing/ser_axis.rb +++ b/lib/axlsx/drawing/ser_axis.rb @@ -40,5 +40,4 @@ module Axlsx end end - end diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index acd55586..e866444b 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -35,8 +35,6 @@ module Axlsx workbook.use_autowidth = v end - - # Shortcut to determine if the workbook is configured to use shared strings # @see Workbook#use_shared_strings def use_shared_strings @@ -120,7 +118,6 @@ module Axlsx Relationship.clear_ids_cache end - # Serialize your workbook to a StringIO instance # @param [Boolean] confirm_valid Validate the package prior to serialization. # @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not. @@ -225,7 +222,6 @@ module Axlsx parts << {:entry => "xl/#{drawing.pn}", :doc => drawing, :schema => DRAWING_XSD} end - workbook.tables.each do |table| parts << {:entry => "xl/#{table.pn}", :doc => table, :schema => SML_XSD} end diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb index 8f93f4d7..45fe0e7d 100644 --- a/lib/axlsx/stylesheet/cell_alignment.rb +++ b/lib/axlsx/stylesheet/cell_alignment.rb @@ -1,12 +1,10 @@ module Axlsx - # CellAlignment stores information about the cell alignment of a style Xf Object. # @note Using Styles#add_style is the recommended way to manage cell alignment. # @see Styles#add_style class CellAlignment - include Axlsx::SerializedAttributes include Axlsx::OptionsParser @@ -25,8 +23,6 @@ module Axlsx parse_options options end - - # The horizontal alignment of the cell. # @note # The horizontal cell alignement style must be one of diff --git a/lib/axlsx/stylesheet/fill.rb b/lib/axlsx/stylesheet/fill.rb index 4fa58aef..9b124e8d 100644 --- a/lib/axlsx/stylesheet/fill.rb +++ b/lib/axlsx/stylesheet/fill.rb @@ -29,6 +29,5 @@ module Axlsx # @see fill_type def fill_type=(v) DataTypeValidator.validate "Fill.fill_type", [PatternFill, GradientFill], v; @fill_type = v; end - end end diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb index 3eb3da06..9aaba6fa 100644 --- a/lib/axlsx/stylesheet/xf.rb +++ b/lib/axlsx/stylesheet/xf.rb @@ -141,6 +141,5 @@ module Axlsx str << '' end - end end diff --git a/lib/axlsx/util/accessors.rb b/lib/axlsx/util/accessors.rb index d21388a0..3eab1d39 100644 --- a/lib/axlsx/util/accessors.rb +++ b/lib/axlsx/util/accessors.rb @@ -22,7 +22,6 @@ module Axlsx validated_attr_accessor(symbols, :validate_string) end - # Creates one or more usigned integer attr_accessors # @param [Array] symbols An array of symbols representing the # names of the attributes you will add to your class diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb index 2284a8e3..7e26c478 100644 --- a/lib/axlsx/util/constants.rb +++ b/lib/axlsx/util/constants.rb @@ -162,7 +162,6 @@ module Axlsx #drawing content type DRAWING_CT = "application/vnd.openxmlformats-officedocument.drawing+xml".freeze - # xml content type extensions XML_EX = "xml".freeze diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index ac8b1679..5a15ddff 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -99,7 +99,6 @@ module Axlsx alias :push :<< - # delete the item from the list # @param [Any] v The item to be deleted. # @raise [ArgumentError] if the item's index is protected by locking @@ -174,5 +173,4 @@ module Axlsx end - end diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 01aef03c..9e3d0de1 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -62,7 +62,6 @@ module Axlsx end end - # Requires that the value can be converted to an integer # @para, [Any] v the value to validate # @raise [ArgumentError] raised if the value cannot be converted to an integer diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index 9797cb09..b5d229e1 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -42,7 +42,6 @@ require 'axlsx/workbook/worksheet/col_breaks' require 'axlsx/workbook/workbook_view' require 'axlsx/workbook/workbook_views' - require 'axlsx/workbook/worksheet/worksheet.rb' require 'axlsx/workbook/shared_strings_table.rb' require 'axlsx/workbook/defined_name.rb' @@ -108,7 +107,6 @@ require 'axlsx/workbook/worksheet/selection.rb' @is_reversed = v end - # A collection of worksheets associated with this workbook. # @note The recommended way to manage worksheets is add_worksheet # @see Workbook#add_worksheet @@ -139,7 +137,6 @@ require 'axlsx/workbook/worksheet/selection.rb' # pretty sure this two are always empty and can be removed. - # A colllection of tables associated with this workbook # @note The recommended way to manage drawings is Worksheet#add_table # @see Worksheet#add_table @@ -216,11 +213,9 @@ require 'axlsx/workbook/worksheet/selection.rb' self.styles_applied = true end - # Indicates if the epoc date for serialization should be 1904. If false, 1900 is used. @@date1904 = false - # A quick helper to retrive a worksheet by name # @param [String] name The name of the sheet you are looking for # @return [Worksheet] The sheet found, or nil @@ -243,7 +238,6 @@ require 'axlsx/workbook/worksheet/selection.rb' @pivot_tables = SimpleTypedList.new PivotTable @comments = SimpleTypedList.new Comments - @use_autowidth = true @bold_font_multiplier = BOLD_FONT_MULTIPLIER @font_scale_divisor = FONT_SCALE_DIVISOR diff --git a/lib/axlsx/workbook/workbook_view.rb b/lib/axlsx/workbook/workbook_view.rb index e0d38cae..b81fd4f4 100644 --- a/lib/axlsx/workbook/workbook_view.rb +++ b/lib/axlsx/workbook/workbook_view.rb @@ -31,7 +31,6 @@ module Axlsx include Axlsx::OptionsParser include Axlsx::Accessors - # Creates a new BookView object # @param [Hash] options A hash of key/value pairs that will be mapped to this instances attributes. # @option [Symbol] visibility Specifies visible state of the workbook window. The default value for this attribute is :visible. @@ -52,7 +51,6 @@ module Axlsx yield self if block_given? end - unsigned_int_attr_accessor :x_window, :y_window, :window_width, :window_height, :tab_ratio, :first_sheet, :active_tab @@ -67,7 +65,6 @@ module Axlsx boolean_attr_accessor :minimized, :show_horizontal_scroll, :show_vertical_scroll, :show_sheet_tabs, :auto_filter_date_grouping - # Serialize the WorkbookView # @param [String] str # @return [String] diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index 215b66fe..11356c0a 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -113,7 +113,6 @@ module Axlsx @val = value end - #Filter value used in the criteria. attr_accessor :val @@ -124,7 +123,6 @@ module Axlsx end end - # This collection is used to express a group of dates or times which are # used in an AutoFilter criteria. Values are always written in the calendar # type of the first date encountered in the filter range, so that all diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb index 127b3e96..dc347a6a 100644 --- a/lib/axlsx/workbook/worksheet/color_scale.rb +++ b/lib/axlsx/workbook/worksheet/color_scale.rb @@ -73,7 +73,6 @@ module Axlsx {:cfvo => value_objects.last, :color => colors.last} end - # removes the cfvo and color pair at the index specified. # @param [Integer] index The index of the cfvo and color object to delete # @note you cannot remove the first two cfvo and color pairs diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb index a3959fe5..8fa0c5b5 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb @@ -132,7 +132,6 @@ module Axlsx # thisMonth, lastMonth, nextMonth, thisWeek, lastWeek, nextWeek attr_reader :timePeriod - # colorScale (Color Scale) # The color scale to apply to this conditional formatting # @return [ColorScale] @@ -201,7 +200,6 @@ module Axlsx @icon_set = v end - # Serializes the conditional formatting rule # @param [String] str # @return [String] diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb index 94a9e0c9..194c9a27 100644 --- a/lib/axlsx/workbook/worksheet/data_validation.rb +++ b/lib/axlsx/workbook/worksheet/data_validation.rb @@ -175,7 +175,6 @@ module Axlsx # default none attr_reader :type - # @see formula1 def formula1=(v); Axlsx::validate_string(v); @formula1 = v end diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb index 9558579e..d7abcbc2 100644 --- a/lib/axlsx/workbook/worksheet/page_setup.rb +++ b/lib/axlsx/workbook/worksheet/page_setup.rb @@ -182,7 +182,6 @@ module Axlsx # @return [Integer] attr_reader :paper_size - # Sets the paper size for printing. # @see PageSetup#paper_size # @return integer @@ -221,7 +220,6 @@ module Axlsx [@fit_to_width, @fit_to_height] end - # helper method for worksheet to determine if the page setup is configured for fit to page printing # We treat any page set up that has a value set for fit_to_width or fit_to_height value as fit_to_page. # @return [Boolean] diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb index 321294da..9c8671e6 100644 --- a/lib/axlsx/workbook/worksheet/pane.rb +++ b/lib/axlsx/workbook/worksheet/pane.rb @@ -49,7 +49,6 @@ module Axlsx # default nil attr_reader :active_pane - # Split State # Indicates whether the pane has horizontal / vertical # splits, and whether those splits are frozen. diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb index 1a3682af..23d9828e 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table.rb @@ -91,7 +91,6 @@ module Axlsx # @return [Array] attr_reader :rows - # (see #rows) def rows=(v) DataTypeValidator.validate "#{self.class}.rows", [Array], v diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index e6e114d7..0ca87b3b 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -48,7 +48,6 @@ module Axlsx :zoom_scale_sheet_layout_view, :zoom_scale_page_layout_view, :zoom_scale_normal, :workbook_view_id, :view, :top_left_cell, :color_id, :zoom_scale - # instance values that must be serialized as their own elements - e.g. not attributes. CHILD_ELEMENTS = [ :pane, :selections ] @@ -85,7 +84,6 @@ module Axlsx # default nil attr_reader :top_left_cell - # View Type # Indicates the view type. # Options are @@ -117,7 +115,6 @@ module Axlsx # default 100 attr_reader :zoom_scale - # Zoom Scale Normal View # Zoom magnification to use when in normal view, # representing percent values. This attribute is @@ -130,7 +127,6 @@ module Axlsx # default 0 attr_reader :zoom_scale_normal - # Zoom Scale Page Layout View # Zoom magnification to use when in page layout # view, representing percent values. This attribute @@ -143,7 +139,6 @@ module Axlsx # default 0 attr_reader :zoom_scale_page_layout_view - # Zoom Scale Page Break Preview # Zoom magnification to use when in page break # preview, representing percent values. This diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index cb176455..9a9c4506 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -173,7 +173,6 @@ module Axlsx page_setup.fit_to_page? end - # Column info for the sheet # @return [SimpleTypedList] def column_info @@ -792,7 +791,6 @@ module Axlsx @merged_cells ||= MergedCells.new self end - # Helper method for parsingout the root node for worksheet # @return [String] def worksheet_node diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb index c6dd5545..e976ad5c 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb @@ -33,7 +33,6 @@ module Axlsx comments.relationships end - # Helper method to tell us if there are comments in the comments collection # @return [Boolean] def has_comments? diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb index 71e5b6b2..b8be916b 100644 --- a/test/drawing/tc_axis.rb +++ b/test/drawing/tc_axis.rb @@ -5,7 +5,6 @@ class TestAxis < Test::Unit::TestCase @axis = Axlsx::Axis.new :gridlines => false, :title => 'Foo' end - def test_initialization assert_equal(@axis.ax_pos, :b, "axis position default incorrect") assert_equal(@axis.tick_lbl_pos, :nextTo, "tick label position default incorrect") diff --git a/test/drawing/tc_hyperlink.rb b/test/drawing/tc_hyperlink.rb index 3a95886a..d4fd4e13 100644 --- a/test/drawing/tc_hyperlink.rb +++ b/test/drawing/tc_hyperlink.rb @@ -13,7 +13,6 @@ class TestHyperlink < Test::Unit::TestCase def teardown end - def test_href assert_nothing_raised { @hyperlink.href = "http://axlsx.blogspot.com" } assert_equal(@hyperlink.href, "http://axlsx.blogspot.com") diff --git a/test/drawing/tc_line_3d_chart.rb b/test/drawing/tc_line_3d_chart.rb index b419e00a..ea0748c7 100644 --- a/test/drawing/tc_line_3d_chart.rb +++ b/test/drawing/tc_line_3d_chart.rb @@ -32,7 +32,6 @@ class TestLine3DChart < Test::Unit::TestCase assert(@chart.gapDepth == "200%") end - def test_to_xml schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD)) doc = Nokogiri::XML(@chart.to_xml_string) diff --git a/test/drawing/tc_picture_locking.rb b/test/drawing/tc_picture_locking.rb index c0a828aa..794c8f6a 100644 --- a/test/drawing/tc_picture_locking.rb +++ b/test/drawing/tc_picture_locking.rb @@ -66,7 +66,4 @@ class TestPictureLocking < Test::Unit::TestCase assert_equal(@item.noChangeShapeType, false ) end - - - end diff --git a/test/drawing/tc_scaling.rb b/test/drawing/tc_scaling.rb index 01e21a5d..361f0b5d 100644 --- a/test/drawing/tc_scaling.rb +++ b/test/drawing/tc_scaling.rb @@ -22,7 +22,6 @@ class TestScaling < Test::Unit::TestCase assert_nothing_raised {@scaling.orientation = :maxMin} end - def test_max assert_raise(ArgumentError) { @scaling.max = 1} assert_nothing_raised {@scaling.max = 10.5} diff --git a/test/drawing/tc_ser_axis.rb b/test/drawing/tc_ser_axis.rb index 7febafce..342099cc 100644 --- a/test/drawing/tc_ser_axis.rb +++ b/test/drawing/tc_ser_axis.rb @@ -14,14 +14,12 @@ class TestSerAxis < Test::Unit::TestCase assert_equal(a.tick_mark_skip, 7) end - def test_tick_lbl_skip assert_raise(ArgumentError, "requires valid tick_lbl_skip") { @axis.tick_lbl_skip = -1 } assert_nothing_raised("accepts valid tick_lbl_skip") { @axis.tick_lbl_skip = 1 } assert_equal(@axis.tick_lbl_skip, 1) end - def test_tick_mark_skip assert_raise(ArgumentError, "requires valid tick_mark_skip") { @axis.tick_mark_skip = :my_eyes } assert_nothing_raised("accepts valid tick_mark_skip") { @axis.tick_mark_skip = 2 } diff --git a/test/drawing/tc_view_3D.rb b/test/drawing/tc_view_3D.rb index 5f6809ef..175428ca 100644 --- a/test/drawing/tc_view_3D.rb +++ b/test/drawing/tc_view_3D.rb @@ -38,7 +38,6 @@ class TestView3D < Test::Unit::TestCase assert_nothing_raised {@view.depth_percent = "20%"} end - def test_rAngAx assert_raise(ArgumentError) {@view.rAngAx = "bob"} assert_nothing_raised {@view.rAngAx = true} @@ -49,6 +48,4 @@ class TestView3D < Test::Unit::TestCase assert_nothing_raised {@view.perspective = 30} end - - end diff --git a/test/stylesheet/tc_color.rb b/test/stylesheet/tc_color.rb index dd8e98d2..660cc672 100644 --- a/test/stylesheet/tc_color.rb +++ b/test/stylesheet/tc_color.rb @@ -39,5 +39,4 @@ class TestColor < Test::Unit::TestCase assert_equal(@item.tint, -1.0 ) end - end diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb index 4d548d7c..58f84b08 100644 --- a/test/stylesheet/tc_font.rb +++ b/test/stylesheet/tc_font.rb @@ -9,7 +9,6 @@ class TestFont < Test::Unit::TestCase def teardown end - def test_initialiation assert_equal(@item.name, nil) assert_equal(@item.charset, nil) @@ -26,8 +25,6 @@ class TestFont < Test::Unit::TestCase assert_equal(@item.sz, nil) end - - # def name=(v) Axlsx::validate_string v; @name = v end def test_name assert_raise(ArgumentError) { @item.name = 7 } diff --git a/test/stylesheet/tc_gradient_fill.rb b/test/stylesheet/tc_gradient_fill.rb index 546941d7..b8ce757b 100644 --- a/test/stylesheet/tc_gradient_fill.rb +++ b/test/stylesheet/tc_gradient_fill.rb @@ -9,7 +9,6 @@ class TestGradientFill < Test::Unit::TestCase def teardown end - def test_initialiation assert_equal(@item.type, :linear) assert_equal(@item.degree, nil) diff --git a/test/stylesheet/tc_gradient_stop.rb b/test/stylesheet/tc_gradient_stop.rb index f1cf5183..1340e225 100644 --- a/test/stylesheet/tc_gradient_stop.rb +++ b/test/stylesheet/tc_gradient_stop.rb @@ -9,7 +9,6 @@ class TestGradientStop < Test::Unit::TestCase def teardown end - def test_initialiation assert_equal(@item.color.rgb, "FFFF0000") assert_equal(@item.position, 1.0) diff --git a/test/stylesheet/tc_num_fmt.rb b/test/stylesheet/tc_num_fmt.rb index b5b73929..5309f189 100644 --- a/test/stylesheet/tc_num_fmt.rb +++ b/test/stylesheet/tc_num_fmt.rb @@ -9,7 +9,6 @@ class TestNumFmt < Test::Unit::TestCase def teardown end - def test_initialiation assert_equal(@item.numFmtId, 0) assert_equal(@item.formatCode, "") diff --git a/test/stylesheet/tc_pattern_fill.rb b/test/stylesheet/tc_pattern_fill.rb index fef28248..ed567c7e 100644 --- a/test/stylesheet/tc_pattern_fill.rb +++ b/test/stylesheet/tc_pattern_fill.rb @@ -9,7 +9,6 @@ class TestPatternFill < Test::Unit::TestCase def teardown end - def test_initialiation assert_equal(@item.patternType, :none) assert_equal(@item.bgColor, nil) diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index b9ccfebd..9c7d56c9 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -212,7 +212,6 @@ class TestStyles < Test::Unit::TestCase assert_equal(xf.protection.locked, true, "cell locking set") assert_raise(ArgumentError, "should reject invalid borderId") { @styles.add_style :border => 2 } - assert_equal(xf.applyProtection, true, "protection applied") assert_equal(xf.applyBorder, true, "border applied") assert_equal(xf.applyNumberFormat,true, "number format applied") diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index 35fd5ea5..89aaea5f 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -22,7 +22,6 @@ class TestAxlsx < Test::Unit::TestCase assert_equal false, Axlsx.trust_input end - def test_trust_input_can_be_set_to_true # Class variables like this are not reset between test runs, so we have # to save and restore the original value manually. diff --git a/test/tc_package.rb b/test/tc_package.rb index f7de1992..82c4cb83 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -268,7 +268,6 @@ class TestPackage < Test::Unit::TestCase assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotTables\/_rels\/pivotTable\d\.xml.rels/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables rels missing") assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotCache\/pivotCacheDefinition\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing") - #no mystery parts assert_equal(25, p.size) diff --git a/test/workbook/worksheet/auto_filter/tc_filter_column.rb b/test/workbook/worksheet/auto_filter/tc_filter_column.rb index 60b726a6..934931fd 100644 --- a/test/workbook/worksheet/auto_filter/tc_filter_column.rb +++ b/test/workbook/worksheet/auto_filter/tc_filter_column.rb @@ -6,7 +6,6 @@ class TestFilterColumn < Test::Unit::TestCase @filter_column = Axlsx::FilterColumn.new(0, :filters, :filter_items => [200]) end - def test_initialize_col_id assert_raise ArgumentError do Axlsx::FilterColumn.new(0, :bobs_house_of_filter) @@ -69,8 +68,6 @@ class TestFilterColumn < Test::Unit::TestCase assert doc.xpath("//filterColumn[@hiddenButton=#{@filter_column.hidden_button}]") assert doc.xpath("//filterColumn[@showButton=#{@filter_column.show_button}]") - - assert doc.xpath("//filterColumn/filters") end end diff --git a/test/workbook/worksheet/tc_border_creator.rb b/test/workbook/worksheet/tc_border_creator.rb index 0a72cc84..6a0f8424 100644 --- a/test/workbook/worksheet/tc_border_creator.rb +++ b/test/workbook/worksheet/tc_border_creator.rb @@ -66,7 +66,6 @@ class TestBorderCreator < Test::Unit::TestCase assert_equal [:thick], @ws.styles.borders[2].prs.map(&:style).uniq assert_equal [:left, :top], @ws.styles.borders[2].prs.map(&:name) - assert_equal 1, @ws.styles.borders[3].prs.size assert_equal ["FFFFFFFF"], @ws.styles.borders[3].prs.map(&:color).map(&:rgb).uniq assert_equal [:thick], @ws.styles.borders[3].prs.map(&:style).uniq diff --git a/test/workbook/worksheet/tc_break.rb b/test/workbook/worksheet/tc_break.rb index bf440b0b..814a4878 100644 --- a/test/workbook/worksheet/tc_break.rb +++ b/test/workbook/worksheet/tc_break.rb @@ -27,7 +27,6 @@ class TestBreak < Test::Unit::TestCase end end - def test_man assert_equal(true, @break.man) assert_raises ArgumentError do diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index bbf92e21..d7da55e0 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -59,7 +59,6 @@ class TestConditionalFormatting < Test::Unit::TestCase end - def test_add_as_hash color_scale = Axlsx::ColorScale.new do |cs| diff --git a/test/workbook/worksheet/tc_data_bar.rb b/test/workbook/worksheet/tc_data_bar.rb index 1c460630..fe02976d 100644 --- a/test/workbook/worksheet/tc_data_bar.rb +++ b/test/workbook/worksheet/tc_data_bar.rb @@ -17,7 +17,6 @@ class TestDataBar < Test::Unit::TestCase assert_equal("0", data_bar.value_objects.last.val) end - def test_minLength assert_raise(ArgumentError) { @data_bar.minLength = :invalid_type } assert_nothing_raised { @data_bar.minLength = 0} diff --git a/test/workbook/worksheet/tc_page_margins.rb b/test/workbook/worksheet/tc_page_margins.rb index 386f47da..96695846 100644 --- a/test/workbook/worksheet/tc_page_margins.rb +++ b/test/workbook/worksheet/tc_page_margins.rb @@ -27,7 +27,6 @@ class TestPageMargins < Test::Unit::TestCase assert_equal(0.1, optioned.footer) end - def test_set_all_values @pm.set(:left => 1.1, :right => 1.2, :top => 1.3, :bottom => 1.4, :header => 0.8, :footer => 0.9) assert_equal(1.1, @pm.left) diff --git a/test/workbook/worksheet/tc_page_setup.rb b/test/workbook/worksheet/tc_page_setup.rb index 097eb563..e12f93b5 100644 --- a/test/workbook/worksheet/tc_page_setup.rb +++ b/test/workbook/worksheet/tc_page_setup.rb @@ -138,6 +138,5 @@ class TestPageSetup < Test::Unit::TestCase assert_equal(fits, [2, 7]) assert_raise(ArgumentError) { puts @ps.fit_to(:width => true)} - end end diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb index 13795668..c3998bd4 100644 --- a/test/workbook/worksheet/tc_pane.rb +++ b/test/workbook/worksheet/tc_pane.rb @@ -10,7 +10,6 @@ class TestPane < Test::Unit::TestCase @pane = Axlsx::Pane.new(@options) end - def test_active_pane assert_raise(ArgumentError) { @pane.active_pane = "10" } assert_nothing_raised { @pane.active_pane = :top_left } diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb index f01440ad..b3ca647e 100644 --- a/test/workbook/worksheet/tc_pivot_table.rb +++ b/test/workbook/worksheet/tc_pivot_table.rb @@ -1,6 +1,5 @@ require 'tc_helper.rb' - def shared_test_pivot_table_xml_validity(pivot_table) schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD)) doc = Nokogiri::XML(pivot_table.to_xml_string) diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb index 3d1a4d4d..e919b914 100644 --- a/test/workbook/worksheet/tc_row.rb +++ b/test/workbook/worksheet/tc_row.rb @@ -88,7 +88,6 @@ class TestRow < Test::Unit::TestCase assert_equal(15, @row.height) end - def test_ph assert_raise(ArgumentError) { @row.ph = -3 } assert_nothing_raised { @row.ph = true } diff --git a/test/workbook/worksheet/tc_sheet_pr.rb b/test/workbook/worksheet/tc_sheet_pr.rb index be45438b..e39c8bca 100644 --- a/test/workbook/worksheet/tc_sheet_pr.rb +++ b/test/workbook/worksheet/tc_sheet_pr.rb @@ -1,6 +1,5 @@ require 'tc_helper.rb' - class TestSheetPr < Test::Unit::TestCase def setup diff --git a/test/workbook/worksheet/tc_sheet_view.rb b/test/workbook/worksheet/tc_sheet_view.rb index 4481f127..386777b2 100644 --- a/test/workbook/worksheet/tc_sheet_view.rb +++ b/test/workbook/worksheet/tc_sheet_view.rb @@ -15,7 +15,6 @@ class TestSheetView < Test::Unit::TestCase @integer_options = { :color_id => 2, :workbook_view_id => 2 }.merge(@int_0).merge(@int_100) @string_options = { :top_left_cell => 'A2' } - @options = @boolean_options.merge(@boolean_options).merge(@symbol_options).merge(@nil_options).merge(@int_0).merge(@int_100) @sv = Axlsx::SheetView.new(@options) diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb index f0c6821c..276f7aa4 100644 --- a/test/workbook/worksheet/tc_table_style_info.rb +++ b/test/workbook/worksheet/tc_table_style_info.rb @@ -14,7 +14,6 @@ class TestTableStyleInfo < Test::Unit::TestCase :show_column_stripes => 1, :name => "TableStyleDark4" } - end def test_initialize diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 5a1a870a..e914f320 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -7,7 +7,6 @@ class TestWorksheet < Test::Unit::TestCase @ws = @wb.add_worksheet end - def test_pn assert_equal(@ws.pn, "worksheets/sheet1.xml") ws = @ws.workbook.add_worksheet @@ -134,7 +133,6 @@ class TestWorksheet < Test::Unit::TestCase end - # def test_use_gridlines # assert_raise(ArgumentError) { @ws.show_gridlines = -1.1 } # assert_nothing_raised { @ws.show_gridlines = false } @@ -210,7 +208,6 @@ class TestWorksheet < Test::Unit::TestCase @ws.add_row [1, 2, 3, 4] @ws.add_row [1, 2, 3, 4] - assert(@ws.row_breaks.empty?) assert(@ws.col_breaks.empty?) @ws.add_page_break(@ws.rows.last.cells[1]) @@ -218,7 +215,6 @@ class TestWorksheet < Test::Unit::TestCase assert_equal(1, @ws.col_breaks.size) end - def test_drawing assert @ws.drawing == nil @ws.add_chart(Axlsx::Pie3DChart) @@ -589,7 +585,6 @@ class TestWorksheet < Test::Unit::TestCase assert_equal(other_ws.index, filter_database[1].local_sheet_id) end - def test_sheet_pr_for_auto_filter @ws.auto_filter.range = 'A1:D9' @ws.auto_filter.add_column 0, :filters, :filter_items => [1] -- cgit v1.2.3 From a802d1d179f5ab56b419e1b47e62885d72b5384d Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:37:28 +0200 Subject: Fix Layout/EmptyLineBetweenDefs offenses ``` rubocop --only Layout/EmptyLineBetweenDefs -a ``` --- lib/axlsx/drawing/one_cell_anchor.rb | 1 + lib/axlsx/package.rb | 1 + lib/axlsx/stylesheet/color.rb | 2 ++ lib/axlsx/stylesheet/font.rb | 2 ++ lib/axlsx/util/validators.rb | 4 ++++ lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb | 1 + lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb | 1 + test/doc_props/tc_app.rb | 1 + test/drawing/tc_cat_axis.rb | 1 + test/drawing/tc_d_lbls.rb | 1 + test/drawing/tc_drawing.rb | 2 ++ test/drawing/tc_picture_locking.rb | 1 + test/drawing/tc_scatter_chart.rb | 1 + test/drawing/tc_val_axis.rb | 1 + test/drawing/tc_vml_shape.rb | 2 ++ test/stylesheet/tc_border.rb | 2 ++ test/stylesheet/tc_border_pr.rb | 2 ++ test/stylesheet/tc_font.rb | 1 + test/stylesheet/tc_styles.rb | 1 + test/tc_axlsx.rb | 1 + test/util/tc_validators.rb | 2 ++ test/workbook/worksheet/tc_color_scale.rb | 1 + test/workbook/worksheet/tc_comment.rb | 1 + test/workbook/worksheet/tc_comments.rb | 2 ++ test/workbook/worksheet/tc_conditional_formatting.rb | 1 + test/workbook/worksheet/tc_pane.rb | 1 + test/workbook/worksheet/tc_sheet_format_pr.rb | 2 ++ test/workbook/worksheet/tc_table_style_info.rb | 1 + test/workbook/worksheet/tc_worksheet.rb | 1 + test/workbook/worksheet/tc_worksheet_hyperlink.rb | 1 + 30 files changed, 42 insertions(+) diff --git a/lib/axlsx/drawing/one_cell_anchor.rb b/lib/axlsx/drawing/one_cell_anchor.rb index fc3dc48c..01767574 100644 --- a/lib/axlsx/drawing/one_cell_anchor.rb +++ b/lib/axlsx/drawing/one_cell_anchor.rb @@ -56,6 +56,7 @@ module Axlsx def start_at(x, y=0) from.coord x, y end + # # @see height def height=(v) Axlsx::validate_unsigned_int(v); @height = v; end diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index e866444b..29f72d5c 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -47,6 +47,7 @@ module Axlsx Axlsx::validate_boolean(v); workbook.use_shared_strings = v end + # The workbook this package will serialize or validate. # @return [Workbook] If no workbook instance has been assigned with this package a new Workbook instance is returned. # @raise ArgumentError if workbook parameter is not a Workbook instance. diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index 32f18063..d7168ee7 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -47,6 +47,7 @@ module Axlsx # @see auto def auto=(v) Axlsx::validate_boolean v; @auto = v end + # @see color def rgb=(v) Axlsx::validate_string(v) @@ -56,6 +57,7 @@ module Axlsx raise ArgumentError, "Invalid color rgb value: #{v}." unless v.match(/[0-9A-F]{8}/) @rgb = v end + # @see tint def tint=(v) Axlsx::validate_float v; @tint = v end diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index 8a52c810..4011f888 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -119,6 +119,7 @@ module Axlsx def b=(v) Axlsx::validate_boolean v; @b = v end # @see i def i=(v) Axlsx::validate_boolean v; @i = v end + # @see u def u=(v) v = :single if (v == true || v == 1 || v == :true || v == 'true') @@ -126,6 +127,7 @@ module Axlsx Axlsx::validate_cell_u v @u = v end + # @see strike def strike=(v) Axlsx::validate_boolean v; @strike = v end # @see outline diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 9e3d0de1..ebf8a280 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -31,6 +31,7 @@ module Axlsx raise ArgumentError, (ERR_RANGE % [value.inspect, min.to_s, max.to_s, inclusive]) unless passes end end + # Validates the value against the regular expression provided. class RegexValidator # @param [String] name The name of what is being validated. This is included in the output when the value is invalid @@ -142,6 +143,7 @@ module Axlsx def self.validate_page_orientation(v) RestrictionValidator.validate "page_orientation", [:default, :landscape, :portrait], v end + # Requires that the value is one of :none, :single, :double, :singleAccounting, :doubleAccounting def self.validate_cell_u(v) RestrictionValidator.validate "cell run style u", [:none, :single, :double, :singleAccounting, :doubleAccounting], v @@ -151,6 +153,7 @@ module Axlsx def self.validate_family(v) RestrictionValidator.validate "cell run style family", 1..5, v end + # Requires that the value is valid pattern type. # valid pattern types must be one of :none, :solid, :mediumGray, :darkGray, :lightGray, :darkHorizontal, :darkVertical, :darkDown, # :darkUp, :darkGrid, :darkTrellis, :lightHorizontal, :lightVertical, :lightDown, :lightUp, :lightGrid, :lightTrellis, :gray125, or :gray0625. @@ -213,6 +216,7 @@ module Axlsx def self.validate_scatter_style(v) Axlsx::RestrictionValidator.validate "ScatterChart.scatterStyle", [:none, :line, :lineMarker, :marker, :smooth, :smoothMarker], v.to_sym end + # Requires that the value is a valid horizontal_alignment # :general, :left, :center, :right, :fill, :justify, :centerContinuous, :distributed are allowed # @param [Any] v The value validated diff --git a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb index 4635ba20..e419c0ab 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb @@ -63,6 +63,7 @@ module Axlsx end end end + # serialize the object # @return [String] def to_xml_string(str='') diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb index 61957df0..4816fd55 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb @@ -67,6 +67,7 @@ module Axlsx def apply(row, offset) row.hidden = @filter.apply(row.cells[offset+col_id.to_i]) end + # @param [Boolean] hidden Flag indicating whether the AutoFilter button for this column is hidden. # @return [Boolean] def hidden_button=(hidden) diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb index 31ab3733..ae0e45ba 100644 --- a/test/doc_props/tc_app.rb +++ b/test/doc_props/tc_app.rb @@ -31,6 +31,7 @@ class TestApp < Test::Unit::TestCase @app = Axlsx::App.new options end + def test_valid_document schema = Nokogiri::XML::Schema(File.open(Axlsx::APP_XSD)) doc = Nokogiri::XML(@app.to_xml_string) diff --git a/test/drawing/tc_cat_axis.rb b/test/drawing/tc_cat_axis.rb index ac690336..b020fc53 100644 --- a/test/drawing/tc_cat_axis.rb +++ b/test/drawing/tc_cat_axis.rb @@ -4,6 +4,7 @@ class TestCatAxis < Test::Unit::TestCase def setup @axis = Axlsx::CatAxis.new end + def teardown end diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb index d5474131..60efeb7b 100644 --- a/test/drawing/tc_d_lbls.rb +++ b/test/drawing/tc_d_lbls.rb @@ -31,6 +31,7 @@ class TestDLbls < Test::Unit::TestCase end assert_equal(:t, d_lbls.d_lbl_pos, "d_lbl_pos set by options") end + def test_d_lbl_pos assert_raise(ArgumentError, 'invlaid label positions are rejected') { @d_lbls.d_lbl_pos = :upside_down } assert_nothing_raised('accepts valid label position') { @d_lbls.d_lbl_pos = :ctr } diff --git a/test/drawing/tc_drawing.rb b/test/drawing/tc_drawing.rb index 05ffee98..bc9fc686 100644 --- a/test/drawing/tc_drawing.rb +++ b/test/drawing/tc_drawing.rb @@ -30,12 +30,14 @@ class TestDrawing < Test::Unit::TestCase assert_equal(600, image.width) assert_equal(400, image.height) end + def test_add_two_cell_anchor_image src = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" image = @ws.add_image(:image_src => src, :start_at=>[0,0], :end_at => [15,0]) assert(@ws.drawing.anchors.last.is_a?(Axlsx::TwoCellAnchor)) assert(image.is_a?(Axlsx::Pic)) end + def test_charts chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1]) assert_equal(@ws.drawing.charts.last, chart, "add chart is returned") diff --git a/test/drawing/tc_picture_locking.rb b/test/drawing/tc_picture_locking.rb index 794c8f6a..3714df0b 100644 --- a/test/drawing/tc_picture_locking.rb +++ b/test/drawing/tc_picture_locking.rb @@ -4,6 +4,7 @@ class TestPictureLocking < Test::Unit::TestCase def setup @item = Axlsx::PictureLocking.new end + def teardown end diff --git a/test/drawing/tc_scatter_chart.rb b/test/drawing/tc_scatter_chart.rb index 15b1f0a0..37748b2f 100644 --- a/test/drawing/tc_scatter_chart.rb +++ b/test/drawing/tc_scatter_chart.rb @@ -27,6 +27,7 @@ class TestScatterChart < Test::Unit::TestCase assert(@chart.scatterStyle == :marker) assert_raise(ArgumentError) { @chart.scatterStyle = :buckshot } end + def test_initialization assert_equal(@chart.scatterStyle, :lineMarker, "scatterStyle defualt incorrect") assert_equal(@chart.series_type, Axlsx::ScatterSeries, "series type incorrect") diff --git a/test/drawing/tc_val_axis.rb b/test/drawing/tc_val_axis.rb index aa1cb23a..7fd9d1dd 100644 --- a/test/drawing/tc_val_axis.rb +++ b/test/drawing/tc_val_axis.rb @@ -4,6 +4,7 @@ class TestValAxis < Test::Unit::TestCase def setup @axis = Axlsx::ValAxis.new end + def teardown end diff --git a/test/drawing/tc_vml_shape.rb b/test/drawing/tc_vml_shape.rb index 94ad6e9f..d8f10b56 100644 --- a/test/drawing/tc_vml_shape.rb +++ b/test/drawing/tc_vml_shape.rb @@ -84,12 +84,14 @@ class TestVmlShape < Test::Unit::TestCase assert(shape.top_row == 3) assert_raise(ArgumentError) { shape.top_row = [] } end + def test_visible shape = @comments.first.vml_shape shape.visible = false assert(shape.visible == false) assert_raise(ArgumentError) { shape.visible = 'foo' } end + def test_to_xml_string str = @comments.vml_drawing.to_xml_string() doc = Nokogiri::XML(str) diff --git a/test/stylesheet/tc_border.rb b/test/stylesheet/tc_border.rb index ae191dd0..c2fb0d98 100644 --- a/test/stylesheet/tc_border.rb +++ b/test/stylesheet/tc_border.rb @@ -4,8 +4,10 @@ class TestBorder < Test::Unit::TestCase def setup @b = Axlsx::Border.new end + def teardown end + def test_initialiation assert_equal(@b.diagonalUp, nil) assert_equal(@b.diagonalDown, nil) diff --git a/test/stylesheet/tc_border_pr.rb b/test/stylesheet/tc_border_pr.rb index dc0fa9da..1e1c1dcc 100644 --- a/test/stylesheet/tc_border_pr.rb +++ b/test/stylesheet/tc_border_pr.rb @@ -4,8 +4,10 @@ class TestBorderPr < Test::Unit::TestCase def setup @bpr = Axlsx::BorderPr.new end + def teardown end + def test_initialiation assert_equal(@bpr.color, nil) assert_equal(@bpr.style, nil) diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb index 58f84b08..106cfce5 100644 --- a/test/stylesheet/tc_font.rb +++ b/test/stylesheet/tc_font.rb @@ -31,6 +31,7 @@ class TestFont < Test::Unit::TestCase assert_nothing_raised { @item.name = "bob" } assert_equal(@item.name, "bob") end + # def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end def test_charset assert_raise(ArgumentError) { @item.charset = -7 } diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index 9c7d56c9..37dc4fb4 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -4,6 +4,7 @@ class TestStyles < Test::Unit::TestCase def setup @styles = Axlsx::Styles.new end + def teardown end diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index 89aaea5f..e9ea0be6 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -32,6 +32,7 @@ class TestAxlsx < Test::Unit::TestCase Axlsx.trust_input = old end + def test_cell_range_relative p = Axlsx::Package.new ws = p.workbook.add_worksheet diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb index d6936496..26fb2a89 100644 --- a/test/util/tc_validators.rb +++ b/test/util/tc_validators.rb @@ -2,6 +2,7 @@ require 'tc_helper.rb' class TestValidators < Test::Unit::TestCase def setup end + def teardown end @@ -187,6 +188,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_integerish Axlsx } [1, 1.4, "a"].each { |test_value| assert_nothing_raised { Axlsx.validate_integerish test_value } } end + def test_validate_family assert_raise(ArgumentError) { Axlsx.validate_family 0 } (1..5).each do |item| diff --git a/test/workbook/worksheet/tc_color_scale.rb b/test/workbook/worksheet/tc_color_scale.rb index a0d75fab..56afe338 100644 --- a/test/workbook/worksheet/tc_color_scale.rb +++ b/test/workbook/worksheet/tc_color_scale.rb @@ -16,6 +16,7 @@ class TestColorScale < Test::Unit::TestCase assert_equal 2, color_scale.value_objects.size assert_equal 2, color_scale.colors.size end + def test_default_cfvo first = Axlsx::ColorScale.default_cfvos.first second = Axlsx::ColorScale.default_cfvos.last diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb index b736e5c5..b495c0bb 100644 --- a/test/workbook/worksheet/tc_comment.rb +++ b/test/workbook/worksheet/tc_comment.rb @@ -32,6 +32,7 @@ class TestComment < Test::Unit::TestCase assert_equal(false, @c1.visible) assert_equal(true, @c2.visible) end + def test_ref assert(@c1.ref == 'A1') assert(@c2.ref == 'C3') diff --git a/test/workbook/worksheet/tc_comments.rb b/test/workbook/worksheet/tc_comments.rb index 68b3ac71..6b07b465 100644 --- a/test/workbook/worksheet/tc_comments.rb +++ b/test/workbook/worksheet/tc_comments.rb @@ -23,6 +23,7 @@ class TestComments < Test::Unit::TestCase assert_nothing_raised { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can', :ref => 'A1') } assert_equal(@ws.comments.size, 3) end + def test_authors assert_equal(@ws.comments.authors.size, @ws.comments.size) @ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1') @@ -30,6 +31,7 @@ class TestComments < Test::Unit::TestCase @ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1') assert_equal(@ws.comments.authors.size, 3, 'only unique authors are returned') end + def test_pn assert_equal(@ws.comments.pn, Axlsx::COMMENT_PN % (@ws.index+1).to_s) end diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index d7da55e0..d9652ebf 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -15,6 +15,7 @@ class TestConditionalFormatting < Test::Unit::TestCase assert_equal("AA1:AB100", optioned.sqref) assert_equal([1, 2], optioned.rules) end + def test_add_as_rule color_scale = Axlsx::ColorScale.new do |cs| diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb index c3998bd4..d5f05933 100644 --- a/test/workbook/worksheet/tc_pane.rb +++ b/test/workbook/worksheet/tc_pane.rb @@ -44,6 +44,7 @@ class TestPane < Test::Unit::TestCase doc = Nokogiri::XML.parse(@pane.to_xml_string) assert_equal(1, doc.xpath("//pane[@ySplit=2][@xSplit='2'][@topLeftCell='A2'][@state='frozen'][@activePane='bottomLeft']").size) end + def test_to_xml_frozen pane = Axlsx::Pane.new :state => :frozen, :y_split => 2 doc = Nokogiri::XML(pane.to_xml_string) diff --git a/test/workbook/worksheet/tc_sheet_format_pr.rb b/test/workbook/worksheet/tc_sheet_format_pr.rb index b7d7b929..ec98988b 100644 --- a/test/workbook/worksheet/tc_sheet_format_pr.rb +++ b/test/workbook/worksheet/tc_sheet_format_pr.rb @@ -63,10 +63,12 @@ class TestSheetFormatPr < Test::Unit::TestCase assert_raise(ArgumentError) { @sheet_format_pr.zero_height= :foo } assert_nothing_raised { @sheet_format_pr.zero_height = true } end + def test_thick_top assert_raise(ArgumentError) { @sheet_format_pr.thick_top= :foo } assert_nothing_raised { @sheet_format_pr.thick_top = true } end + def test_thick_bottom assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom= :foo } assert_nothing_raised { @sheet_format_pr.thick_bottom = true } diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb index 276f7aa4..9ba03ea7 100644 --- a/test/workbook/worksheet/tc_table_style_info.rb +++ b/test/workbook/worksheet/tc_table_style_info.rb @@ -30,6 +30,7 @@ class TestTableStyleInfo < Test::Unit::TestCase assert_raises(ArgumentError) { table_style.send(key.to_sym, 'foo') } end end + def doc @doc ||= Nokogiri::XML(Axlsx::TableStyleInfo.new(@options).to_xml_string) end diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index e914f320..72fdf556 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -438,6 +438,7 @@ class TestWorksheet < Test::Unit::TestCase assert_equal("foo\n\r\nbar", @ws.rows.last.cells.last.value) assert_not_nil(@ws.to_xml_string.index("foo\n\r\nbar")) end + # Make sure the XML for all optional elements (like pageMargins, autoFilter, ...) # is generated in correct order. def test_valid_with_optional_elements diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb index b456694d..f64dc6b1 100644 --- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb +++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb @@ -29,6 +29,7 @@ class TestWorksheetHyperlink < Test::Unit::TestCase def test_display assert_equal(@options[:display], @a.display) end + def test_ref assert_equal(@options[:ref], @a.ref) end -- cgit v1.2.3 From 94813f5200da3f034af11b9537221e076de174a6 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:46:42 +0200 Subject: Fix Layout/CommentIndentation offenses ``` rubocop --only Layout/CommentIndentation -a ``` --- lib/axlsx/drawing/area_chart.rb | 2 +- lib/axlsx/drawing/line_chart.rb | 2 +- lib/axlsx/drawing/marker.rb | 2 +- lib/axlsx/drawing/num_data_source.rb | 2 +- lib/axlsx/stylesheet/cell_style.rb | 2 +- lib/axlsx/stylesheet/color.rb | 2 +- lib/axlsx/stylesheet/font.rb | 2 +- lib/axlsx/stylesheet/table_styles.rb | 2 +- lib/axlsx/stylesheet/xf.rb | 2 +- lib/axlsx/workbook/workbook.rb | 2 +- lib/axlsx/workbook/worksheet/col.rb | 2 +- .../workbook/worksheet/conditional_formatting.rb | 2 +- lib/axlsx/workbook/worksheet/icon_set.rb | 2 +- lib/axlsx/workbook/worksheet/page_setup.rb | 2 +- lib/axlsx/workbook/worksheet/protected_range.rb | 2 +- lib/axlsx/workbook/worksheet/row.rb | 2 +- test/stylesheet/tc_font.rb | 26 +++++++++++----------- test/workbook/worksheet/tc_date_time_converter.rb | 2 +- 18 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/axlsx/drawing/area_chart.rb b/lib/axlsx/drawing/area_chart.rb index 1834292c..fa0f5ebf 100644 --- a/lib/axlsx/drawing/area_chart.rb +++ b/lib/axlsx/drawing/area_chart.rb @@ -34,7 +34,7 @@ module Axlsx end alias :valAxis :val_axis - # must be one of [:percentStacked, :clustered, :standard, :stacked] + # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] attr_reader :grouping diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb index e1ded225..dd0517cb 100644 --- a/lib/axlsx/drawing/line_chart.rb +++ b/lib/axlsx/drawing/line_chart.rb @@ -34,7 +34,7 @@ module Axlsx end alias :valAxis :val_axis - # must be one of [:percentStacked, :clustered, :standard, :stacked] + # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] attr_reader :grouping diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index 7ef77f21..d884ef3c 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -32,7 +32,7 @@ module Axlsx # @return [Integer] attr_reader :rowOff - # @see col + # @see col def col=(v) Axlsx::validate_unsigned_int v; @col = v end # @see colOff def colOff=(v) Axlsx::validate_int v; @colOff = v end diff --git a/lib/axlsx/drawing/num_data_source.rb b/lib/axlsx/drawing/num_data_source.rb index 028b75d2..87caac2a 100644 --- a/lib/axlsx/drawing/num_data_source.rb +++ b/lib/axlsx/drawing/num_data_source.rb @@ -35,7 +35,7 @@ module Axlsx [:yVal, :val, :bubbleSize] end - # sets the tag name for this data source + # sets the tag name for this data source # @param [Symbol] v One of the allowed_tag_names def tag_name=(v) Axlsx::RestrictionValidator.validate "#{self.class.name}.tag_name", self.class.allowed_tag_names, v diff --git a/lib/axlsx/stylesheet/cell_style.rb b/lib/axlsx/stylesheet/cell_style.rb index e1d4e0ff..9297e243 100644 --- a/lib/axlsx/stylesheet/cell_style.rb +++ b/lib/axlsx/stylesheet/cell_style.rb @@ -46,7 +46,7 @@ module Axlsx # @return [Boolean] attr_reader :customBuiltin - # @see name + # @see name def name=(v) Axlsx::validate_string v; @name = v end # @see xfId def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index d7168ee7..e4051e96 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -45,7 +45,7 @@ module Axlsx # @return [Float] attr_reader :tint - # @see auto + # @see auto def auto=(v) Axlsx::validate_boolean v; @auto = v end # @see color diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index 4011f888..890957c5 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -109,7 +109,7 @@ module Axlsx # @return [Integer] attr_reader :sz - # @see name + # @see name def name=(v) Axlsx::validate_string v; @name = v end # @see charset def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end diff --git a/lib/axlsx/stylesheet/table_styles.rb b/lib/axlsx/stylesheet/table_styles.rb index f6c6a415..d10e9b05 100644 --- a/lib/axlsx/stylesheet/table_styles.rb +++ b/lib/axlsx/stylesheet/table_styles.rb @@ -24,7 +24,7 @@ module Axlsx # @return [String] attr_reader :defaultPivotStyle - # @see defaultTableStyle + # @see defaultTableStyle def defaultTableStyle=(v) Axlsx::validate_string(v); @defaultTableStyle = v; end # @see defaultPivotStyle def defaultPivotStyle=(v) Axlsx::validate_string(v); @defaultPivotStyle = v; end diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb index 9aaba6fa..13abf4f2 100644 --- a/lib/axlsx/stylesheet/xf.rb +++ b/lib/axlsx/stylesheet/xf.rb @@ -92,7 +92,7 @@ module Axlsx # @return [Boolean] attr_reader :applyProtection - # @see Xf#alignment + # @see Xf#alignment def alignment=(v) DataTypeValidator.validate "Xf.alignment", CellAlignment, v; @alignment = v end # @see protection diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index b5d229e1..deb42d86 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -107,7 +107,7 @@ require 'axlsx/workbook/worksheet/selection.rb' @is_reversed = v end - # A collection of worksheets associated with this workbook. + # A collection of worksheets associated with this workbook. # @note The recommended way to manage worksheets is add_worksheet # @see Workbook#add_worksheet # @see Worksheet diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index ff4c67b9..29840c7a 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -105,7 +105,7 @@ module Axlsx @style = v end - # @see Col#width + # @see Col#width def width=(v) # Removing this validation make a 10% difference in performance # as it is called EVERY TIME A CELL IS ADDED - the proper solution diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb index 0ed065e6..4fe6578d 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb @@ -28,7 +28,7 @@ module Axlsx # @return [Array] attr_reader :rules - # Add Conditional Formatting Rules to this object. Rules can either + # Add Conditional Formatting Rules to this object. Rules can either # be already created {ConditionalFormattingRule} elements or # hashes of options for automatic creation. If rules is a hash # instead of an array, assume only one rule being added. diff --git a/lib/axlsx/workbook/worksheet/icon_set.rb b/lib/axlsx/workbook/worksheet/icon_set.rb index 400a8c47..42afaa4d 100644 --- a/lib/axlsx/workbook/worksheet/icon_set.rb +++ b/lib/axlsx/workbook/worksheet/icon_set.rb @@ -47,7 +47,7 @@ module Axlsx # @return [Boolean] attr_reader :showValue - # @see iconSet + # @see iconSet def iconSet=(v); Axlsx::validate_icon_set(v); @iconSet = v end # @see showValue diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb index d7abcbc2..b3117942 100644 --- a/lib/axlsx/workbook/worksheet/page_setup.rb +++ b/lib/axlsx/workbook/worksheet/page_setup.rb @@ -190,7 +190,7 @@ module Axlsx @paper_size = size end - # Set some or all page settings at once. + # Set some or all page settings at once. # @param [Hash] options The page settings to set (possible keys are :fit_to_height, :fit_to_width, :orientation, :paper_height, :paper_width, and :scale). def set(options) parse_options options diff --git a/lib/axlsx/workbook/worksheet/protected_range.rb b/lib/axlsx/workbook/worksheet/protected_range.rb index 492b2254..e0da00df 100644 --- a/lib/axlsx/workbook/worksheet/protected_range.rb +++ b/lib/axlsx/workbook/worksheet/protected_range.rb @@ -7,7 +7,7 @@ module Axlsx include Axlsx::OptionsParser include Axlsx::SerializedAttributes - # Initializes a new protected range object + # Initializes a new protected range object # @option [String] sqref The cell range reference to protect. This can be an absolute or a relateve range however, it only applies to the current sheet. # @option [String] name An optional name for the protected name. def initialize(options={}) diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index 4c8c27b7..376719ce 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -11,7 +11,7 @@ module Axlsx # thickTop # thickBottom - # Creates a new row. New Cell objects are created based on the values, types and style options. + # Creates a new row. New Cell objects are created based on the values, types and style options. # A new cell is created for each item in the values array. style and types options are applied as follows: # If the types option is defined and is a symbol it is applied to all the cells created. # If the types option is an array, cell types are applied by index for each cell diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb index 106cfce5..aaa72aa0 100644 --- a/test/stylesheet/tc_font.rb +++ b/test/stylesheet/tc_font.rb @@ -25,42 +25,42 @@ class TestFont < Test::Unit::TestCase assert_equal(@item.sz, nil) end - # def name=(v) Axlsx::validate_string v; @name = v end + # def name=(v) Axlsx::validate_string v; @name = v end def test_name assert_raise(ArgumentError) { @item.name = 7 } assert_nothing_raised { @item.name = "bob" } assert_equal(@item.name, "bob") end - # def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end + # def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end def test_charset assert_raise(ArgumentError) { @item.charset = -7 } assert_nothing_raised { @item.charset = 5 } assert_equal(@item.charset, 5) end - # def family=(v) Axlsx::validate_unsigned_int v; @family = v end + # def family=(v) Axlsx::validate_unsigned_int v; @family = v end def test_family assert_raise(ArgumentError) { @item.family = -7 } assert_nothing_raised { @item.family = 5 } assert_equal(@item.family, 5) end - # def b=(v) Axlsx::validate_boolean v; @b = v end + # def b=(v) Axlsx::validate_boolean v; @b = v end def test_b assert_raise(ArgumentError) { @item.b = -7 } assert_nothing_raised { @item.b = true } assert_equal(@item.b, true) end - # def i=(v) Axlsx::validate_boolean v; @i = v end + # def i=(v) Axlsx::validate_boolean v; @i = v end def test_i assert_raise(ArgumentError) { @item.i = -7 } assert_nothing_raised { @item.i = true } assert_equal(@item.i, true) end - # def u=(v) Axlsx::validate_cell_u v; @u = v end + # def u=(v) Axlsx::validate_cell_u v; @u = v end def test_u assert_raise(ArgumentError) { @item.u = -7 } assert_nothing_raised { @item.u = :single } @@ -79,49 +79,49 @@ class TestFont < Test::Unit::TestCase assert_equal(@item.u, :none) end - # def strike=(v) Axlsx::validate_boolean v; @strike = v end + # def strike=(v) Axlsx::validate_boolean v; @strike = v end def test_strike assert_raise(ArgumentError) { @item.strike = -7 } assert_nothing_raised { @item.strike = true } assert_equal(@item.strike, true) end - # def outline=(v) Axlsx::validate_boolean v; @outline = v end + # def outline=(v) Axlsx::validate_boolean v; @outline = v end def test_outline assert_raise(ArgumentError) { @item.outline = -7 } assert_nothing_raised { @item.outline = true } assert_equal(@item.outline, true) end - # def shadow=(v) Axlsx::validate_boolean v; @shadow = v end + # def shadow=(v) Axlsx::validate_boolean v; @shadow = v end def test_shadow assert_raise(ArgumentError) { @item.shadow = -7 } assert_nothing_raised { @item.shadow = true } assert_equal(@item.shadow, true) end - # def condense=(v) Axlsx::validate_boolean v; @condense = v end + # def condense=(v) Axlsx::validate_boolean v; @condense = v end def test_condense assert_raise(ArgumentError) { @item.condense = -7 } assert_nothing_raised { @item.condense = true } assert_equal(@item.condense, true) end - # def extend=(v) Axlsx::validate_boolean v; @extend = v end + # def extend=(v) Axlsx::validate_boolean v; @extend = v end def test_extend assert_raise(ArgumentError) { @item.extend = -7 } assert_nothing_raised { @item.extend = true } assert_equal(@item.extend, true) end - # def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end + # def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end def test_color assert_raise(ArgumentError) { @item.color = -7 } assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb=>"00000000") } assert(@item.color.is_a?(Axlsx::Color)) end - # def sz=(v) Axlsx::validate_unsigned_int v; @sz=v end + # def sz=(v) Axlsx::validate_unsigned_int v; @sz=v end def test_sz assert_raise(ArgumentError) { @item.sz = -7 } assert_nothing_raised { @item.sz = 5 } diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index d6b3fed2..19278e95 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -86,7 +86,7 @@ class TestDateTimeConverter < Test::Unit::TestCase def test_time_to_serial_1904 Axlsx::Workbook.date1904 = true - # ruby 1.8.7 cannot parse dates prior to epoch. see http://ruby-doc.org/core-1.8.7/Time.html + # ruby 1.8.7 cannot parse dates prior to epoch. see http://ruby-doc.org/core-1.8.7/Time.html tests = if @extended_time_range { # examples taken straight from the spec -- cgit v1.2.3 From eebb33ab2fac3b04dada178f98d03e3a587f620e Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:50:10 +0200 Subject: Fix Layout/FirstHashElementIndentation offense ``` rubocop --only Layout/FirstHashElementIndentation ``` Manually fixed --- test/doc_props/tc_app.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb index ae0e45ba..8d8efd4b 100644 --- a/test/doc_props/tc_app.rb +++ b/test/doc_props/tc_app.rb @@ -26,7 +26,7 @@ class TestApp < Test::Unit::TestCase :'Application' => 'axlsx', :'AppVersion' => '1.1.5', :'DocSecurity' => 0 - } + } @app = Axlsx::App.new options -- cgit v1.2.3 From 412763fbf817da4519c544dd225803a80ca121f3 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:52:33 +0200 Subject: Fix Layout offenses related to access modifiers ``` rubocop --only Layout/EmptyLinesAroundAccessModifier,Layout/AccessModifierIndentation -a ``` --- lib/axlsx/drawing/marker.rb | 1 + lib/axlsx/drawing/view_3D.rb | 1 + lib/axlsx/stylesheet/styles.rb | 1 + lib/axlsx/workbook/worksheet/color_scale.rb | 1 + lib/axlsx/workbook/worksheet/data_validation.rb | 3 ++- lib/axlsx/workbook/worksheet/pane.rb | 1 + lib/axlsx/workbook/worksheet/sheet_format_pr.rb | 1 + lib/axlsx/workbook/worksheet/sheet_protection.rb | 1 + 8 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index d884ef3c..94125143 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -60,6 +60,7 @@ module Axlsx str << ('' << self.send(k).to_s << '') end end + private # handles multiple inputs for setting the position of a marker diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 0424baac..ab959c87 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -104,6 +104,7 @@ module Axlsx end private + # Note: move this to Axlsx module if we find the smae pattern elsewhere. def element_for_attribute(name, namespace='') val = Axlsx.instance_values_for(self)[name] diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index 72706e3b..a28785c9 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -489,6 +489,7 @@ module Axlsx end private + # Creates the default set of styles the exel requires to be valid as well as setting up the # Axlsx::STYLE_THIN_BORDER def load_default_styles diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb index dc347a6a..b93240a5 100644 --- a/lib/axlsx/workbook/worksheet/color_scale.rb +++ b/lib/axlsx/workbook/worksheet/color_scale.rb @@ -92,6 +92,7 @@ module Axlsx end private + # There has got to be cleaner way of merging these arrays. def initialize_default_cfvos(user_cfvos) defaults = self.class.default_cfvos diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb index 194c9a27..0cd28069 100644 --- a/lib/axlsx/workbook/worksheet/data_validation.rb +++ b/lib/axlsx/workbook/worksheet/data_validation.rb @@ -244,7 +244,8 @@ module Axlsx str << '' end - private + private + def get_valid_attributes attributes = [:allowBlank, :error, :errorStyle, :errorTitle, :prompt, :promptTitle, :showErrorMessage, :showInputMessage, :sqref, :type ] diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb index 9c8671e6..bff08bb5 100644 --- a/lib/axlsx/workbook/worksheet/pane.rb +++ b/lib/axlsx/workbook/worksheet/pane.rb @@ -125,6 +125,7 @@ module Axlsx finalize serialized_tag 'pane', str end + private def finalize diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index f7cff58c..e0b981ef 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -52,6 +52,7 @@ module Axlsx end private + def set_defaults @base_col_width = 8 @default_row_height = 18 diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index 9e27c8d8..d1aaf00c 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -79,6 +79,7 @@ module Axlsx end private + # Creates a password hash for a given password # @return [String] def create_password_hash(password) -- cgit v1.2.3 From c9133ad108ca80c5d99195a70a9bdd95e50dde1a Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 17:54:06 +0200 Subject: Fix Layout/EmptyLinesAroundAttributeAccessor ``` rubocop --only Layout/EmptyLinesAroundAttributeAccessor -a ``` --- lib/axlsx/util/accessors.rb | 1 + lib/axlsx/workbook/worksheet/cell.rb | 15 +++++++++++++++ lib/axlsx/workbook/worksheet/rich_text_run.rb | 15 +++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/lib/axlsx/util/accessors.rb b/lib/axlsx/util/accessors.rb index 3eab1d39..d49255be 100644 --- a/lib/axlsx/util/accessors.rb +++ b/lib/axlsx/util/accessors.rb @@ -54,6 +54,7 @@ module Axlsx def validated_attr_accessor(symbols, validator) symbols.each do |symbol| attr_reader symbol + module_eval(SETTER % [symbol, validator, symbol], __FILE__, __LINE__) end end diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 59b0b300..f52006bd 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -177,6 +177,7 @@ module Axlsx # The inline font_name property for the cell # @return [String] attr_reader :font_name + # @see font_name def font_name=(v) set_run_style :validate_string, :font_name, v; end @@ -203,6 +204,7 @@ module Axlsx # 255  OEM_CHARSET # @return [String] attr_reader :charset + # @see charset def charset=(v) set_run_style :validate_unsigned_int, :charset, v; end @@ -214,6 +216,7 @@ module Axlsx # 4 Script # 5 Decorative attr_reader :family + # @see family def family=(v) set_run_style :validate_family, :family, v.to_i @@ -222,42 +225,49 @@ module Axlsx # The inline bold property for the cell # @return [Boolean] attr_reader :b + # @see b def b=(v) set_run_style :validate_boolean, :b, v; end # The inline italic property for the cell # @return [Boolean] attr_reader :i + # @see i def i=(v) set_run_style :validate_boolean, :i, v; end # The inline strike property for the cell # @return [Boolean] attr_reader :strike + # @see strike def strike=(v) set_run_style :validate_boolean, :strike, v; end # The inline outline property for the cell # @return [Boolean] attr_reader :outline + # @see outline def outline=(v) set_run_style :validate_boolean, :outline, v; end # The inline shadow property for the cell # @return [Boolean] attr_reader :shadow + # @see shadow def shadow=(v) set_run_style :validate_boolean, :shadow, v; end # The inline condense property for the cell # @return [Boolean] attr_reader :condense + # @see condense def condense=(v) set_run_style :validate_boolean, :condense, v; end # The inline extend property for the cell # @return [Boolean] attr_reader :extend + # @see extend def extend=(v) set_run_style :validate_boolean, :extend, v; end @@ -267,6 +277,7 @@ module Axlsx # @return [String] # @note true is for backwards compatability and is reassigned to :single attr_reader :u + # @see u def u=(v) v = :single if (v == true || v == 1 || v == :true || v == 'true') @@ -276,6 +287,7 @@ module Axlsx # The inline color property for the cell # @return [Color] attr_reader :color + # @param [String] v The 8 character representation for an rgb color #FFFFFFFF" def color=(v) @color = v.is_a?(Color) ? v : Color.new(:rgb=>v) @@ -285,6 +297,7 @@ module Axlsx # The inline sz property for the cell # @return [Inteter] attr_reader :sz + # @see sz def sz=(v) set_run_style :validate_unsigned_int, :sz, v; end @@ -292,6 +305,7 @@ module Axlsx # this must be one of [:baseline, :subscript, :superscript] # @return [Symbol] attr_reader :vertAlign + # @see vertAlign def vertAlign=(v) RestrictionValidator.validate :cell_vertAlign, [:baseline, :subscript, :superscript], v @@ -302,6 +316,7 @@ module Axlsx # this must be one of [:none, major, minor] # @return [Symbol] attr_reader :scheme + # @see scheme def scheme=(v) RestrictionValidator.validate :cell_scheme, [:none, :major, :minor], v diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb index b3870672..89dcd157 100644 --- a/lib/axlsx/workbook/worksheet/rich_text_run.rb +++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb @@ -27,6 +27,7 @@ module Axlsx # The inline font_name property for the cell # @return [String] attr_reader :font_name + # @see font_name def font_name=(v) set_run_style :validate_string, :font_name, v; end @@ -53,6 +54,7 @@ module Axlsx # 255  OEM_CHARSET # @return [String] attr_reader :charset + # @see charset def charset=(v) set_run_style :validate_unsigned_int, :charset, v; end @@ -64,6 +66,7 @@ module Axlsx # 4 Script # 5 Decorative attr_reader :family + # @see family def family=(v) set_run_style :validate_family, :family, v.to_i @@ -72,42 +75,49 @@ module Axlsx # The inline bold property for the cell # @return [Boolean] attr_reader :b + # @see b def b=(v) set_run_style :validate_boolean, :b, v; end # The inline italic property for the cell # @return [Boolean] attr_reader :i + # @see i def i=(v) set_run_style :validate_boolean, :i, v; end # The inline strike property for the cell # @return [Boolean] attr_reader :strike + # @see strike def strike=(v) set_run_style :validate_boolean, :strike, v; end # The inline outline property for the cell # @return [Boolean] attr_reader :outline + # @see outline def outline=(v) set_run_style :validate_boolean, :outline, v; end # The inline shadow property for the cell # @return [Boolean] attr_reader :shadow + # @see shadow def shadow=(v) set_run_style :validate_boolean, :shadow, v; end # The inline condense property for the cell # @return [Boolean] attr_reader :condense + # @see condense def condense=(v) set_run_style :validate_boolean, :condense, v; end # The inline extend property for the cell # @return [Boolean] attr_reader :extend + # @see extend def extend=(v) set_run_style :validate_boolean, :extend, v; end @@ -117,6 +127,7 @@ module Axlsx # @return [String] # @note true is for backwards compatability and is reassigned to :single attr_reader :u + # @see u def u=(v) v = :single if (v == true || v == 1 || v == :true || v == 'true') @@ -126,6 +137,7 @@ module Axlsx # The inline color property for the cell # @return [Color] attr_reader :color + # @param [String] v The 8 character representation for an rgb color #FFFFFFFF" def color=(v) @color = v.is_a?(Color) ? v : Color.new(:rgb=>v) @@ -134,6 +146,7 @@ module Axlsx # The inline sz property for the cell # @return [Inteter] attr_reader :sz + # @see sz def sz=(v) set_run_style :validate_unsigned_int, :sz, v; end @@ -141,6 +154,7 @@ module Axlsx # this must be one of [:baseline, :subscript, :superscript] # @return [Symbol] attr_reader :vertAlign + # @see vertAlign def vertAlign=(v) RestrictionValidator.validate :cell_vertAlign, [:baseline, :subscript, :superscript], v @@ -151,6 +165,7 @@ module Axlsx # this must be one of [:none, major, minor] # @return [Symbol] attr_reader :scheme + # @see scheme def scheme=(v) RestrictionValidator.validate :cell_scheme, [:none, :major, :minor], v -- cgit v1.2.3 From a058946a0d78771157b07f1803527a2263c44dd7 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 5 Apr 2023 18:19:07 +0200 Subject: Add RuboCop workflow and configuration --- .gitattributes | 1 + .github/workflows/rubocop.yml | 32 + .rubocop.yml | 13 + .rubocop_todo.yml | 1434 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1480 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/rubocop.yml create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..6fd60616 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.rubocop_todo.yml linguist-generated diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 00000000..2daa2926 --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,32 @@ +name: RuboCop + +on: + push: + branches: ['*'] + pull_request: + branches: ['*'] + +permissions: + contents: read + +jobs: + rubocop: + name: RuboCop + runs-on: ${{ matrix.os }} + env: + BUNDLE_JOBS: 4 + BUNDLE_RETRY: 3 + strategy: + matrix: + os: [ubuntu-latest] + ruby-version: ['3.2'] + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + - name: Run RuboCop + run: bundle exec rubocop diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..fe5b876a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +inherit_from: .rubocop_todo.yml + +AllCops: + NewCops: enable + SuggestExtensions: false + TargetRubyVersion: 2.3 + Exclude: + - 'docs/**/*' + - 'examples/**/*' + - 'vendor/bundle/**/*' + +Layout/CommentIndentation: + AllowForAlignment: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..f2f2e40e --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,1434 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-04-05 15:57:00 UTC using RuboCop version 1.49.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. +# Include: **/*.gemspec +Gemspec/OrderedDependencies: + Exclude: + - 'axlsx.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequireMFA: + Exclude: + - 'axlsx.gemspec' + +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Exclude: + - 'lib/axlsx/drawing/picture_locking.rb' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/workbook/defined_name.rb' + - 'lib/axlsx/workbook/worksheet/sheet_format_pr.rb' + - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' + - 'lib/axlsx/workbook/worksheet/sheet_view.rb' + - 'lib/axlsx/workbook/worksheet/table_style_info.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleAlignWith. +# SupportedStylesAlignWith: either, start_of_block, start_of_line +Layout/BlockAlignment: + Exclude: + - 'lib/axlsx/util/simple_typed_list.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/workbook/tc_defined_name.rb' + - 'test/workbook/worksheet/tc_header_footer.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/ClosingParenthesisIndentation: + Exclude: + - 'lib/axlsx/stylesheet/styles.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Layout/ElseAlignment: + Exclude: + - 'lib/axlsx/workbook/worksheet/merged_cells.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/workbook/worksheet/tc_date_time_converter.rb' + +# Offense count: 90 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterGuardClause: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'lib/axlsx/drawing/bar_series.rb' + - 'test/benchmark.rb' + +# Offense count: 285 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Enabled: false + +# Offense count: 32 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLinesAroundMethodBody: + Enabled: false + +# Offense count: 96 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines +Layout/EmptyLinesAroundModuleBody: + Enabled: false + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleAlignWith, Severity. +# SupportedStylesAlignWith: keyword, variable, start_of_line +Layout/EndAlignment: + Exclude: + - 'lib/axlsx/workbook/worksheet/merged_cells.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/workbook/worksheet/tc_date_time_converter.rb' + +# Offense count: 58 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/FirstArrayElementIndentation: + Exclude: + - 'lib/axlsx/package.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent + +# Offense count: 48 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/HashAlignment: + Exclude: + - 'lib/axlsx/package.rb' + - 'lib/axlsx/util/storage.rb' + - 'lib/axlsx/workbook/worksheet/border_creator.rb' + - 'test/stylesheet/tc_cell_alignment.rb' + - 'test/tc_axlsx.rb' + - 'test/workbook/tc_workbook_view.rb' + - 'test/workbook/worksheet/auto_filter/tc_filters.rb' + - 'test/workbook/worksheet/tc_conditional_formatting.rb' + - 'test/workbook/worksheet/tc_data_validation.rb' + - 'test/workbook/worksheet/tc_sheet_view.rb' + - 'test/workbook/worksheet/tc_table_style_info.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/HeredocIndentation: + Exclude: + - 'lib/axlsx/drawing/vml_drawing.rb' + - 'lib/axlsx/drawing/vml_shape.rb' + +# Offense count: 48 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, indented_internal_methods +Layout/IndentationConsistency: + Enabled: false + +# Offense count: 126 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Width, AllowedPatterns. +Layout/IndentationWidth: + Enabled: false + +# Offense count: 218 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. +Layout/LeadingCommentSpace: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineHashBraceLayout: + Exclude: + - 'lib/axlsx/stylesheet/styles.rb' + - 'test/tc_axlsx.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineMethodCallBraceLayout: + Exclude: + - 'lib/axlsx/stylesheet/styles.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/MultilineOperationIndentation: + Exclude: + - 'lib/axlsx/package.rb' + +# Offense count: 264 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAfterComma: + Enabled: false + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleInsidePipes. +# SupportedStylesInsidePipes: space, no_space +Layout/SpaceAroundBlockParameters: + Exclude: + - 'lib/axlsx/workbook/worksheet/row.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 184 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAroundKeyword: + Exclude: + - 'lib/axlsx/package.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + +# Offense count: 343 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# SupportedStylesForExponentOperator: space, no_space +Layout/SpaceAroundOperators: + Enabled: false + +# Offense count: 55 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Enabled: false + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceBeforeComma: + Exclude: + - 'test/workbook/worksheet/auto_filter/tc_filters.rb' + - 'test/workbook/worksheet/tc_comment.rb' + - 'test/workbook/worksheet/tc_page_setup.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment. +Layout/SpaceBeforeFirstArg: + Exclude: + - 'lib/axlsx/stylesheet/font.rb' + - 'lib/axlsx/workbook/workbook_view.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'lib/axlsx/workbook/worksheet/data_validation.rb' + - 'lib/axlsx/workbook/worksheet/sheet_view.rb' + - 'test/workbook/worksheet/auto_filter/tc_filters.rb' + +# Offense count: 139 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Enabled: false + +# Offense count: 227 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Enabled: false + +# Offense count: 82 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, compact, no_space +Layout/SpaceInsideParens: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceInsidePercentLiteralDelimiters: + Exclude: + - 'axlsx.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideReferenceBrackets: + Exclude: + - 'test/drawing/tc_d_lbls.rb' + +# Offense count: 1 +Lint/AmbiguousAssignment: + Exclude: + - 'test/workbook/worksheet/tc_rich_text.rb' + +# Offense count: 2 +# Configuration parameters: AllowedMethods, AllowedPatterns. +Lint/AmbiguousBlockAssociation: + Exclude: + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 24 +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'lib/axlsx/drawing/area_series.rb' + - 'lib/axlsx/drawing/line_series.rb' + - 'lib/axlsx/drawing/pie_series.rb' + - 'lib/axlsx/workbook/worksheet/dimension.rb' + - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/tc_axlsx.rb' + - 'test/workbook/worksheet/tc_cell.rb' + - 'test/workbook/worksheet/tc_date_time_converter.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowSafeAssignment. +Lint/AssignmentInCondition: + Exclude: + - 'lib/axlsx/drawing/area_chart.rb' + - 'lib/axlsx/drawing/line_chart.rb' + - 'lib/axlsx/workbook/shared_strings_table.rb' + +# Offense count: 11 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/BooleanSymbol: + Exclude: + - 'lib/axlsx/stylesheet/font.rb' + - 'lib/axlsx/util/validators.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + - 'test/util/tc_validators.rb' + - 'test/workbook/tc_workbook.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/DisjunctiveAssignmentInConstructor: + Exclude: + - 'lib/axlsx/drawing/num_data_source.rb' + +# Offense count: 2 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/merged_cells.rb' + +# Offense count: 4 +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: + Exclude: + - 'test/stylesheet/tc_styles.rb' + +# Offense count: 1 +Lint/NonLocalExitFromIterator: + Exclude: + - 'lib/axlsx/util/validators.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowPercentLiteralArrayArgument. +Lint/RedundantSplatExpansion: + Exclude: + - 'test/drawing/tc_d_lbls.rb' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +Lint/RedundantStringCoercion: + Exclude: + - 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + - 'test/drawing/tc_axis.rb' + - 'test/stylesheet/tc_table_style_element.rb' + - 'test/workbook/worksheet/tc_comment.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Lint/ScriptPermission: + Exclude: + - 'test/benchmark.rb' + - 'test/profile.rb' + +# Offense count: 23 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: strict, consistent +Lint/SymbolConversion: + Exclude: + - 'test/doc_props/tc_app.rb' + +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/drawing/axes.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table.rb' + - 'lib/axlsx/workbook/worksheet/sheet_view.rb' + - 'test/drawing/tc_bar_series.rb' + - 'test/stylesheet/tc_styles.rb' + - 'test/util/tc_validators.rb' + - 'test/workbook/worksheet/tc_data_validation.rb' + - 'test/workbook/worksheet/tc_sheet_protection.rb' + - 'test/workbook/worksheet/tc_sheet_view.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'lib/axlsx/package.rb' + - 'lib/axlsx/util/serialized_attributes.rb' + - 'lib/axlsx/util/validators.rb' + +# Offense count: 2 +Lint/UselessAssignment: + Exclude: + - 'lib/axlsx/workbook/worksheet/header_footer.rb' + - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' + +# Offense count: 7 +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'lib/axlsx/drawing/title.rb' + - 'lib/axlsx/util/simple_typed_list.rb' + - 'lib/axlsx/util/storage.rb' + - 'lib/axlsx/workbook/worksheet/data_bar.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table.rb' + +# Offense count: 163 +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. +Metrics/AbcSize: + Max: 227 + +# Offense count: 2 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. +# AllowedMethods: refine +Metrics/BlockLength: + Max: 54 + +# Offense count: 28 +# Configuration parameters: CountComments, CountAsOne. +Metrics/ClassLength: + Max: 710 + +# Offense count: 21 +# Configuration parameters: AllowedMethods, AllowedPatterns. +Metrics/CyclomaticComplexity: + Max: 25 + +# Offense count: 141 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. +Metrics/MethodLength: + Max: 128 + +# Offense count: 2 +# Configuration parameters: CountComments, CountAsOne. +Metrics/ModuleLength: + Max: 115 + +# Offense count: 17 +# Configuration parameters: AllowedMethods, AllowedPatterns. +Metrics/PerceivedComplexity: + Max: 29 + +# Offense count: 2 +Naming/AccessorMethodName: + Exclude: + - 'lib/axlsx/drawing/axes.rb' + - 'lib/axlsx/workbook/worksheet/data_validation.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Naming/BinaryOperatorParameterName: + Exclude: + - 'lib/axlsx/util/simple_typed_list.rb' + +# Offense count: 7 +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Exclude: + - 'lib/axlsx/drawing/bar_3D_chart.rb' + - 'lib/axlsx/drawing/line_3D_chart.rb' + - 'lib/axlsx/drawing/pie_3D_chart.rb' + - 'lib/axlsx/drawing/view_3D.rb' + - 'test/drawing/tc_bar_3D_chart.rb' + - 'test/drawing/tc_pie_3D_chart.rb' + - 'test/drawing/tc_view_3D.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: lowercase, uppercase +Naming/HeredocDelimiterCase: + Exclude: + - 'axlsx.gemspec' + +# Offense count: 1 +# Configuration parameters: ForbiddenDelimiters. +# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +Naming/HeredocDelimiterNaming: + Exclude: + - 'axlsx.gemspec' + +# Offense count: 1 +# Configuration parameters: EnforcedStyleForLeadingUnderscores. +# SupportedStylesForLeadingUnderscores: disallowed, required, optional +Naming/MemoizedInstanceVariableName: + Exclude: + - 'lib/axlsx/workbook/worksheet/sheet_pr.rb' + +# Offense count: 201 +# Configuration parameters: EnforcedStyle, AllowedPatterns. +# SupportedStyles: snake_case, camelCase +Naming/MethodName: + Enabled: false + +# Offense count: 422 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: + Enabled: false + +# Offense count: 5 +# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. +# NamePrefix: is_, has_, have_ +# ForbiddenPrefixes: is_, has_, have_ +# AllowedMethods: is_a? +# MethodDefinitionMacros: define_method, define_singleton_method +Naming/PredicateName: + Exclude: + - 'spec/**/*' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/worksheet_comments.rb' + - 'lib/axlsx/workbook/worksheet/worksheet_drawing.rb' + +# Offense count: 96 +# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns. +# SupportedStyles: snake_case, camelCase +Naming/VariableName: + Enabled: false + +# Offense count: 34 +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. +# SupportedStyles: snake_case, normalcase, non_integer +# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 +Naming/VariableNumber: + Exclude: + - 'lib/axlsx/util/validators.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/cell_serializer.rb' + - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' + - 'test/rels/tc_relationship.rb' + - 'test/rels/tc_relationships.rb' + - 'test/tc_package.rb' + - 'test/workbook/worksheet/tc_cell.rb' + - 'test/workbook/worksheet/tc_date_time_converter.rb' + - 'test/workbook/worksheet/tc_sheet_view.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Security/IoMethods: + Exclude: + - 'lib/axlsx/package.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: separated, grouped +Style/AccessorGrouping: + Exclude: + - 'lib/axlsx/workbook/worksheet/worksheet_drawing.rb' + +# Offense count: 149 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: prefer_alias, prefer_alias_method +Style/Alias: + Enabled: false + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, conditionals +Style/AndOr: + Exclude: + - 'lib/axlsx/workbook/worksheet/data_validation.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# AllowedMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'test/benchmark.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: MinBranchesCount. +Style/CaseLikeIf: + Exclude: + - 'lib/axlsx/workbook/worksheet/merged_cells.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/CharacterLiteral: + Exclude: + - 'lib/axlsx/workbook/worksheet/cell.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: is_a?, kind_of? +Style/ClassCheck: + Exclude: + - 'lib/axlsx/drawing/axes.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedMethods, AllowedPatterns. +# AllowedMethods: ==, equal?, eql? +Style/ClassEqualityComparison: + Exclude: + - 'lib/axlsx/workbook/worksheet/pane.rb' + - 'lib/axlsx/workbook/worksheet/selection.rb' + - 'lib/axlsx/workbook/worksheet/sheet_view.rb' + +# Offense count: 6 +Style/ClassVars: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/dimension.rb' + +# Offense count: 267 +# This cop supports safe autocorrection (--autocorrect). +Style/ColonMethodCall: + Enabled: false + +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Keywords, RequireColon. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE +Style/CommentAnnotation: + Exclude: + - 'lib/axlsx/drawing/axis.rb' + - 'lib/axlsx/drawing/chart.rb' + - 'lib/axlsx/drawing/view_3D.rb' + - 'test/drawing/tc_pie_series.rb' + - 'test/workbook/worksheet/tc_cell.rb' + - 'test/workbook/worksheet/tc_col.rb' + - 'test/workbook/worksheet/tc_comments.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ConcatArrayLiterals: + Exclude: + - 'lib/axlsx/workbook/worksheet/icon_set.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'lib/axlsx/drawing/title.rb' + - 'lib/axlsx/stylesheet/styles.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/data_bar.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/DefWithParentheses: + Exclude: + - 'lib/axlsx/stylesheet/styles.rb' + +# Offense count: 1 +Style/DocumentDynamicEvalDefinition: + Exclude: + - 'lib/axlsx/util/simple_typed_list.rb' + +# Offense count: 10 +# Configuration parameters: AllowedConstants. +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'test/**/*' + - 'lib/axlsx/content_type/content_type.rb' + - 'lib/axlsx/drawing/drawing.rb' + - 'lib/axlsx/rels/relationships.rb' + - 'lib/axlsx/stylesheet/styles.rb' + - 'lib/axlsx/util/constants.rb' + - 'lib/axlsx/util/validators.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/border_creator.rb' + - 'lib/axlsx/workbook/worksheet/row_breaks.rb' + - 'lib/axlsx/workbook/worksheet/sheet_format_pr.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/EachForSimpleLoop: + Exclude: + - 'test/workbook/worksheet/tc_rich_text.rb' + +# Offense count: 44 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/EvalWithLocation: + Exclude: + - 'lib/axlsx/util/simple_typed_list.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +Style/ExpandPathArguments: + Exclude: + - 'axlsx.gemspec' + - 'test/tc_package.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/FileWrite: + Exclude: + - 'lib/axlsx/util/zip_command.rb' + - 'test/benchmark.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Exclude: + - 'lib/axlsx/drawing/pic.rb' + - 'lib/axlsx/drawing/view_3D.rb' + - 'lib/axlsx/drawing/vml_drawing.rb' + - 'lib/axlsx/util/accessors.rb' + - 'lib/axlsx/util/validators.rb' + - 'lib/axlsx/workbook/worksheet/dimension.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns. +# SupportedStyles: annotated, template, unannotated +Style/FormatStringToken: + EnforcedStyle: unannotated + +# Offense count: 267 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: + Exclude: + - 'test/profile.rb' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: + Exclude: + - 'lib/axlsx/drawing/num_val.rb' + - 'lib/axlsx/drawing/str_val.rb' + - 'lib/axlsx/stylesheet/styles.rb' + - 'lib/axlsx/util/zip_command.rb' + - 'lib/axlsx/workbook/worksheet/pane.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table.rb' + - 'lib/axlsx/workbook/worksheet/row.rb' + - 'lib/axlsx/workbook/worksheet/sheet_pr.rb' + - 'lib/axlsx/workbook/worksheet/table.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowSplatArgument. +Style/HashConversion: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/workbook/worksheet/cell_serializer.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedReceivers. +# AllowedReceivers: Thread.current +Style/HashEachMethods: + Exclude: + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + - 'test/workbook/worksheet/tc_table_style_info.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 1230 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either, consistent +Style/HashSyntax: + Enabled: false + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/HashTransformKeys: + Exclude: + - 'lib/axlsx/workbook/worksheet/cell_serializer.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowIfModifier. +Style/IfInsideElse: + Exclude: + - 'lib/axlsx/stylesheet/styles.rb' + +# Offense count: 37 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: + Enabled: false + +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: line_count_dependent, lambda, literal +Style/Lambda: + Exclude: + - 'lib/axlsx/drawing/chart.rb' + - 'lib/axlsx/drawing/scaling.rb' + - 'lib/axlsx/stylesheet/gradient_fill.rb' + - 'lib/axlsx/stylesheet/gradient_stop.rb' + - 'lib/axlsx/stylesheet/styles.rb' + - 'lib/axlsx/util/validators.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/LineEndConcatenation: + Exclude: + - 'lib/axlsx/package.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedMethods, AllowedPatterns. +Style/MethodCallWithoutArgsParentheses: + Exclude: + - 'lib/axlsx/package.rb' + - 'test/benchmark.rb' + - 'test/drawing/tc_vml_drawing.rb' + - 'test/drawing/tc_vml_shape.rb' + - 'test/workbook/worksheet/tc_comments.rb' + - 'test/workbook/worksheet/tc_rich_text.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline +Style/MethodDefParentheses: + Exclude: + - 'lib/axlsx/util/simple_typed_list.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMethodComparison. +Style/MultipleComparison: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/stylesheet/font.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + - 'test/workbook/tc_workbook_view.rb' + +# Offense count: 17 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/axlsx/content_type/default.rb' + - 'lib/axlsx/content_type/override.rb' + - 'lib/axlsx/drawing/cat_axis.rb' + - 'lib/axlsx/drawing/line_3D_chart.rb' + - 'lib/axlsx/drawing/pic.rb' + - 'lib/axlsx/drawing/view_3D.rb' + - 'lib/axlsx/stylesheet/dxf.rb' + - 'lib/axlsx/util/constants.rb' + - 'lib/axlsx/util/simple_typed_list.rb' + - 'lib/axlsx/util/storage.rb' + - 'lib/axlsx/version.rb' + - 'lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb' + - 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb' + - 'lib/axlsx/workbook/worksheet/data_bar.rb' + - 'lib/axlsx/workbook/worksheet/sheet_view.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: both, prefix, postfix +Style/NegatedIf: + Exclude: + - 'lib/axlsx/drawing/num_val.rb' + - 'lib/axlsx/drawing/str_val.rb' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/stylesheet/styles.rb' + - 'lib/axlsx/util/zip_command.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/border_creator.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedMethods. +# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with +Style/NestedParenthesizedCalls: + Exclude: + - 'test/stylesheet/tc_styles.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, MinBodyLength. +# SupportedStyles: skip_modifier_ifs, always +Style/Next: + Exclude: + - 'lib/axlsx/stylesheet/styles.rb' + +# Offense count: 17 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: predicate, comparison +Style/NilComparison: + Exclude: + - 'lib/axlsx/drawing/axis.rb' + - 'lib/axlsx/drawing/chart.rb' + - 'lib/axlsx/drawing/view_3D.rb' + - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/drawing/tc_series_title.rb' + - 'test/drawing/tc_title.rb' + - 'test/workbook/worksheet/tc_page_setup.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IncludeSemanticChanges. +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' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedOctalStyle. +# SupportedOctalStyles: zero_with_o, zero_only +Style/NumericLiteralPrefix: + Exclude: + - 'test/doc_props/tc_core.rb' + +# Offense count: 46 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns. +Style/NumericLiterals: + MinDigits: 11 + +# Offense count: 32 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/stylesheet/font.rb' + - 'lib/axlsx/util/simple_typed_list.rb' + - 'lib/axlsx/util/validators.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/sheet_pr.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/drawing/tc_marker.rb' + - 'test/drawing/tc_one_cell_anchor.rb' + - 'test/drawing/tc_two_cell_anchor.rb' + - 'test/rels/tc_relationships.rb' + - 'test/stylesheet/tc_styles.rb' + - 'test/tc_package.rb' + - 'test/util/tc_simple_typed_list.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/OperatorMethodCall: + Exclude: + - 'lib/axlsx/drawing/vml_shape.rb' + +# Offense count: 11 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/util/validators.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/col.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +Style/ParallelAssignment: + Exclude: + - 'lib/axlsx/drawing/area_series.rb' + - 'lib/axlsx/drawing/bar_3D_chart.rb' + - 'lib/axlsx/drawing/bar_chart.rb' + - 'lib/axlsx/drawing/line_series.rb' + - 'lib/axlsx/drawing/marker.rb' + - 'lib/axlsx/drawing/scaling.rb' + - 'lib/axlsx/drawing/ser_axis.rb' + - 'lib/axlsx/drawing/two_cell_anchor.rb' + - 'lib/axlsx/drawing/view_3D.rb' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/workbook/worksheet/row.rb' + - 'test/rels/tc_relationships.rb' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions. +Style/ParenthesesAroundCondition: + Exclude: + - 'lib/axlsx/stylesheet/font.rb' + - 'lib/axlsx/util/validators.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/data_validation.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + +# Offense count: 17 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'axlsx.gemspec' + - 'lib/axlsx/drawing/d_lbls.rb' + - 'lib/axlsx/drawing/pic.rb' + - 'lib/axlsx/drawing/view_3D.rb' + - 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb' + - 'lib/axlsx/workbook/worksheet/table_style_info.rb' + - 'test/stylesheet/tc_styles.rb' + - 'test/tc_package.rb' + - 'test/workbook/tc_defined_name.rb' + - 'test/workbook/tc_workbook_view.rb' + - 'test/workbook/worksheet/tc_header_footer.rb' + - 'test/workbook/worksheet/tc_pivot_table.rb' + - 'test/workbook/worksheet/tc_table_style_info.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +Style/PerlBackrefs: + Exclude: + - 'lib/axlsx.rb' + - 'test/workbook/worksheet/tc_sheet_protection.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: short, verbose +Style/PreferredHashMethods: + Exclude: + - 'lib/axlsx.rb' + - 'test/workbook/tc_shared_strings_table.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: same_as_string_literals, single_quotes, double_quotes +Style/QuotedSymbols: + Exclude: + - 'lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowedCompactTypes. +# SupportedStyles: compact, exploded +Style/RaiseArgs: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/util/zip_command.rb' + - 'lib/axlsx/workbook/worksheet/border_creator.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/RandomWithOffset: + Exclude: + - 'lib/axlsx/drawing/vml_shape.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantCondition: + Exclude: + - 'lib/axlsx/drawing/area_series.rb' + - 'lib/axlsx/drawing/line_series.rb' + +# Offense count: 238 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantFileExtensionInRequire: + Enabled: false + +# Offense count: 14 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/RedundantInterpolation: + Exclude: + - 'lib/axlsx/drawing/chart.rb' + - 'lib/axlsx/drawing/drawing.rb' + - 'lib/axlsx/drawing/pic.rb' + - 'lib/axlsx/drawing/vml_drawing.rb' + - 'lib/axlsx/workbook/worksheet/comments.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb' + - 'lib/axlsx/workbook/worksheet/table.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/content_type/tc_content_type.rb' + +# Offense count: 13 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantParentheses: + Exclude: + - 'lib/axlsx/drawing/area_series.rb' + - 'lib/axlsx/drawing/bar_3D_chart.rb' + - 'lib/axlsx/drawing/bar_chart.rb' + - 'lib/axlsx/drawing/line_3D_chart.rb' + - 'lib/axlsx/drawing/line_series.rb' + - 'lib/axlsx/drawing/scatter_series.rb' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'test/stylesheet/tc_styles.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantRegexpEscape: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table.rb' + - 'lib/axlsx/workbook/worksheet/table.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/package.rb' + - 'lib/axlsx/stylesheet/styles.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + +# Offense count: 37 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantSelf: + Enabled: false + +# Offense count: 18 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: + Exclude: + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'test/tc_package.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'lib/axlsx.rb' + - 'test/workbook/worksheet/tc_date_time_converter.rb' + +# Offense count: 28 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/SelfAssignment: + Exclude: + - 'lib/axlsx/stylesheet/color.rb' + +# Offense count: 367 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowAsExpressionSeparator. +Style/Semicolon: + Enabled: false + +# Offense count: 244 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowIfMethodIsEmpty. +Style/SingleLineMethods: + Enabled: false + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'lib/axlsx.rb' + - 'lib/axlsx/drawing/area_chart.rb' + - 'lib/axlsx/drawing/line_chart.rb' + - 'lib/axlsx/util/simple_typed_list.rb' + - 'lib/axlsx/workbook/worksheet/pivot_table.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'lib/axlsx/util/validators.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: RequireEnglish, EnforcedStyle. +# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names +Style/SpecialGlobalVars: + Exclude: + - 'test/benchmark.rb' + - 'test/profile.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/StringChars: + Exclude: + - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' + +# Offense count: 28 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Enabled: false + +# Offense count: 1571 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiteralsInInterpolation: + Exclude: + - 'test/content_type/tc_content_type.rb' + +# Offense count: 97 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 23 +# This cop supports safe autocorrection (--autocorrect). +Style/SymbolLiteral: + Exclude: + - 'test/doc_props/tc_app.rb' + +# Offense count: 14 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. +# AllowedMethods: define_method +Style/SymbolProc: + Exclude: + - 'lib/axlsx/drawing/drawing.rb' + - 'lib/axlsx/stylesheet/styles.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/cell.rb' + - 'lib/axlsx/workbook/worksheet/conditional_formatting.rb' + - 'lib/axlsx/workbook/worksheet/worksheet.rb' + - 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb' + - 'test/doc_props/tc_app.rb' + - 'test/doc_props/tc_core.rb' + - 'test/stylesheet/tc_styles.rb' + - 'test/workbook/tc_shared_strings_table.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'lib/axlsx/drawing/area_series.rb' + - 'lib/axlsx/drawing/line_series.rb' + - 'lib/axlsx/drawing/scatter_series.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'lib/axlsx/stylesheet/styles.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'test/stylesheet/tc_styles.rb' + - 'test/workbook/worksheet/tc_pivot_table.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: + Exclude: + - 'lib/axlsx/workbook/worksheet/border_creator.rb' + - 'test/workbook/worksheet/tc_date_time_converter.rb' + - 'test/workbook/worksheet/tc_worksheet.rb' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods. +# AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym +Style/TrivialAccessors: + Exclude: + - 'lib/axlsx/drawing/area_series.rb' + - 'lib/axlsx/drawing/axis.rb' + - 'lib/axlsx/drawing/bar_series.rb' + - 'lib/axlsx/drawing/bubble_series.rb' + - 'lib/axlsx/drawing/line_series.rb' + - 'lib/axlsx/drawing/scatter_series.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/conditional_formatting.rb' + - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' + - 'lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/UnpackFirst: + Exclude: + - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/WhileUntilDo: + Exclude: + - 'lib/axlsx.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/WhileUntilModifier: + Exclude: + - 'lib/axlsx/workbook/worksheet/color_scale.rb' + +# Offense count: 41 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, MinSize, WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + Enabled: false + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: forbid_for_all_comparison_operators, forbid_for_equality_operators_only, require_for_all_comparison_operators, require_for_equality_operators_only +Style/YodaCondition: + Exclude: + - 'lib/axlsx/workbook/worksheet/col.rb' + +# Offense count: 12 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ZeroLengthPredicate: + Exclude: + - 'lib/axlsx/package.rb' + - 'lib/axlsx/util/simple_typed_list.rb' + - 'lib/axlsx/workbook/workbook.rb' + - 'lib/axlsx/workbook/worksheet/sheet_pr.rb' + - 'test/rels/tc_relationships.rb' + - 'test/stylesheet/tc_styles.rb' + - 'test/tc_package.rb' + - 'test/util/tc_simple_typed_list.rb' + +# Offense count: 345 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 574 -- cgit v1.2.3 From 3460a7fbb808d43a2a027fb98ef40209498a86fd Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 19:03:48 +0200 Subject: Fix Layout/BlockAlignment offenses Manually fixed --- .rubocop_todo.yml | 11 ----------- lib/axlsx/util/simple_typed_list.rb | 2 +- lib/axlsx/workbook/worksheet/worksheet.rb | 2 +- test/workbook/tc_defined_name.rb | 3 +-- test/workbook/worksheet/tc_header_footer.rb | 2 +- 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f2f2e40e..c56a7f5f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -36,17 +36,6 @@ Layout/ArgumentAlignment: - 'lib/axlsx/workbook/worksheet/sheet_view.rb' - 'lib/axlsx/workbook/worksheet/table_style_info.rb' -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleAlignWith. -# SupportedStylesAlignWith: either, start_of_block, start_of_line -Layout/BlockAlignment: - Exclude: - - 'lib/axlsx/util/simple_typed_list.rb' - - 'lib/axlsx/workbook/worksheet/worksheet.rb' - - 'test/workbook/tc_defined_name.rb' - - 'test/workbook/worksheet/tc_header_footer.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Layout/ClosingParenthesisIndentation: diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 5a15ddff..98c67d6b 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -43,7 +43,7 @@ module Axlsx result = Array.new(max_column_count) { Array.new(row_count) } # yes, I know it is silly, but that warning is really annoying row_count.times do |row_index| - max_column_count.times do |column_index| + max_column_count.times do |column_index| datum = if @list[row_index].cells.size >= max_column_count @list[row_index].cells[column_index] elsif block_given? diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 9a9c4506..2ab01862 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -721,7 +721,7 @@ module Axlsx end def outline(collection, range, level = 1, collapsed = true) - range.each do |index| + range.each do |index| unless (item = collection[index]).nil? item.outline_level = level item.hidden = collapsed diff --git a/test/workbook/tc_defined_name.rb b/test/workbook/tc_defined_name.rb index 2d3ff0d9..aa4f84e1 100644 --- a/test/workbook/tc_defined_name.rb +++ b/test/workbook/tc_defined_name.rb @@ -17,11 +17,10 @@ class TestDefinedNames < Test::Unit::TestCase end def test_boolean_attributes - %w(workbook_parameter publish_to_server xlm vb_proceedure function hidden).each do |attr| + %w(workbook_parameter publish_to_server xlm vb_proceedure function hidden).each do |attr| assert_raise(ArgumentError, 'only booleanish allowed in string attributes') { @dn.send("#{attr}=", 'foo') } assert_nothing_raised { @dn.send("#{attr}=", 1) } end - end def test_local_sheet_id diff --git a/test/workbook/worksheet/tc_header_footer.rb b/test/workbook/worksheet/tc_header_footer.rb index bba879a1..fb95d7bf 100644 --- a/test/workbook/worksheet/tc_header_footer.rb +++ b/test/workbook/worksheet/tc_header_footer.rb @@ -59,7 +59,7 @@ class TestHeaderFooter < Test::Unit::TestCase end def test_boolean_attributes - %w(different_first different_odd_even).each do |attr| + %w(different_first different_odd_even).each do |attr| assert_raise(ArgumentError, 'only booleanish allowed in string attributes') { @hf.send("#{attr}=", 'foo') } assert_nothing_raised { @hf.send("#{attr}=", 1) } end -- cgit v1.2.3 From 70d3dfc768ecbea6ea52e9481fbfd3068445bbc4 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:36:48 +0200 Subject: Fix Layout/ElseAlignment Manually fixed --- .rubocop_todo.yml | 18 ------- lib/axlsx/workbook/worksheet/merged_cells.rb | 12 ++--- lib/axlsx/workbook/worksheet/worksheet.rb | 8 ++-- test/workbook/worksheet/tc_date_time_converter.rb | 58 +++++++++++------------ 4 files changed, 39 insertions(+), 57 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c56a7f5f..817fdd67 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -42,14 +42,6 @@ Layout/ClosingParenthesisIndentation: Exclude: - 'lib/axlsx/stylesheet/styles.rb' -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -Layout/ElseAlignment: - Exclude: - - 'lib/axlsx/workbook/worksheet/merged_cells.rb' - - 'lib/axlsx/workbook/worksheet/worksheet.rb' - - 'test/workbook/worksheet/tc_date_time_converter.rb' - # Offense count: 90 # This cop supports safe autocorrection (--autocorrect). Layout/EmptyLineAfterGuardClause: @@ -83,16 +75,6 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: false -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleAlignWith, Severity. -# SupportedStylesAlignWith: keyword, variable, start_of_line -Layout/EndAlignment: - Exclude: - - 'lib/axlsx/workbook/worksheet/merged_cells.rb' - - 'lib/axlsx/workbook/worksheet/worksheet.rb' - - 'test/workbook/worksheet/tc_date_time_converter.rb' - # Offense count: 58 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. diff --git a/lib/axlsx/workbook/worksheet/merged_cells.rb b/lib/axlsx/workbook/worksheet/merged_cells.rb index 67753bd3..cb5bae93 100644 --- a/lib/axlsx/workbook/worksheet/merged_cells.rb +++ b/lib/axlsx/workbook/worksheet/merged_cells.rb @@ -16,12 +16,12 @@ module Axlsx # range like 'A1:C1' def add(cells) self << if cells.is_a?(String) - cells - elsif cells.is_a?(Array) - Axlsx::cell_range(cells, false) - elsif cells.is_a?(Row) - Axlsx::cell_range(cells, false) - end + cells + elsif cells.is_a?(Array) + Axlsx::cell_range(cells, false) + elsif cells.is_a?(Row) + Axlsx::cell_range(cells, false) + end end # serialize the object diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 2ab01862..a32bc5b6 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -507,10 +507,10 @@ module Axlsx def add_page_break(cell) DataTypeValidator.validate :worksheet_page_break, [String, Cell], cell column_index, row_index = if cell.is_a?(String) - Axlsx.name_to_indices(cell) - else - cell.pos - end + Axlsx.name_to_indices(cell) + else + cell.pos + end if column_index > 0 col_breaks.add_break(:id => column_index) end diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index 19278e95..225c1893 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -63,21 +63,21 @@ class TestDateTimeConverter < Test::Unit::TestCase def test_time_to_serial_1900 Axlsx::Workbook.date1904 = false tests = if @extended_time_range - { # examples taken straight from the spec - "1893-08-05T00:00:01Z" => -2337.999989, - "1899-12-28T18:00:00Z" => -1.25, - "1910-02-03T10:05:54Z" => 3687.4207639, - "1900-01-01T12:00:00Z" => 2.5, # wrongly indicated as 1.5 in the spec! - "9999-12-31T23:59:59Z" => 2958465.9999884 - } - else - { # examples taken inside the possible values - "1970-01-01T00:00:00Z" => 25569.0, # Unix epoch - "1970-01-01T12:00:00Z" => 25569.5, - "2000-01-01T00:00:00Z" => 36526.0, - "2038-01-19T03:14:07Z" => 50424.134803, # max signed timestamp in 32bit - } - end + { # examples taken straight from the spec + "1893-08-05T00:00:01Z" => -2337.999989, + "1899-12-28T18:00:00Z" => -1.25, + "1910-02-03T10:05:54Z" => 3687.4207639, + "1900-01-01T12:00:00Z" => 2.5, # wrongly indicated as 1.5 in the spec! + "9999-12-31T23:59:59Z" => 2958465.9999884 + } + else + { # examples taken inside the possible values + "1970-01-01T00:00:00Z" => 25569.0, # Unix epoch + "1970-01-01T12:00:00Z" => 25569.5, + "2000-01-01T00:00:00Z" => 36526.0, + "2038-01-19T03:14:07Z" => 50424.134803, # max signed timestamp in 32bit + } + end tests.each do |time_string, expected| serial = Axlsx::DateTimeConverter::time_to_serial Time.parse(time_string) assert_in_delta expected, serial, @margin_of_error @@ -89,20 +89,20 @@ class TestDateTimeConverter < Test::Unit::TestCase # ruby 1.8.7 cannot parse dates prior to epoch. see http://ruby-doc.org/core-1.8.7/Time.html tests = if @extended_time_range - { # examples taken straight from the spec - "1893-08-05T00:00:01Z" => -3799.999989, - "1910-02-03T10:05:54Z" => 2225.4207639, - "1904-01-01T12:00:00Z" => 0.5000000, - "9999-12-31T23:59:59Z" => 2957003.9999884 - } - else - { # examples taken inside the possible values - "1970-01-01T00:00:00Z" => 24107.0, # Unix epoch - "1970-01-01T12:00:00Z" => 24107.5, - "2000-01-01T00:00:00Z" => 35064.0, - "2038-01-19T03:14:07Z" => 48962.134803, # max signed timestamp in 32bit - } - end + { # examples taken straight from the spec + "1893-08-05T00:00:01Z" => -3799.999989, + "1910-02-03T10:05:54Z" => 2225.4207639, + "1904-01-01T12:00:00Z" => 0.5000000, + "9999-12-31T23:59:59Z" => 2957003.9999884 + } + else + { # examples taken inside the possible values + "1970-01-01T00:00:00Z" => 24107.0, # Unix epoch + "1970-01-01T12:00:00Z" => 24107.5, + "2000-01-01T00:00:00Z" => 35064.0, + "2038-01-19T03:14:07Z" => 48962.134803, # max signed timestamp in 32bit + } + end tests.each do |time_string, expected| serial = Axlsx::DateTimeConverter::time_to_serial Time.parse(time_string) assert_in_delta expected, serial, @margin_of_error -- cgit v1.2.3 From 6ddcc4588013dfa46fe34a235163dad2b66bdc4c Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:38:09 +0200 Subject: Fix Layout/EmptyLinesAroundBlockBody offenses ``` rubocop --only Layout/EmptyLinesAroundBlockBody -a ``` --- .rubocop_todo.yml | 9 --------- lib/axlsx/drawing/bar_series.rb | 1 - test/benchmark.rb | 1 - 3 files changed, 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 817fdd67..26b70dfc 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -47,15 +47,6 @@ Layout/ClosingParenthesisIndentation: Layout/EmptyLineAfterGuardClause: Enabled: false -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: empty_lines, no_empty_lines -Layout/EmptyLinesAroundBlockBody: - Exclude: - - 'lib/axlsx/drawing/bar_series.rb' - - 'test/benchmark.rb' - # Offense count: 285 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb index e90a2818..2ee40488 100644 --- a/lib/axlsx/drawing/bar_series.rb +++ b/lib/axlsx/drawing/bar_series.rb @@ -59,7 +59,6 @@ module Axlsx # @return [String] def to_xml_string(str = '') super(str) do - colors.each_with_index do |c, index| str << '' str << ('') diff --git a/test/benchmark.rb b/test/benchmark.rb index 8d90cdf5..e9f6c22b 100644 --- a/test/benchmark.rb +++ b/test/benchmark.rb @@ -9,7 +9,6 @@ input = (32..126).to_a.pack('U*').chars.to_a 20.times { row << input.shuffle.join} times = 3000 Benchmark.bmbm(30) do |x| - x.report('axlsx_noautowidth') { p = Axlsx::Package.new p.workbook do |wb| -- cgit v1.2.3 From fc73023ea783ff7fdeb11ac903baa9142c98cd1c Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:40:27 +0200 Subject: Fix Layout/FirstArrayElementIndentation offense ``` rubocop --only Layout/FirstArrayElementIndentation -a ``` --- .rubocop_todo.yml | 8 -------- lib/axlsx/package.rb | 10 +++++----- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 26b70dfc..86ee1482 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -72,14 +72,6 @@ Layout/EmptyLinesAroundModuleBody: Layout/ExtraSpacing: Enabled: false -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: special_inside_parentheses, consistent, align_brackets -Layout/FirstArrayElementIndentation: - Exclude: - - 'lib/axlsx/package.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IndentationWidth. diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 29f72d5c..ed73397a 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -211,11 +211,11 @@ module Axlsx # @private def parts parts = [ - {:entry => "xl/#{STYLES_PN}", :doc => workbook.styles, :schema => SML_XSD}, - {:entry => CORE_PN, :doc => @core, :schema => CORE_XSD}, - {:entry => APP_PN, :doc => @app, :schema => APP_XSD}, - {:entry => WORKBOOK_RELS_PN, :doc => workbook.relationships, :schema => RELS_XSD}, - {:entry => WORKBOOK_PN, :doc => workbook, :schema => SML_XSD} + {:entry => "xl/#{STYLES_PN}", :doc => workbook.styles, :schema => SML_XSD}, + {:entry => CORE_PN, :doc => @core, :schema => CORE_XSD}, + {:entry => APP_PN, :doc => @app, :schema => APP_XSD}, + {:entry => WORKBOOK_RELS_PN, :doc => workbook.relationships, :schema => RELS_XSD}, + {:entry => WORKBOOK_PN, :doc => workbook, :schema => SML_XSD} ] workbook.drawings.each do |drawing| -- cgit v1.2.3 From 1534eba0300a256a827990ba12f3297c5eda3514 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:48:27 +0200 Subject: Fix Layout/SpaceAroundBlockParameters offenses ``` rubocop --only Layout/SpaceAroundBlockParameters -a ``` --- .rubocop_todo.yml | 9 --------- lib/axlsx/workbook/worksheet/row.rb | 4 ++-- test/workbook/worksheet/tc_worksheet.rb | 4 ++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 86ee1482..9d8e7434 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -155,15 +155,6 @@ Layout/MultilineOperationIndentation: Layout/SpaceAfterComma: Enabled: false -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleInsidePipes. -# SupportedStylesInsidePipes: space, no_space -Layout/SpaceAroundBlockParameters: - Exclude: - - 'lib/axlsx/workbook/worksheet/row.rb' - - 'test/workbook/worksheet/tc_worksheet.rb' - # Offense count: 184 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index 376719ce..ee5b9509 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -105,14 +105,14 @@ module Axlsx # sets the color for every cell in this row def color=(color) - each_with_index do | cell, index | + each_with_index do |cell, index| cell.color = color.is_a?(Array) ? color[index] : color end end # sets the style for every cell in this row def style=(style) - each_with_index do | cell, index | + each_with_index do |cell, index| cell.style = style.is_a?(Array) ? style[index] : style end end diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 72fdf556..ed363118 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -233,7 +233,7 @@ class TestWorksheet < Test::Unit::TestCase @ws.add_row [1,2,3,4] @ws.add_row [1,2,3,4] @ws.col_style( (1..2), 1, :row_offset=>1) - @ws.rows[(1..-1)].each do | r | + @ws.rows[(1..-1)].each do |r| assert_equal(r.cells[1].style, 1) assert_equal(r.cells[2].style, 1) end @@ -271,7 +271,7 @@ class TestWorksheet < Test::Unit::TestCase @ws.add_row [1,2,3,4] @ws.add_row [1,2,3,4] @ws.row_style 1, 1, :col_offset=>1 - @ws.rows[1].cells[(1..-1)].each do | c | + @ws.rows[1].cells[(1..-1)].each do |c| assert_equal(c.style, 1) end assert_equal(@ws.rows[1].cells[0].style, 0) -- cgit v1.2.3 From ab7ef765bada307754b50c17fa63b5ae353a57fa Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:50:27 +0200 Subject: Fix Layout/SpaceAroundKeyword offenses ``` rubocop --only Layout/SpaceAroundKeyword -a ``` --- .rubocop_todo.yml | 7 ------- lib/axlsx/package.rb | 2 +- lib/axlsx/workbook/worksheet/cell.rb | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9d8e7434..eeb87828 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -162,13 +162,6 @@ Layout/SpaceAfterComma: Layout/SpaceAroundEqualsInParameterDefault: Enabled: false -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceAroundKeyword: - Exclude: - - 'lib/axlsx/package.rb' - - 'lib/axlsx/workbook/worksheet/cell.rb' - # Offense count: 343 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index ed73397a..5bd8d5c2 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -233,7 +233,7 @@ module Axlsx parts << {:entry => "xl/#{cache_definition.pn}", :doc => cache_definition} #, :schema => SML_XSD} end - workbook.comments.each do|comment| + workbook.comments.each do |comment| if comment.size > 0 parts << { :entry => "xl/#{comment.pn}", :doc => comment, :schema => SML_XSD } parts << { :entry => "xl/#{comment.vml_drawing.pn}", :doc => comment.vml_drawing, :schema => nil } diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index f52006bd..24865b4d 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -366,7 +366,7 @@ module Axlsx def merge(target) start, stop = if target.is_a?(String) [self.r, target] - elsif(target.is_a?(Cell)) + elsif target.is_a?(Cell) Axlsx.sort_cells([self, target]).map { |c| c.r } end self.row.worksheet.merge_cells "#{start}:#{stop}" unless stop.nil? -- cgit v1.2.3 From 54e3784364712d87df5014767d417dd1d0ba1184 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:51:42 +0200 Subject: Fix Layout/SpaceBeforeComma offenses ``` rubocop --only Layout/SpaceBeforeComma -a ``` --- .rubocop_todo.yml | 8 -------- test/workbook/worksheet/auto_filter/tc_filters.rb | 2 +- test/workbook/worksheet/tc_comment.rb | 2 +- test/workbook/worksheet/tc_page_setup.rb | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index eeb87828..2f36309d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -177,14 +177,6 @@ Layout/SpaceAroundOperators: Layout/SpaceBeforeBlockBraces: Enabled: false -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceBeforeComma: - Exclude: - - 'test/workbook/worksheet/auto_filter/tc_filters.rb' - - 'test/workbook/worksheet/tc_comment.rb' - - 'test/workbook/worksheet/tc_page_setup.rb' - # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment. diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb index 5de5d7d1..c7df0d57 100644 --- a/test/workbook/worksheet/auto_filter/tc_filters.rb +++ b/test/workbook/worksheet/auto_filter/tc_filters.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestFilters < Test::Unit::TestCase def setup @filters = Axlsx::Filters.new(:filter_items => [1, 'a'], - :date_group_items =>[ { :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 } ] , + :date_group_items =>[ { :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 } ], :blank => true) end diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb index b495c0bb..44a637e6 100644 --- a/test/workbook/worksheet/tc_comment.rb +++ b/test/workbook/worksheet/tc_comment.rb @@ -46,7 +46,7 @@ class TestComment < Test::Unit::TestCase assert(@c1.vml_shape.row == pos[1]) assert_equal(pos[0], @c1.vml_shape.left_column) assert(@c1.vml_shape.top_row == pos[1]) - assert_equal(pos[0] + 2 , @c1.vml_shape.right_column) + assert_equal(pos[0] + 2, @c1.vml_shape.right_column) assert(@c1.vml_shape.bottom_row == pos[1]+4) end diff --git a/test/workbook/worksheet/tc_page_setup.rb b/test/workbook/worksheet/tc_page_setup.rb index e12f93b5..8c566a61 100644 --- a/test/workbook/worksheet/tc_page_setup.rb +++ b/test/workbook/worksheet/tc_page_setup.rb @@ -133,7 +133,7 @@ class TestPageSetup < Test::Unit::TestCase fits = @ps.fit_to(:width => 1) assert_equal([1, 999], fits) fits = @ps.fit_to :height => 1 - assert_equal(fits, [999 ,1]) + assert_equal(fits, [999,1]) fits = @ps.fit_to :height => 7, :width => 2 assert_equal(fits, [2, 7]) assert_raise(ArgumentError) { puts @ps.fit_to(:width => true)} -- cgit v1.2.3 From 7ca771d9e05e76e3a1e69ecf5b51085e4dad2f9e Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:53:12 +0200 Subject: Fix Layout/SpaceInsideArrayLiteralBrackets offenses ``` rubocop --only Layout/SpaceInsideArrayLiteralBrackets -a ``` --- .rubocop_todo.yml | 11 ----------- lib/axlsx/workbook/worksheet/data_validation.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_view.rb | 2 +- test/workbook/worksheet/auto_filter/tc_filters.rb | 2 +- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2f36309d..95ca7d1d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -186,17 +186,6 @@ Layout/SpaceBeforeFirstArg: - 'lib/axlsx/workbook/workbook_view.rb' - 'test/workbook/worksheet/tc_worksheet.rb' -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. -# SupportedStyles: space, no_space, compact -# SupportedStylesForEmptyBrackets: space, no_space -Layout/SpaceInsideArrayLiteralBrackets: - Exclude: - - 'lib/axlsx/workbook/worksheet/data_validation.rb' - - 'lib/axlsx/workbook/worksheet/sheet_view.rb' - - 'test/workbook/worksheet/auto_filter/tc_filters.rb' - # Offense count: 139 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb index 0cd28069..d4b86e20 100644 --- a/lib/axlsx/workbook/worksheet/data_validation.rb +++ b/lib/axlsx/workbook/worksheet/data_validation.rb @@ -247,7 +247,7 @@ module Axlsx private def get_valid_attributes - attributes = [:allowBlank, :error, :errorStyle, :errorTitle, :prompt, :promptTitle, :showErrorMessage, :showInputMessage, :sqref, :type ] + attributes = [:allowBlank, :error, :errorStyle, :errorTitle, :prompt, :promptTitle, :showErrorMessage, :showInputMessage, :sqref, :type] if [:whole, :decimal, :data, :time, :date, :textLength].include?(@type) attributes << [:operator, :formula1] diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index 0ca87b3b..104243ce 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -49,7 +49,7 @@ module Axlsx :view, :top_left_cell, :color_id, :zoom_scale # instance values that must be serialized as their own elements - e.g. not attributes. - CHILD_ELEMENTS = [ :pane, :selections ] + CHILD_ELEMENTS = [:pane, :selections] # The pane object for the sheet view # @return [Pane] diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb index c7df0d57..d1c30446 100644 --- a/test/workbook/worksheet/auto_filter/tc_filters.rb +++ b/test/workbook/worksheet/auto_filter/tc_filters.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestFilters < Test::Unit::TestCase def setup @filters = Axlsx::Filters.new(:filter_items => [1, 'a'], - :date_group_items =>[ { :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 } ], + :date_group_items =>[{ :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 }], :blank => true) end -- cgit v1.2.3 From 6b1842b20e42b1de14433e162a025f936bce3260 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:54:53 +0200 Subject: Fix Layout/SpaceInsidePercentLiteralDelimiters ``` rubocop --only Layout/SpaceInsidePercentLiteralDelimiters -a ``` --- .rubocop_todo.yml | 6 ------ axlsx.gemspec | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 95ca7d1d..8f18d44c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -209,12 +209,6 @@ Layout/SpaceInsideHashLiteralBraces: Layout/SpaceInsideParens: Enabled: false -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceInsidePercentLiteralDelimiters: - Exclude: - - 'axlsx.gemspec' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. diff --git a/axlsx.gemspec b/axlsx.gemspec index 5da4d73f..400bf0e2 100644 --- a/axlsx.gemspec +++ b/axlsx.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.description = <<-eof xlsx spreadsheet generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx helps you create beautiful Office Open XML Spreadsheet documents ( Excel, Google Spreadsheets, Numbers, LibreOffice) without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine. eof - s.files = Dir.glob("{lib/**/*,examples/**/*.rb,examples/**/*.jpeg}") + %w{ LICENSE README.md Rakefile CHANGELOG.md .yardopts .yardopts_guide } + s.files = Dir.glob("{lib/**/*,examples/**/*.rb,examples/**/*.jpeg}") + %w{LICENSE README.md Rakefile CHANGELOG.md .yardopts .yardopts_guide} s.add_runtime_dependency 'nokogiri', '~> 1.10', '>= 1.10.4' s.add_runtime_dependency 'rubyzip', '>= 1.3.0', '< 3' -- cgit v1.2.3 From 6b7b7ebb8656d3c35c0b585872742f35da9e8caa Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 7 Apr 2023 23:55:45 +0200 Subject: Fix Layout/SpaceInsideReferenceBrackets offense ``` rubocop --only Layout/SpaceInsideReferenceBrackets -a ``` --- .rubocop_todo.yml | 9 --------- test/drawing/tc_d_lbls.rb | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8f18d44c..34cfa002 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -209,15 +209,6 @@ Layout/SpaceInsideHashLiteralBraces: Layout/SpaceInsideParens: Enabled: false -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBrackets: space, no_space -Layout/SpaceInsideReferenceBrackets: - Exclude: - - 'test/drawing/tc_d_lbls.rb' - # Offense count: 1 Lint/AmbiguousAssignment: Exclude: diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb index 60efeb7b..cc12b561 100644 --- a/test/drawing/tc_d_lbls.rb +++ b/test/drawing/tc_d_lbls.rb @@ -22,7 +22,7 @@ class TestDLbls < Test::Unit::TestCase def test_initialization_with_optoins - options_hash = Hash[*[@boolean_attributes.map { |name| [name, true] }] ] + options_hash = Hash[*[@boolean_attributes.map { |name| [name, true] }]] d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge( { :d_lbl_pos => :t })) -- cgit v1.2.3 From 555a3cc193458679a9fc6f8cc664b3cfe590fa74 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 8 Apr 2023 00:00:33 +0200 Subject: Fix an indentation issue manually Also regenerate config --- .rubocop_todo.yml | 65 ++++-------------------------------------- lib/axlsx/stylesheet/styles.rb | 4 +-- test/tc_axlsx.rb | 3 +- 3 files changed, 9 insertions(+), 63 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 34cfa002..e9cbc738 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-05 15:57:00 UTC using RuboCop version 1.49.0. +# on 2023-04-07 21:59:59 UTC using RuboCop version 1.49.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -36,12 +36,6 @@ Layout/ArgumentAlignment: - 'lib/axlsx/workbook/worksheet/sheet_view.rb' - 'lib/axlsx/workbook/worksheet/table_style_info.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Layout/ClosingParenthesisIndentation: - Exclude: - - 'lib/axlsx/stylesheet/styles.rb' - # Offense count: 90 # This cop supports safe autocorrection (--autocorrect). Layout/EmptyLineAfterGuardClause: @@ -54,7 +48,7 @@ Layout/EmptyLineAfterGuardClause: Layout/EmptyLinesAroundClassBody: Enabled: false -# Offense count: 32 +# Offense count: 31 # This cop supports safe autocorrection (--autocorrect). Layout/EmptyLinesAroundMethodBody: Enabled: false @@ -72,7 +66,7 @@ Layout/EmptyLinesAroundModuleBody: Layout/ExtraSpacing: Enabled: false -# Offense count: 1 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_braces @@ -113,7 +107,7 @@ Layout/HeredocIndentation: Layout/IndentationConsistency: Enabled: false -# Offense count: 126 +# Offense count: 118 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Width, AllowedPatterns. Layout/IndentationWidth: @@ -125,23 +119,6 @@ Layout/IndentationWidth: Layout/LeadingCommentSpace: Enabled: false -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: symmetrical, new_line, same_line -Layout/MultilineHashBraceLayout: - Exclude: - - 'lib/axlsx/stylesheet/styles.rb' - - 'test/tc_axlsx.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: symmetrical, new_line, same_line -Layout/MultilineMethodCallBraceLayout: - Exclude: - - 'lib/axlsx/stylesheet/styles.rb' - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. @@ -162,7 +139,7 @@ Layout/SpaceAfterComma: Layout/SpaceAroundEqualsInParameterDefault: Enabled: false -# Offense count: 343 +# Offense count: 342 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. # SupportedStylesForExponentOperator: space, no_space @@ -740,13 +717,6 @@ Style/HashEachMethods: Style/HashSyntax: Enabled: false -# Offense count: 2 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/HashTransformKeys: - Exclude: - - 'lib/axlsx/workbook/worksheet/cell_serializer.rb' - - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowIfModifier. @@ -1143,17 +1113,6 @@ Style/Semicolon: Style/SingleLineMethods: Enabled: false -# Offense count: 6 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/SlicingWithRange: - Exclude: - - 'lib/axlsx.rb' - - 'lib/axlsx/drawing/area_chart.rb' - - 'lib/axlsx/drawing/line_chart.rb' - - 'lib/axlsx/util/simple_typed_list.rb' - - 'lib/axlsx/workbook/worksheet/pivot_table.rb' - - 'lib/axlsx/workbook/worksheet/worksheet.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowModifier. @@ -1240,14 +1199,6 @@ Style/TernaryParentheses: - 'lib/axlsx/drawing/scatter_series.rb' - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInArguments: - Exclude: - - 'lib/axlsx/stylesheet/styles.rb' - # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyleForMultiline. @@ -1284,12 +1235,6 @@ Style/TrivialAccessors: - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - 'lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Style/UnpackFirst: - Exclude: - - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/WhileUntilDo: diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index a28785c9..a1f541c9 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -445,8 +445,8 @@ module Axlsx border.prs << BorderPr.new({ :name => edge, :style => edge_b_opts[:style], - :color => Color.new(:rgb => edge_b_opts[:color]) }, - ) + :color => Color.new(:rgb => edge_b_opts[:color]) + }) end end diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index e9ea0be6..af9d505c 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -3,7 +3,8 @@ require 'tc_helper.rb' class TestAxlsx < Test::Unit::TestCase def setup_wide - @wide_test_points = { "A3" => 0, + @wide_test_points = { + "A3" => 0, "Z3" => 25, "B3" => 1, "AA3" => 1 * 26 + 0, -- cgit v1.2.3 From 108df9b563a4539802f83864e4aa9261b35a590f Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 8 Apr 2023 00:02:14 +0200 Subject: Fix Layout/MultilineOperationIndentation offenses ``` rubocop --only Layout/MultilineOperationIndentation -a ``` --- .rubocop_todo.yml | 8 -------- lib/axlsx/package.rb | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e9cbc738..da547011 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -119,14 +119,6 @@ Layout/IndentationWidth: Layout/LeadingCommentSpace: Enabled: false -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: aligned, indented -Layout/MultilineOperationIndentation: - Exclude: - - 'lib/axlsx/package.rb' - # Offense count: 264 # This cop supports safe autocorrection (--autocorrect). Layout/SpaceAfterComma: diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 5bd8d5c2..0c03b1a2 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -375,7 +375,7 @@ module Axlsx def parse_serialize_options(options, secondary_options) if secondary_options warn "[DEPRECATION] Axlsx::Package#serialize with 3 arguments is deprecated. " + - "Use keyword args instead e.g., package.serialize(output, confirm_valid: false, zip_command: 'zip')" + "Use keyword args instead e.g., package.serialize(output, confirm_valid: false, zip_command: 'zip')" end if options.is_a?(Hash) options.merge!(secondary_options || {}) @@ -386,7 +386,7 @@ module Axlsx [options.fetch(:confirm_valid, false), options.fetch(:zip_command, nil)] else warn "[DEPRECATION] Axlsx::Package#serialize with confirm_valid as a boolean is deprecated. " + - "Use keyword args instead e.g., package.serialize(output, confirm_valid: false)" + "Use keyword args instead e.g., package.serialize(output, confirm_valid: false)" parse_serialize_options((secondary_options || {}).merge(confirm_valid: options), nil) end end -- cgit v1.2.3 From 7f077b55bf963c6e855c6c9066c6aed4926fb8e3 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 8 Apr 2023 00:03:00 +0200 Subject: Fix Layout/SpaceBeforeFirstArg offenses ``` rubocop --only Layout/SpaceBeforeFirstArg -a ``` --- .rubocop_todo.yml | 9 --------- lib/axlsx/stylesheet/font.rb | 2 +- lib/axlsx/workbook/workbook_view.rb | 2 +- test/workbook/worksheet/tc_worksheet.rb | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index da547011..67093bb7 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -146,15 +146,6 @@ Layout/SpaceAroundOperators: Layout/SpaceBeforeBlockBraces: Enabled: false -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment. -Layout/SpaceBeforeFirstArg: - Exclude: - - 'lib/axlsx/stylesheet/font.rb' - - 'lib/axlsx/workbook/workbook_view.rb' - - 'test/workbook/worksheet/tc_worksheet.rb' - # Offense count: 139 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index 890957c5..9ce5ae4a 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -99,7 +99,7 @@ module Axlsx # The font's extend property # @return [Boolean] - attr_reader :extend + attr_reader :extend # The color of the font # @return [Color] diff --git a/lib/axlsx/workbook/workbook_view.rb b/lib/axlsx/workbook/workbook_view.rb index b81fd4f4..2476ad84 100644 --- a/lib/axlsx/workbook/workbook_view.rb +++ b/lib/axlsx/workbook/workbook_view.rb @@ -54,7 +54,7 @@ module Axlsx unsigned_int_attr_accessor :x_window, :y_window, :window_width, :window_height, :tab_ratio, :first_sheet, :active_tab - validated_attr_accessor [:visibility], :validate_view_visibility + validated_attr_accessor [:visibility], :validate_view_visibility serializable_attributes :visibility, :minimized, :show_horizontal_scroll, :show_vertical_scroll, diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index ed363118..529fab5d 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -449,7 +449,7 @@ class TestWorksheet < Test::Unit::TestCase @ws.merge_cells "A4:A5" @ws.add_chart Axlsx::Pie3DChart @ws.add_table "E1:F3" - @ws.add_pivot_table 'G5:G6', 'A1:D10' + @ws.add_pivot_table 'G5:G6', 'A1:D10' schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD)) doc = Nokogiri::XML(@ws.to_xml_string) assert(schema.validate(doc).map { |e| puts e.message; e }.empty?, schema.validate(doc).map { |e| e.message }.join('\n')) -- cgit v1.2.3 From 5d68145521afe5c5912ceebae2f7e784eb5f8954 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 8 Apr 2023 00:12:18 +0200 Subject: Fix EmptyLines related offenses --- .rubocop_todo.yml | 19 ------------------- lib/axlsx/content_type/abstract_content_type.rb | 3 --- lib/axlsx/content_type/content_type.rb | 3 --- lib/axlsx/content_type/default.rb | 3 --- lib/axlsx/content_type/override.rb | 2 -- lib/axlsx/doc_props/app.rb | 4 ---- lib/axlsx/doc_props/core.rb | 4 ---- lib/axlsx/drawing/area_chart.rb | 2 -- lib/axlsx/drawing/area_series.rb | 2 -- lib/axlsx/drawing/ax_data_source.rb | 4 ---- lib/axlsx/drawing/axes.rb | 2 -- lib/axlsx/drawing/axis.rb | 4 ---- lib/axlsx/drawing/bar_3D_chart.rb | 2 -- lib/axlsx/drawing/bar_chart.rb | 2 -- lib/axlsx/drawing/bar_series.rb | 3 --- lib/axlsx/drawing/bubble_chart.rb | 2 -- lib/axlsx/drawing/bubble_series.rb | 2 -- lib/axlsx/drawing/cat_axis.rb | 3 --- lib/axlsx/drawing/chart.rb | 4 ---- lib/axlsx/drawing/d_lbls.rb | 2 -- lib/axlsx/drawing/drawing.rb | 2 -- lib/axlsx/drawing/graphic_frame.rb | 2 -- lib/axlsx/drawing/hyperlink.rb | 2 -- lib/axlsx/drawing/line_3D_chart.rb | 2 -- lib/axlsx/drawing/line_chart.rb | 2 -- lib/axlsx/drawing/line_series.rb | 2 -- lib/axlsx/drawing/marker.rb | 3 --- lib/axlsx/drawing/num_data.rb | 4 ---- lib/axlsx/drawing/num_data_source.rb | 2 -- lib/axlsx/drawing/num_val.rb | 2 -- lib/axlsx/drawing/one_cell_anchor.rb | 2 -- lib/axlsx/drawing/pic.rb | 1 - lib/axlsx/drawing/picture_locking.rb | 2 -- lib/axlsx/drawing/pie_3D_chart.rb | 3 --- lib/axlsx/drawing/pie_series.rb | 4 ---- lib/axlsx/drawing/scaling.rb | 2 -- lib/axlsx/drawing/scatter_chart.rb | 2 -- lib/axlsx/drawing/scatter_series.rb | 2 -- lib/axlsx/drawing/ser_axis.rb | 2 -- lib/axlsx/drawing/series.rb | 1 - lib/axlsx/drawing/series_title.rb | 1 - lib/axlsx/drawing/str_data.rb | 4 ---- lib/axlsx/drawing/str_val.rb | 2 -- lib/axlsx/drawing/title.rb | 2 -- lib/axlsx/drawing/two_cell_anchor.rb | 1 - lib/axlsx/drawing/val_axis.rb | 2 -- lib/axlsx/drawing/view_3D.rb | 1 - lib/axlsx/drawing/vml_drawing.rb | 4 ---- lib/axlsx/drawing/vml_shape.rb | 3 --- lib/axlsx/rels/relationship.rb | 2 -- lib/axlsx/rels/relationships.rb | 2 -- lib/axlsx/stylesheet/border.rb | 2 -- lib/axlsx/stylesheet/border_pr.rb | 1 - lib/axlsx/stylesheet/cell_alignment.rb | 3 --- lib/axlsx/stylesheet/cell_protection.rb | 2 -- lib/axlsx/stylesheet/cell_style.rb | 3 --- lib/axlsx/stylesheet/color.rb | 1 - lib/axlsx/stylesheet/dxf.rb | 3 --- lib/axlsx/stylesheet/fill.rb | 2 -- lib/axlsx/stylesheet/gradient_fill.rb | 1 - lib/axlsx/stylesheet/num_fmt.rb | 2 -- lib/axlsx/stylesheet/pattern_fill.rb | 1 - lib/axlsx/stylesheet/table_style.rb | 2 -- lib/axlsx/stylesheet/table_style_element.rb | 2 -- lib/axlsx/stylesheet/table_styles.rb | 3 --- lib/axlsx/stylesheet/xf.rb | 1 - lib/axlsx/util/accessors.rb | 1 - lib/axlsx/util/constants.rb | 1 - lib/axlsx/util/options_parser.rb | 1 - lib/axlsx/util/serialized_attributes.rb | 2 -- lib/axlsx/util/simple_typed_list.rb | 3 --- lib/axlsx/util/storage.rb | 3 --- lib/axlsx/util/zip_command.rb | 1 - lib/axlsx/version.rb | 1 - lib/axlsx/workbook/defined_names.rb | 1 - lib/axlsx/workbook/shared_strings_table.rb | 2 -- lib/axlsx/workbook/workbook.rb | 2 -- lib/axlsx/workbook/workbook_view.rb | 2 -- lib/axlsx/workbook/workbook_views.rb | 1 - .../workbook/worksheet/auto_filter/auto_filter.rb | 3 --- .../workbook/worksheet/auto_filter/filter_column.rb | 1 - lib/axlsx/workbook/worksheet/auto_filter/filters.rb | 2 -- lib/axlsx/workbook/worksheet/border_creator.rb | 1 - lib/axlsx/workbook/worksheet/break.rb | 2 -- lib/axlsx/workbook/worksheet/cell.rb | 2 -- lib/axlsx/workbook/worksheet/cell_serializer.rb | 1 - lib/axlsx/workbook/worksheet/cfvo.rb | 1 - lib/axlsx/workbook/worksheet/cfvos.rb | 2 -- lib/axlsx/workbook/worksheet/col.rb | 3 --- lib/axlsx/workbook/worksheet/col_breaks.rb | 2 -- lib/axlsx/workbook/worksheet/color_scale.rb | 2 -- lib/axlsx/workbook/worksheet/cols.rb | 2 -- lib/axlsx/workbook/worksheet/comment.rb | 2 -- lib/axlsx/workbook/worksheet/comments.rb | 5 ----- .../workbook/worksheet/conditional_formatting.rb | 1 - .../workbook/worksheet/conditional_formatting_rule.rb | 1 - .../workbook/worksheet/conditional_formattings.rb | 3 --- lib/axlsx/workbook/worksheet/data_bar.rb | 2 -- lib/axlsx/workbook/worksheet/data_validations.rb | 3 --- lib/axlsx/workbook/worksheet/date_time_converter.rb | 1 - lib/axlsx/workbook/worksheet/dimension.rb | 2 -- lib/axlsx/workbook/worksheet/header_footer.rb | 1 - lib/axlsx/workbook/worksheet/icon_set.rb | 1 - lib/axlsx/workbook/worksheet/merged_cells.rb | 2 -- lib/axlsx/workbook/worksheet/outline_pr.rb | 1 - lib/axlsx/workbook/worksheet/page_margins.rb | 1 - lib/axlsx/workbook/worksheet/page_set_up_pr.rb | 2 -- lib/axlsx/workbook/worksheet/page_setup.rb | 1 - lib/axlsx/workbook/worksheet/pane.rb | 1 - lib/axlsx/workbook/worksheet/pivot_table.rb | 1 - .../worksheet/pivot_table_cache_definition.rb | 2 -- lib/axlsx/workbook/worksheet/pivot_tables.rb | 3 --- lib/axlsx/workbook/worksheet/print_options.rb | 1 - lib/axlsx/workbook/worksheet/protected_range.rb | 1 - lib/axlsx/workbook/worksheet/protected_ranges.rb | 2 -- lib/axlsx/workbook/worksheet/rich_text.rb | 2 -- lib/axlsx/workbook/worksheet/rich_text_run.rb | 2 -- lib/axlsx/workbook/worksheet/row.rb | 1 - lib/axlsx/workbook/worksheet/row_breaks.rb | 2 -- lib/axlsx/workbook/worksheet/selection.rb | 1 - lib/axlsx/workbook/worksheet/sheet_calc_pr.rb | 1 - lib/axlsx/workbook/worksheet/sheet_data.rb | 3 --- lib/axlsx/workbook/worksheet/sheet_format_pr.rb | 1 - lib/axlsx/workbook/worksheet/sheet_pr.rb | 1 - lib/axlsx/workbook/worksheet/sheet_protection.rb | 2 -- lib/axlsx/workbook/worksheet/sheet_view.rb | 1 - lib/axlsx/workbook/worksheet/table.rb | 1 - lib/axlsx/workbook/worksheet/table_style_info.rb | 1 - lib/axlsx/workbook/worksheet/tables.rb | 3 --- lib/axlsx/workbook/worksheet/worksheet.rb | 2 -- lib/axlsx/workbook/worksheet/worksheet_comments.rb | 2 -- lib/axlsx/workbook/worksheet/worksheet_drawing.rb | 2 -- lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb | 2 -- lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb | 2 -- test/content_type/tc_content_type.rb | 3 --- test/content_type/tc_default.rb | 1 - test/content_type/tc_override.rb | 1 - test/doc_props/tc_app.rb | 1 - test/doc_props/tc_core.rb | 1 - test/drawing/tc_area_chart.rb | 2 -- test/drawing/tc_area_series.rb | 1 - test/drawing/tc_bar_3D_chart.rb | 1 - test/drawing/tc_bar_chart.rb | 1 - test/drawing/tc_bar_series.rb | 1 - test/drawing/tc_bubble_chart.rb | 1 - test/drawing/tc_bubble_series.rb | 2 -- test/drawing/tc_cat_axis.rb | 1 - test/drawing/tc_chart.rb | 5 ----- test/drawing/tc_d_lbls.rb | 2 -- test/drawing/tc_data_source.rb | 2 -- test/drawing/tc_drawing.rb | 2 -- test/drawing/tc_hyperlink.rb | 1 - test/drawing/tc_line_3d_chart.rb | 2 -- test/drawing/tc_line_chart.rb | 2 -- test/drawing/tc_line_series.rb | 1 - test/drawing/tc_marker.rb | 1 - test/drawing/tc_num_data.rb | 3 --- test/drawing/tc_num_val.rb | 3 --- test/drawing/tc_one_cell_anchor.rb | 2 -- test/drawing/tc_pic.rb | 2 -- test/drawing/tc_picture_locking.rb | 1 - test/drawing/tc_pie_3D_chart.rb | 2 -- test/drawing/tc_pie_series.rb | 2 -- test/drawing/tc_scaling.rb | 1 - test/drawing/tc_scatter_chart.rb | 1 - test/drawing/tc_scatter_series.rb | 2 -- test/drawing/tc_ser_axis.rb | 1 - test/drawing/tc_series.rb | 2 -- test/drawing/tc_str_data.rb | 2 -- test/drawing/tc_str_val.rb | 2 -- test/drawing/tc_two_cell_anchor.rb | 2 -- test/drawing/tc_val_axis.rb | 1 - test/drawing/tc_view_3D.rb | 1 - test/drawing/tc_vml_drawing.rb | 2 -- test/drawing/tc_vml_shape.rb | 2 -- test/rels/tc_relationship.rb | 1 - test/rels/tc_relationships.rb | 2 -- test/stylesheet/tc_cell_alignment.rb | 1 - test/stylesheet/tc_cell_protection.rb | 2 -- test/stylesheet/tc_cell_style.rb | 2 -- test/stylesheet/tc_color.rb | 2 -- test/stylesheet/tc_dxf.rb | 1 - test/stylesheet/tc_fill.rb | 2 -- test/stylesheet/tc_font.rb | 2 -- test/stylesheet/tc_gradient_fill.rb | 1 - test/stylesheet/tc_gradient_stop.rb | 2 -- test/stylesheet/tc_num_fmt.rb | 2 -- test/stylesheet/tc_pattern_fill.rb | 1 - test/stylesheet/tc_styles.rb | 1 - test/stylesheet/tc_table_style.rb | 1 - test/stylesheet/tc_table_style_element.rb | 1 - test/stylesheet/tc_table_styles.rb | 2 -- test/stylesheet/tc_xf.rb | 2 -- test/tc_axlsx.rb | 2 -- test/tc_package.rb | 1 - test/workbook/tc_defined_name.rb | 1 - test/workbook/tc_shared_strings_table.rb | 1 - test/workbook/tc_workbook.rb | 1 - test/workbook/tc_workbook_view.rb | 1 - test/workbook/worksheet/auto_filter/tc_auto_filter.rb | 1 - .../worksheet/auto_filter/tc_filter_column.rb | 1 - test/workbook/worksheet/tc_border_creator.rb | 1 - test/workbook/worksheet/tc_break.rb | 1 - test/workbook/worksheet/tc_cell.rb | 1 - test/workbook/worksheet/tc_cfvo.rb | 1 - test/workbook/worksheet/tc_col.rb | 2 -- test/workbook/worksheet/tc_color_scale.rb | 1 - test/workbook/worksheet/tc_conditional_formatting.rb | 6 ------ test/workbook/worksheet/tc_data_bar.rb | 1 - test/workbook/worksheet/tc_data_validation.rb | 1 - test/workbook/worksheet/tc_date_time_converter.rb | 2 -- test/workbook/worksheet/tc_header_footer.rb | 1 - test/workbook/worksheet/tc_icon_set.rb | 1 - test/workbook/worksheet/tc_page_margins.rb | 1 - test/workbook/worksheet/tc_page_setup.rb | 2 -- test/workbook/worksheet/tc_pivot_table.rb | 1 - test/workbook/worksheet/tc_print_options.rb | 2 -- test/workbook/worksheet/tc_row.rb | 3 --- test/workbook/worksheet/tc_sheet_calc_pr.rb | 1 - test/workbook/worksheet/tc_sheet_format_pr.rb | 2 -- test/workbook/worksheet/tc_sheet_pr.rb | 1 - test/workbook/worksheet/tc_sheet_protection.rb | 1 - test/workbook/worksheet/tc_sheet_view.rb | 1 - test/workbook/worksheet/tc_table.rb | 1 - test/workbook/worksheet/tc_table_style_info.rb | 1 - test/workbook/worksheet/tc_worksheet.rb | 2 -- test/workbook/worksheet/tc_worksheet_hyperlink.rb | 1 - 227 files changed, 431 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 67093bb7..7dc60f46 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -41,25 +41,6 @@ Layout/ArgumentAlignment: Layout/EmptyLineAfterGuardClause: Enabled: false -# Offense count: 285 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only -Layout/EmptyLinesAroundClassBody: - Enabled: false - -# Offense count: 31 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLinesAroundMethodBody: - Enabled: false - -# Offense count: 96 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines -Layout/EmptyLinesAroundModuleBody: - Enabled: false - # Offense count: 58 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. diff --git a/lib/axlsx/content_type/abstract_content_type.rb b/lib/axlsx/content_type/abstract_content_type.rb index 82a659dd..73d8a678 100644 --- a/lib/axlsx/content_type/abstract_content_type.rb +++ b/lib/axlsx/content_type/abstract_content_type.rb @@ -1,8 +1,6 @@ module Axlsx - # This class extracts the common parts from Default and Override class AbstractContentType - include Axlsx::OptionsParser # Initializes an abstract content type @@ -27,6 +25,5 @@ module Axlsx str << Axlsx.instance_values_for(self).map { |key, value| Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ') str << '/>' end - end end diff --git a/lib/axlsx/content_type/content_type.rb b/lib/axlsx/content_type/content_type.rb index e6dfdee5..48b5b6a9 100644 --- a/lib/axlsx/content_type/content_type.rb +++ b/lib/axlsx/content_type/content_type.rb @@ -5,7 +5,6 @@ module Axlsx # ContentTypes used in the package. This is automatically managed by the package package. class ContentType < SimpleTypedList - def initialize super [Override, Default] end @@ -19,7 +18,5 @@ module Axlsx each { |type| type.to_xml_string(str) } str << '' end - end - end diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb index be3a7c04..691b7e87 100644 --- a/lib/axlsx/content_type/default.rb +++ b/lib/axlsx/content_type/default.rb @@ -1,8 +1,6 @@ module Axlsx - # An default content part. These parts are automatically created by for you based on the content of your package. class Default < AbstractContentType - # The serialization node name for this class NODE_NAME = 'Default' @@ -20,5 +18,4 @@ module Axlsx super(NODE_NAME, str) end end - end diff --git a/lib/axlsx/content_type/override.rb b/lib/axlsx/content_type/override.rb index 39303e80..5fb98d4c 100644 --- a/lib/axlsx/content_type/override.rb +++ b/lib/axlsx/content_type/override.rb @@ -1,8 +1,6 @@ module Axlsx - # An override content part. These parts are automatically created by for you based on the content of your package. class Override < AbstractContentType - # Serialization node name for this object NODE_NAME = 'Override' diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb index 64a193cf..ed46cf56 100644 --- a/lib/axlsx/doc_props/app.rb +++ b/lib/axlsx/doc_props/app.rb @@ -1,5 +1,4 @@ module Axlsx - # App represents the app.xml document. The attributes for this object are primarily managed by the application the end user uses to edit the document. None of the attributes are required to serialize a valid xlsx object. # @see shared-documentPropertiesExtended.xsd # @note Support is not implemented for the following complex types: @@ -9,7 +8,6 @@ module Axlsx # HLinks (VectorVariant), # DigSig (DigSigBlob) class App - include Axlsx::OptionsParser # Creates an App object @@ -228,7 +226,5 @@ module Axlsx end str << '' end - end - end diff --git a/lib/axlsx/doc_props/core.rb b/lib/axlsx/doc_props/core.rb index 541fa1ad..279b7493 100644 --- a/lib/axlsx/doc_props/core.rb +++ b/lib/axlsx/doc_props/core.rb @@ -1,10 +1,8 @@ module Axlsx - # The core object for the package. # @note Packages manage their own core object. # @see Package#core class Core - # Creates a new Core object. # @option options [String] creator # @option options [Time] created @@ -32,7 +30,5 @@ module Axlsx str << '0' str << '' end - end - end diff --git a/lib/axlsx/drawing/area_chart.rb b/lib/axlsx/drawing/area_chart.rb index fa0f5ebf..7e831447 100644 --- a/lib/axlsx/drawing/area_chart.rb +++ b/lib/axlsx/drawing/area_chart.rb @@ -1,5 +1,4 @@ module Axlsx - # The AreaChart is a two dimentional line chart (who would have guessed?) that you can add to your worksheet. # @example Creating a chart # # This example creates a line in a single sheet. @@ -19,7 +18,6 @@ module Axlsx # @see Series # @see Package#serialize class AreaChart < Chart - # the category axis # @return [CatAxis] def cat_axis diff --git a/lib/axlsx/drawing/area_series.rb b/lib/axlsx/drawing/area_series.rb index a168bb07..fd3dd501 100644 --- a/lib/axlsx/drawing/area_series.rb +++ b/lib/axlsx/drawing/area_series.rb @@ -4,7 +4,6 @@ module Axlsx # @see Worksheet#add_chart # @see Chart#add_series class AreaSeries < Series - # The data for this series. # @return [ValAxisData] attr_reader :data @@ -104,6 +103,5 @@ module Axlsx # assigns the labels for this series def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end - end end diff --git a/lib/axlsx/drawing/ax_data_source.rb b/lib/axlsx/drawing/ax_data_source.rb index cef683dd..10eb6c5e 100644 --- a/lib/axlsx/drawing/ax_data_source.rb +++ b/lib/axlsx/drawing/ax_data_source.rb @@ -1,9 +1,7 @@ module Axlsx - # An axis data source that can contain referenced or literal strings or numbers # @note only string data types are supported - mainly because we have not implemented a chart type that requires a numerical axis value class AxDataSource < NumDataSource - # creates a new NumDataSource object # @option options [Array] data An array of Cells or Numeric objects # @option options [Symbol] tag_name see tag_name @@ -19,7 +17,5 @@ module Axlsx def self.allowed_tag_names [:xVal, :cat] end - end - end diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb index 6e66dcc0..146d566e 100644 --- a/lib/axlsx/drawing/axes.rb +++ b/lib/axlsx/drawing/axes.rb @@ -1,9 +1,7 @@ module Axlsx - # The Axes class creates and manages axis information and # serialization for charts. class Axes - # @param [Hash] options options used to generate axis each key # should be an axis name like :val_axis and its value should be the # class of the axis type to construct. The :cat_axis, if there is one, diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index eb9a0759..6f65f147 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -1,8 +1,6 @@ module Axlsx - # the access class defines common properties and values for a chart axis. class Axis - include Axlsx::OptionsParser # Creates an Axis object @@ -183,7 +181,5 @@ module Axlsx str << ('') str << ('') end - end - end diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index 33eac167..1bb47da7 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -1,12 +1,10 @@ module Axlsx - # The Bar3DChart is a three dimentional barchart (who would have guessed?) that you can add to your worksheet. # @see Worksheet#add_chart # @see Chart#add_series # @see Package#serialize # @see README for an example class Bar3DChart < Chart - # the category axis # @return [CatAxis] def cat_axis diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb index e3260ca0..84b9faa1 100644 --- a/lib/axlsx/drawing/bar_chart.rb +++ b/lib/axlsx/drawing/bar_chart.rb @@ -1,12 +1,10 @@ module Axlsx - # The BarChart is a two dimentional barchart that you can add to your worksheet. # @see Worksheet#add_chart # @see Chart#add_series # @see Package#serialize # @see README for an example class BarChart < Chart - # the category axis # @return [CatAxis] def cat_axis diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb index 2ee40488..fcf7d98f 100644 --- a/lib/axlsx/drawing/bar_series.rb +++ b/lib/axlsx/drawing/bar_series.rb @@ -4,7 +4,6 @@ module Axlsx # @see Worksheet#add_chart # @see Chart#add_series class BarSeries < Series - # The data for this series. # @return [NumDataSource] attr_reader :data @@ -88,7 +87,5 @@ module Axlsx # assigns the labels for this series def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end - end - end diff --git a/lib/axlsx/drawing/bubble_chart.rb b/lib/axlsx/drawing/bubble_chart.rb index 3f9745f1..9d0f3ff1 100644 --- a/lib/axlsx/drawing/bubble_chart.rb +++ b/lib/axlsx/drawing/bubble_chart.rb @@ -1,11 +1,9 @@ module Axlsx - # The BubbleChart allows you to insert a bubble chart into your worksheet # @see Worksheet#add_chart # @see Chart#add_series # @see README for an example class BubbleChart < Chart - include Axlsx::OptionsParser # the x value axis diff --git a/lib/axlsx/drawing/bubble_series.rb b/lib/axlsx/drawing/bubble_series.rb index 4fdf86ad..7d6e7bf6 100644 --- a/lib/axlsx/drawing/bubble_series.rb +++ b/lib/axlsx/drawing/bubble_series.rb @@ -1,12 +1,10 @@ module Axlsx - # A BubbleSeries defines the x/y position and bubble size of data in the chart # @note The recommended way to manage series is to use Chart#add_series # @see Worksheet#add_chart # @see Chart#add_series # @see examples/example.rb class BubbleSeries < Series - # The x data for this series. # @return [AxDataSource] attr_reader :xData diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index 6e61d336..925d6ad6 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -1,7 +1,6 @@ module Axlsx #A CatAxis object defines a chart category axis class CatAxis < Axis - # Creates a new CatAxis object # @option options [Integer] tick_lbl_skip # @option options [Integer] tick_mark_skip @@ -77,7 +76,5 @@ module Axlsx str << ('') str << '' end - end - end diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index 45a9113d..49c72b58 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -1,10 +1,8 @@ module Axlsx - # A Chart is the superclass for specific charts # @note Worksheet#add_chart is the recommended way to create charts for your worksheets. # @see README for examples class Chart - include Axlsx::OptionsParser # Creates a new chart object # @param [GraphicalFrame] frame The frame that holds this chart. @@ -292,7 +290,5 @@ module Axlsx # sets the view_3D object for the chart def view_3D=(v) DataTypeValidator.validate "#{self.class}.view_3D", View3D, v; @view_3D = v; end alias :view3D= :view_3D= - end - end diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index 8623fd8a..fe204ddc 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -5,7 +5,6 @@ module Axlsx #The DLbls class manages serialization of data labels # showLeaderLines and leaderLines are not currently implemented class DLbls - include Axlsx::Accessors include Axlsx::OptionsParser # creates a new DLbls object @@ -84,6 +83,5 @@ module Axlsx @d_lbl_pos = nil @show_leader_lines = nil end - end end diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index 87937d72..0de5dc15 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -57,7 +57,6 @@ module Axlsx # @see Chart # see examples/example.rb for an example of how to create a chart. class Drawing - # The worksheet that owns the drawing # @return [Worksheet] attr_reader :worksheet @@ -160,6 +159,5 @@ module Axlsx anchors.each { |anchor| anchor.to_xml_string(str) } str << '' end - end end diff --git a/lib/axlsx/drawing/graphic_frame.rb b/lib/axlsx/drawing/graphic_frame.rb index 93216e79..006b3b0f 100644 --- a/lib/axlsx/drawing/graphic_frame.rb +++ b/lib/axlsx/drawing/graphic_frame.rb @@ -3,7 +3,6 @@ module Axlsx # @note The recommended way to manage charts is Worksheet#add_chart # @see Worksheet#add_chart class GraphicFrame - # A reference to the chart object associated with this frame # @return [Chart] attr_reader :chart @@ -48,6 +47,5 @@ module Axlsx str << '' str << '' end - end end diff --git a/lib/axlsx/drawing/hyperlink.rb b/lib/axlsx/drawing/hyperlink.rb index 407e701c..9ff9ee4a 100644 --- a/lib/axlsx/drawing/hyperlink.rb +++ b/lib/axlsx/drawing/hyperlink.rb @@ -3,7 +3,6 @@ module Axlsx # @note using the hyperlink option when calling add_image on a drawing object is the recommended way to manage hyperlinks # @see {file:README} README class Hyperlink - include Axlsx::SerializedAttributes include Axlsx::OptionsParser @@ -94,6 +93,5 @@ module Axlsx def to_xml_string(str = '') serialized_tag 'a:hlinkClick', str, {:'r:id' => relationship.Id, :'xmlns:r' => XML_NS_R } end - end end diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index 8816d2e7..da62851f 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -1,5 +1,4 @@ module Axlsx - # The Line3DChart is a three dimentional line chart (who would have guessed?) that you can add to your worksheet. # @example Creating a chart # # This example creates a line in a single sheet. @@ -19,7 +18,6 @@ module Axlsx # @see Series # @see Package#serialize class Line3DChart < Axlsx::LineChart - # space between bar or column clusters, as a percentage of the bar or column width. # @return [String] attr_reader :gap_depth diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb index dd0517cb..a1734dea 100644 --- a/lib/axlsx/drawing/line_chart.rb +++ b/lib/axlsx/drawing/line_chart.rb @@ -1,5 +1,4 @@ module Axlsx - # The LineChart is a two dimentional line chart (who would have guessed?) that you can add to your worksheet. # @example Creating a chart # # This example creates a line in a single sheet. @@ -19,7 +18,6 @@ module Axlsx # @see Series # @see Package#serialize class LineChart < Chart - # the category axis # @return [CatAxis] def cat_axis diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb index e3c1fa90..2ef18484 100644 --- a/lib/axlsx/drawing/line_series.rb +++ b/lib/axlsx/drawing/line_series.rb @@ -4,7 +4,6 @@ module Axlsx # @see Worksheet#add_chart # @see Chart#add_series class LineSeries < Series - # The data for this series. # @return [ValAxisData] attr_reader :data @@ -104,6 +103,5 @@ module Axlsx # assigns the labels for this series def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end - end end diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index 94125143..53a52dd1 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -3,7 +3,6 @@ module Axlsx # @note The recommended way to manage markers is Worksheet#add_chart Markers are created for a two cell anchor based on the :start and :end options. # @see Worksheet#add_chart class Marker - include Axlsx::OptionsParser # Creates a new Marker object @@ -77,7 +76,5 @@ module Axlsx end [x, y] end - end - end diff --git a/lib/axlsx/drawing/num_data.rb b/lib/axlsx/drawing/num_data.rb index 27929ee3..9374dac3 100644 --- a/lib/axlsx/drawing/num_data.rb +++ b/lib/axlsx/drawing/num_data.rb @@ -1,8 +1,6 @@ module Axlsx - #This class specifies data for a particular data point. It is used for both numCache and numLit object class NumData - include Axlsx::OptionsParser # creates a new NumVal object @@ -45,7 +43,5 @@ module Axlsx end str << ('') end - end - end diff --git a/lib/axlsx/drawing/num_data_source.rb b/lib/axlsx/drawing/num_data_source.rb index 87caac2a..bf5ad9ad 100644 --- a/lib/axlsx/drawing/num_data_source.rb +++ b/lib/axlsx/drawing/num_data_source.rb @@ -1,8 +1,6 @@ module Axlsx - # A numeric data source for use by charts. class NumDataSource - include Axlsx::OptionsParser # creates a new NumDataSource object diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb index 3b795f21..113fe865 100644 --- a/lib/axlsx/drawing/num_val.rb +++ b/lib/axlsx/drawing/num_val.rb @@ -1,8 +1,6 @@ module Axlsx - #This class specifies data for a particular data point. class NumVal < StrVal - # A string representing the format code to apply. # For more information see see the SpreadsheetML numFmt element's (§18.8.30) formatCode attribute. # @return [String] diff --git a/lib/axlsx/drawing/one_cell_anchor.rb b/lib/axlsx/drawing/one_cell_anchor.rb index 01767574..c17f4a25 100644 --- a/lib/axlsx/drawing/one_cell_anchor.rb +++ b/lib/axlsx/drawing/one_cell_anchor.rb @@ -4,7 +4,6 @@ module Axlsx # @see Worksheet#add_chart # @see Worksheet#add_image class OneCellAnchor - include Axlsx::OptionsParser # Creates a new OneCellAnchor object and an Pic associated with it. @@ -94,6 +93,5 @@ module Axlsx cx = @width * 914400 / 96 {:cy=>cy, :cx=>cx} end - end end diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 385819cb..869dde4a 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -3,7 +3,6 @@ module Axlsx # Worksheet#add_image is the recommended way to manage images in your sheets # @see Worksheet#add_image class Pic - include Axlsx::OptionsParser # Creates a new Pic(ture) object diff --git a/lib/axlsx/drawing/picture_locking.rb b/lib/axlsx/drawing/picture_locking.rb index a9cb5032..e230ec89 100644 --- a/lib/axlsx/drawing/picture_locking.rb +++ b/lib/axlsx/drawing/picture_locking.rb @@ -1,7 +1,6 @@ module Axlsx # The picture locking class defines the locking properties for pictures in your workbook. class PictureLocking - include Axlsx::OptionsParser include Axlsx::SerializedAttributes include Axlsx::Accessors @@ -36,6 +35,5 @@ module Axlsx def to_xml_string(str = '') serialized_tag('a:picLocks', str) end - end end diff --git a/lib/axlsx/drawing/pie_3D_chart.rb b/lib/axlsx/drawing/pie_3D_chart.rb index e06e8d57..5c2b57ac 100644 --- a/lib/axlsx/drawing/pie_3D_chart.rb +++ b/lib/axlsx/drawing/pie_3D_chart.rb @@ -1,11 +1,9 @@ module Axlsx - # The Pie3DChart is a three dimentional piechart (who would have guessed?) that you can add to your worksheet. # @see Worksheet#add_chart # @see Chart#add_series # @see README for an example class Pie3DChart < Chart - # Creates a new pie chart object # @param [GraphicFrame] frame The workbook that owns this chart. # @option options [Cell, String] title @@ -40,6 +38,5 @@ module Axlsx str << '' end end - end end diff --git a/lib/axlsx/drawing/pie_series.rb b/lib/axlsx/drawing/pie_series.rb index 10755350..4c1b37fb 100644 --- a/lib/axlsx/drawing/pie_series.rb +++ b/lib/axlsx/drawing/pie_series.rb @@ -1,11 +1,9 @@ module Axlsx - # A PieSeries defines the data and labels and explosion for pie charts series. # @note The recommended way to manage series is to use Chart#add_series # @see Worksheet#add_chart # @see Chart#add_series class PieSeries < Series - # The data for this series. # @return [SimpleTypedList] attr_reader :data @@ -67,7 +65,5 @@ module Axlsx # assigns the labels for this series def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end - end - end diff --git a/lib/axlsx/drawing/scaling.rb b/lib/axlsx/drawing/scaling.rb index 9d1ed53e..82811c11 100644 --- a/lib/axlsx/drawing/scaling.rb +++ b/lib/axlsx/drawing/scaling.rb @@ -1,7 +1,6 @@ module Axlsx # The Scaling class defines axis scaling class Scaling - include Axlsx::OptionsParser # creates a new Scaling object @@ -54,6 +53,5 @@ module Axlsx str << ('') unless @max.nil? str << '' end - end end diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb index 2050cb33..fd6fa3d7 100644 --- a/lib/axlsx/drawing/scatter_chart.rb +++ b/lib/axlsx/drawing/scatter_chart.rb @@ -1,11 +1,9 @@ module Axlsx - # The ScatterChart allows you to insert a scatter chart into your worksheet # @see Worksheet#add_chart # @see Chart#add_series # @see README for an example class ScatterChart < Chart - include Axlsx::OptionsParser # The Style for the scatter chart diff --git a/lib/axlsx/drawing/scatter_series.rb b/lib/axlsx/drawing/scatter_series.rb index 6b65a07b..dba1fdf5 100644 --- a/lib/axlsx/drawing/scatter_series.rb +++ b/lib/axlsx/drawing/scatter_series.rb @@ -1,12 +1,10 @@ module Axlsx - # A ScatterSeries defines the x and y position of data in the chart # @note The recommended way to manage series is to use Chart#add_series # @see Worksheet#add_chart # @see Chart#add_series # @see examples/example.rb class ScatterSeries < Series - # The x data for this series. # @return [NamedAxisData] attr_reader :xData diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb index 805e4244..f1da6037 100644 --- a/lib/axlsx/drawing/ser_axis.rb +++ b/lib/axlsx/drawing/ser_axis.rb @@ -1,7 +1,6 @@ module Axlsx #A SerAxis object defines a series axis class SerAxis < Axis - # The number of tick lables to skip between labels # @return [Integer] attr_reader :tick_lbl_skip @@ -39,5 +38,4 @@ module Axlsx str << '' end end - end diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb index 9404b959..e2445bc9 100644 --- a/lib/axlsx/drawing/series.rb +++ b/lib/axlsx/drawing/series.rb @@ -4,7 +4,6 @@ module Axlsx # @see Worksheet#add_chart # @see Chart#add_series class Series - include Axlsx::OptionsParser # The chart that owns this series diff --git a/lib/axlsx/drawing/series_title.rb b/lib/axlsx/drawing/series_title.rb index 4f58ef4a..f18be178 100644 --- a/lib/axlsx/drawing/series_title.rb +++ b/lib/axlsx/drawing/series_title.rb @@ -1,7 +1,6 @@ module Axlsx # A series title is a Title with a slightly different serialization than chart titles. class SeriesTitle < Title - # Serializes the object # @param [String] str # @return [String] diff --git a/lib/axlsx/drawing/str_data.rb b/lib/axlsx/drawing/str_data.rb index 297986d1..e4f94e89 100644 --- a/lib/axlsx/drawing/str_data.rb +++ b/lib/axlsx/drawing/str_data.rb @@ -1,9 +1,7 @@ module Axlsx - #This specifies the last string data used for a chart. (e.g. strLit and strCache) # This class is extended for NumData to include the formatCode attribute required for numLit and numCache class StrData - include Axlsx::OptionsParser # creates a new StrVal object @@ -35,7 +33,5 @@ module Axlsx end str << ('') end - end - end diff --git a/lib/axlsx/drawing/str_val.rb b/lib/axlsx/drawing/str_val.rb index 00152bef..26f12e26 100644 --- a/lib/axlsx/drawing/str_val.rb +++ b/lib/axlsx/drawing/str_val.rb @@ -1,8 +1,6 @@ module Axlsx - #This class specifies data for a particular data point. class StrVal - include Axlsx::OptionsParser # creates a new StrVal object diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index f62422f9..0c613e13 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -1,7 +1,6 @@ module Axlsx # A Title stores information about the title of a chart class Title - # The text to be shown. Setting this property directly with a string will remove the cell reference. # @return [String] attr_reader :text @@ -101,6 +100,5 @@ module Axlsx str << '' str << '' end - end end diff --git a/lib/axlsx/drawing/two_cell_anchor.rb b/lib/axlsx/drawing/two_cell_anchor.rb index 81a5ca93..aa38c3db 100644 --- a/lib/axlsx/drawing/two_cell_anchor.rb +++ b/lib/axlsx/drawing/two_cell_anchor.rb @@ -3,7 +3,6 @@ module Axlsx # @note The recommended way to manage drawings and charts is Worksheet#add_chart. Anchors are specified by the :start_at and :end_at options to that method. # @see Worksheet#add_chart class TwoCellAnchor - include Axlsx::OptionsParser # A marker that defines the from cell anchor. The default from column and row are 0 and 0 respectively diff --git a/lib/axlsx/drawing/val_axis.rb b/lib/axlsx/drawing/val_axis.rb index b205e1c8..ead09ff8 100644 --- a/lib/axlsx/drawing/val_axis.rb +++ b/lib/axlsx/drawing/val_axis.rb @@ -1,7 +1,6 @@ module Axlsx # the ValAxis class defines a chart value axis. class ValAxis < Axis - # This element specifies how the value axis crosses the category axis. # must be one of [:between, :midCat] # @return [Symbol] @@ -31,6 +30,5 @@ module Axlsx str << ('') str << '' end - end end diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index ab959c87..250f53f2 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -1,7 +1,6 @@ module Axlsx # 3D attributes for a chart. class View3D - include Axlsx::OptionsParser # Creates a new View3D for charts diff --git a/lib/axlsx/drawing/vml_drawing.rb b/lib/axlsx/drawing/vml_drawing.rb index ac39c63d..ccf3e421 100644 --- a/lib/axlsx/drawing/vml_drawing.rb +++ b/lib/axlsx/drawing/vml_drawing.rb @@ -1,8 +1,6 @@ module Axlsx - # a vml drawing used for comments in excel. class VmlDrawing - # creates a new Vml Drawing object. # @param [Comments] comments the comments object this drawing is associated with def initialize(comments) @@ -35,8 +33,6 @@ module Axlsx BAD_PROGRAMMER @comments.each { |comment| comment.vml_shape.to_xml_string str } str << "" - end - end end diff --git a/lib/axlsx/drawing/vml_shape.rb b/lib/axlsx/drawing/vml_shape.rb index 21cac911..951cd58d 100644 --- a/lib/axlsx/drawing/vml_shape.rb +++ b/lib/axlsx/drawing/vml_shape.rb @@ -1,8 +1,6 @@ module Axlsx - # A VmlShape is used to position and render a comment. class VmlShape - include Axlsx::OptionsParser include Axlsx::Accessors @@ -60,7 +58,6 @@ str << < SHAME_ON_YOU - end end end diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index f5bda412..f1759649 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -2,7 +2,6 @@ module Axlsx # A relationship defines a reference between package parts. # @note Packages automatically manage relationships. class Relationship - class << self # Keeps track of relationship ids in use. # @return [Array] @@ -124,6 +123,5 @@ module Axlsx key << self.Target if self.TargetMode == :External key end - end end diff --git a/lib/axlsx/rels/relationships.rb b/lib/axlsx/rels/relationships.rb index 5e542e2c..8f3b62cc 100644 --- a/lib/axlsx/rels/relationships.rb +++ b/lib/axlsx/rels/relationships.rb @@ -4,7 +4,6 @@ require 'axlsx/rels/relationship.rb' # Relationships are a collection of Relations that define how package parts are related. # @note The package automatically manages releationships. class Relationships < SimpleTypedList - # Creates a new Relationships collection based on SimpleTypedList def initialize super Relationship @@ -26,6 +25,5 @@ require 'axlsx/rels/relationship.rb' each{ |rel| rel.to_xml_string(str) } str << '' end - end end diff --git a/lib/axlsx/stylesheet/border.rb b/lib/axlsx/stylesheet/border.rb index bf342c7f..b9ff785b 100644 --- a/lib/axlsx/stylesheet/border.rb +++ b/lib/axlsx/stylesheet/border.rb @@ -1,7 +1,6 @@ module Axlsx # This class details a border used in Office Open XML spreadsheet styles. class Border - include Axlsx::SerializedAttributes include Axlsx::OptionsParser @@ -67,6 +66,5 @@ module Axlsx end str << '' end - end end diff --git a/lib/axlsx/stylesheet/border_pr.rb b/lib/axlsx/stylesheet/border_pr.rb index 7c32af13..630cf42e 100644 --- a/lib/axlsx/stylesheet/border_pr.rb +++ b/lib/axlsx/stylesheet/border_pr.rb @@ -65,6 +65,5 @@ module Axlsx @color.to_xml_string(str) if @color.is_a?(Color) str << ('') end - end end diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb index 45fe0e7d..cf03c171 100644 --- a/lib/axlsx/stylesheet/cell_alignment.rb +++ b/lib/axlsx/stylesheet/cell_alignment.rb @@ -1,10 +1,8 @@ module Axlsx - # CellAlignment stores information about the cell alignment of a style Xf Object. # @note Using Styles#add_style is the recommended way to manage cell alignment. # @see Styles#add_style class CellAlignment - include Axlsx::SerializedAttributes include Axlsx::OptionsParser @@ -122,6 +120,5 @@ module Axlsx def to_xml_string(str = '') serialized_tag('alignment', str) end - end end diff --git a/lib/axlsx/stylesheet/cell_protection.rb b/lib/axlsx/stylesheet/cell_protection.rb index 94648de3..6d98ff19 100644 --- a/lib/axlsx/stylesheet/cell_protection.rb +++ b/lib/axlsx/stylesheet/cell_protection.rb @@ -3,7 +3,6 @@ module Axlsx # @note Using Styles#add_style is the recommended way to manage cell protection. # @see Styles#add_style class CellProtection - include Axlsx::OptionsParser include Axlsx::SerializedAttributes @@ -35,6 +34,5 @@ module Axlsx def to_xml_string(str = '') serialized_tag('protection', str) end - end end diff --git a/lib/axlsx/stylesheet/cell_style.rb b/lib/axlsx/stylesheet/cell_style.rb index 9297e243..e2c3a09e 100644 --- a/lib/axlsx/stylesheet/cell_style.rb +++ b/lib/axlsx/stylesheet/cell_style.rb @@ -3,7 +3,6 @@ module Axlsx # @note Using Styles#add_style is the recommended way to manage cell styling. # @see Styles#add_style class CellStyle - include Axlsx::OptionsParser include Axlsx::SerializedAttributes @@ -65,7 +64,5 @@ module Axlsx def to_xml_string(str = '') serialized_tag('cellStyle', str) end - end - end diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index e4051e96..709d22c3 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -1,7 +1,6 @@ module Axlsx # The color class represents a color used for borders, fills an fonts class Color - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/stylesheet/dxf.rb b/lib/axlsx/stylesheet/dxf.rb index b5423b2a..637e3d54 100644 --- a/lib/axlsx/stylesheet/dxf.rb +++ b/lib/axlsx/stylesheet/dxf.rb @@ -2,7 +2,6 @@ module Axlsx # The Dxf class defines an incremental formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style # @see Styles#add_style class Dxf - include Axlsx::OptionsParser # The order in which the child elements is put in the XML seems to @@ -72,7 +71,5 @@ module Axlsx end str << '' end - end - end diff --git a/lib/axlsx/stylesheet/fill.rb b/lib/axlsx/stylesheet/fill.rb index 9b124e8d..aeff4867 100644 --- a/lib/axlsx/stylesheet/fill.rb +++ b/lib/axlsx/stylesheet/fill.rb @@ -5,7 +5,6 @@ module Axlsx # @see PatternFill # @see GradientFill class Fill - # The type of fill # @return [PatternFill, GradientFill] attr_reader :fill_type @@ -28,6 +27,5 @@ module Axlsx # @see fill_type def fill_type=(v) DataTypeValidator.validate "Fill.fill_type", [PatternFill, GradientFill], v; @fill_type = v; end - end end diff --git a/lib/axlsx/stylesheet/gradient_fill.rb b/lib/axlsx/stylesheet/gradient_fill.rb index 46098b53..8d88f373 100644 --- a/lib/axlsx/stylesheet/gradient_fill.rb +++ b/lib/axlsx/stylesheet/gradient_fill.rb @@ -2,7 +2,6 @@ module Axlsx # A GradientFill defines the color and positioning for gradiant cell fill. # @see Open Office XML Part 1 §18.8.24 class GradientFill - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/stylesheet/num_fmt.rb b/lib/axlsx/stylesheet/num_fmt.rb index 3f99d8d4..ed239dfc 100644 --- a/lib/axlsx/stylesheet/num_fmt.rb +++ b/lib/axlsx/stylesheet/num_fmt.rb @@ -2,7 +2,6 @@ module Axlsx # A NumFmt object defines an identifier and formatting code for data in cells. # @note The recommended way to manage styles is Styles#add_style class NumFmt - include Axlsx::OptionsParser include Axlsx::SerializedAttributes @@ -80,6 +79,5 @@ module Axlsx end str end - end end diff --git a/lib/axlsx/stylesheet/pattern_fill.rb b/lib/axlsx/stylesheet/pattern_fill.rb index 96614ecd..0bcef74b 100644 --- a/lib/axlsx/stylesheet/pattern_fill.rb +++ b/lib/axlsx/stylesheet/pattern_fill.rb @@ -3,7 +3,6 @@ module Axlsx # @note The recommended way to manage styles is with Styles#add_style # @see Style#add_style class PatternFill - include Axlsx::OptionsParser # Creates a new PatternFill Object # @option options [Symbol] patternType diff --git a/lib/axlsx/stylesheet/table_style.rb b/lib/axlsx/stylesheet/table_style.rb index 6be6a9a2..edef6216 100644 --- a/lib/axlsx/stylesheet/table_style.rb +++ b/lib/axlsx/stylesheet/table_style.rb @@ -2,7 +2,6 @@ module Axlsx # A single table style definition and is a collection for tableStyleElements # @note Table are not supported in this version and only the defaults required for a valid workbook are created. class TableStyle < SimpleTypedList - include Axlsx::OptionsParser include Axlsx::SerializedAttributes @@ -48,6 +47,5 @@ module Axlsx each { |table_style_el| table_style_el.to_xml_string(str) } str << '' end - end end diff --git a/lib/axlsx/stylesheet/table_style_element.rb b/lib/axlsx/stylesheet/table_style_element.rb index 1b7b3db9..4bc2a787 100644 --- a/lib/axlsx/stylesheet/table_style_element.rb +++ b/lib/axlsx/stylesheet/table_style_element.rb @@ -2,7 +2,6 @@ module Axlsx # an element of style that belongs to a table style. # @note tables and table styles are not supported in this version. This class exists in preparation for that support. class TableStyleElement - include Axlsx::OptionsParser include Axlsx::SerializedAttributes @@ -71,6 +70,5 @@ module Axlsx def to_xml_string(str = '') serialized_tag('tableStyleElement', str) end - end end diff --git a/lib/axlsx/stylesheet/table_styles.rb b/lib/axlsx/stylesheet/table_styles.rb index d10e9b05..27c75609 100644 --- a/lib/axlsx/stylesheet/table_styles.rb +++ b/lib/axlsx/stylesheet/table_styles.rb @@ -2,7 +2,6 @@ module Axlsx # TableStyles represents a collection of style definitions for table styles and pivot table styles. # @note Support for custom table styles does not exist in this version. Many of the classes required are defined in preparation for future release. Please do not attempt to add custom table styles. class TableStyles < SimpleTypedList - include Axlsx::SerializedAttributes # Creates a new TableStyles object that is a container for TableStyle objects @@ -39,7 +38,5 @@ module Axlsx each { |table_style| table_style.to_xml_string(str) } str << '' end - end - end diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb index 13abf4f2..8b3b11b6 100644 --- a/lib/axlsx/stylesheet/xf.rb +++ b/lib/axlsx/stylesheet/xf.rb @@ -140,6 +140,5 @@ module Axlsx protection.to_xml_string(str) if self.protection str << '' end - end end diff --git a/lib/axlsx/util/accessors.rb b/lib/axlsx/util/accessors.rb index d49255be..8f481e37 100644 --- a/lib/axlsx/util/accessors.rb +++ b/lib/axlsx/util/accessors.rb @@ -14,7 +14,6 @@ module Axlsx # Defines the class level xxx_attr_accessor methods module ClassMethods - # Creates one or more string validated attr_accessors # @param [Array] symbols An array of symbols representing the # names of the attributes you will add to your class. diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb index 7e26c478..401db1b8 100644 --- a/lib/axlsx/util/constants.rb +++ b/lib/axlsx/util/constants.rb @@ -1,5 +1,4 @@ module Axlsx - # XML Encoding ENCODING = "UTF-8".freeze diff --git a/lib/axlsx/util/options_parser.rb b/lib/axlsx/util/options_parser.rb index 9b6d1766..01a1b29b 100644 --- a/lib/axlsx/util/options_parser.rb +++ b/lib/axlsx/util/options_parser.rb @@ -2,7 +2,6 @@ module Axlsx # This module defines a single method for parsing options in class # initializers. module OptionsParser - # Parses an options hash by calling any defined method by the same # name of the key postfixed with an '=' # @param [Hash] options Options to parse. diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index 75712de1..2ac5c05f 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -2,7 +2,6 @@ module Axlsx # This module allows us to define a list of symbols defining which # attributes will be serialized for a class. module SerializedAttributes - # Extend with class methods def self.included(base) base.send :extend, ClassMethods @@ -10,7 +9,6 @@ module Axlsx # class methods applied to all includers module ClassMethods - # This is the method to be used in inheriting classes to specify # which of the instance values are serializable def serializable_attributes(*symbols) diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 98c67d6b..ddab916e 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -1,5 +1,4 @@ module Axlsx - # A SimpleTypedList is a type restrictive collection that allows some of the methods from Array and supports basic xml serialization. # @private class SimpleTypedList @@ -170,7 +169,5 @@ module Axlsx each { |item| item.to_xml_string(str) } str << ('') end - end - end diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb index dc6cc491..9712c563 100644 --- a/lib/axlsx/util/storage.rb +++ b/lib/axlsx/util/storage.rb @@ -1,8 +1,6 @@ module Axlsx - # The Storage class represents a storage object or stream in a compound file. class Storage - # Packing for the Storage when pushing an array of items into a byte stream # Name, name length, type, color, left sibling, right sibling, child, classid, state, created, modified, sector, size PACKING = "s32 s1 c2 l3 x16 x4 q2 l q".freeze @@ -140,6 +138,5 @@ module Axlsx @type ||= (data.nil? ? TYPES[:storage] : TYPES[:stream]) self.name = name end - end end diff --git a/lib/axlsx/util/zip_command.rb b/lib/axlsx/util/zip_command.rb index e83b44b0..23fd7cf6 100644 --- a/lib/axlsx/util/zip_command.rb +++ b/lib/axlsx/util/zip_command.rb @@ -2,7 +2,6 @@ require 'open3' require 'shellwords' module Axlsx - # The ZipCommand class supports zipping the Excel file contents using # a binary zip program instead of RubyZip's `Zip::OutputStream`. # diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb index 2fda2686..cf70e2e9 100644 --- a/lib/axlsx/version.rb +++ b/lib/axlsx/version.rb @@ -1,5 +1,4 @@ module Axlsx - # The current version VERSION = "3.3.0" end diff --git a/lib/axlsx/workbook/defined_names.rb b/lib/axlsx/workbook/defined_names.rb index abe8197a..30f80fcb 100644 --- a/lib/axlsx/workbook/defined_names.rb +++ b/lib/axlsx/workbook/defined_names.rb @@ -1,7 +1,6 @@ module Axlsx # a simple types list of DefinedName objects class DefinedNames < SimpleTypedList - # creates the DefinedNames object def initialize super DefinedName diff --git a/lib/axlsx/workbook/shared_strings_table.rb b/lib/axlsx/workbook/shared_strings_table.rb index bae33d9a..55040bc5 100644 --- a/lib/axlsx/workbook/shared_strings_table.rb +++ b/lib/axlsx/workbook/shared_strings_table.rb @@ -1,5 +1,4 @@ module Axlsx - # The Shared String Table class is responsible for managing and serializing common strings in a workbook. # While the ECMA-376 spec allows for both inline and shared strings it seems that at least some applications like iWorks Numbers # and Google Docs require that the shared string table is populated in order to interoperate properly. @@ -8,7 +7,6 @@ module Axlsx # @note Serialization performance is affected by using this serialization method so if you do not need interoperability # it is recomended that you use the default inline string method of serialization. class SharedStringsTable - # The total number of strings in the workbook including duplicates # Empty cells are treated as blank strings # @return [Integer] diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index deb42d86..f2d9eab5 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -82,7 +82,6 @@ require 'axlsx/workbook/worksheet/selection.rb' # # *workbookPr is only supported to the extend of date1904 class Workbook - BOLD_FONT_MULTIPLIER = 1.5 FONT_SCALE_DIVISOR = 10.0 @@ -413,6 +412,5 @@ require 'axlsx/workbook/worksheet/selection.rb' end str << '' end - end end diff --git a/lib/axlsx/workbook/workbook_view.rb b/lib/axlsx/workbook/workbook_view.rb index 2476ad84..b2656d00 100644 --- a/lib/axlsx/workbook/workbook_view.rb +++ b/lib/axlsx/workbook/workbook_view.rb @@ -19,14 +19,12 @@ # module Axlsx - # A BookView defines the display properties for a workbook. # Units for window widths and other dimensions are expressed in twips. # Twip measurements are portable between different display resolutions. # The formula is (screen pixels) * (20 * 72) / (logical device dpi), # where the logical device dpi can be different for x and y coordinates. class WorkbookView - include Axlsx::SerializedAttributes include Axlsx::OptionsParser include Axlsx::Accessors diff --git a/lib/axlsx/workbook/workbook_views.rb b/lib/axlsx/workbook/workbook_views.rb index 0a059e8a..025d083b 100644 --- a/lib/axlsx/workbook/workbook_views.rb +++ b/lib/axlsx/workbook/workbook_views.rb @@ -1,7 +1,6 @@ module Axlsx # a simple types list of BookView objects class WorkbookViews < SimpleTypedList - # creates the book views object def initialize super WorkbookView diff --git a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb index e419c0ab..fa0716a2 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb @@ -2,10 +2,8 @@ require 'axlsx/workbook/worksheet/auto_filter/filter_column.rb' require 'axlsx/workbook/worksheet/auto_filter/filters.rb' module Axlsx - #This class represents an auto filter range in a worksheet class AutoFilter - # creates a new Autofilter object # @param [Worksheet] worksheet def initialize(worksheet) @@ -72,6 +70,5 @@ module Axlsx columns.each { |filter_column| filter_column.to_xml_string(str) } str << "" end - end end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb index 4816fd55..54d43acf 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb @@ -4,7 +4,6 @@ module Axlsx # If a column in the AutoFilter range has no criteria specified, # then there is no corresponding filterColumn collection expressed for that column. class FilterColumn - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index 11356c0a..7b503acd 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -1,5 +1,4 @@ module Axlsx - # When multiple values are chosen to filter by, or when a group of date values are chosen to filter by, # this object groups those criteria together. class Filters @@ -104,7 +103,6 @@ module Axlsx # This class expresses a filter criteria value. class Filter - # Creates a new filter value object # @param [Any] value The value of the filter. This is not restricted, but # will be serialized via to_s so if you are passing an object diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb index ef4e5aea..b949a76e 100644 --- a/lib/axlsx/workbook/worksheet/border_creator.rb +++ b/lib/axlsx/workbook/worksheet/border_creator.rb @@ -75,6 +75,5 @@ module Axlsx def last_col @last_col ||= last_cell.scan(/\D+/).first end - end end diff --git a/lib/axlsx/workbook/worksheet/break.rb b/lib/axlsx/workbook/worksheet/break.rb index bf019eeb..a9e5fb11 100644 --- a/lib/axlsx/workbook/worksheet/break.rb +++ b/lib/axlsx/workbook/worksheet/break.rb @@ -1,9 +1,7 @@ module Axlsx - # The Break class stores the details for row and column page breaks. # @see RowBreaks, ColBreaks class Break - include Axlsx::OptionsParser include Axlsx::Accessors include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 24865b4d..725b1a39 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -6,7 +6,6 @@ module Axlsx # # @see Worksheet#add_row class Cell - include Axlsx::OptionsParser # @param [Row] row The row this cell belongs to. @@ -541,6 +540,5 @@ module Axlsx v.to_s end end - end end diff --git a/lib/axlsx/workbook/worksheet/cell_serializer.rb b/lib/axlsx/workbook/worksheet/cell_serializer.rb index 962b575d..b1ac8207 100644 --- a/lib/axlsx/workbook/worksheet/cell_serializer.rb +++ b/lib/axlsx/workbook/worksheet/cell_serializer.rb @@ -1,5 +1,4 @@ module Axlsx - # The Cell Serializer class contains the logic for serializing cells based on their type. class CellSerializer class << self diff --git a/lib/axlsx/workbook/worksheet/cfvo.rb b/lib/axlsx/workbook/worksheet/cfvo.rb index c2a4c781..c9eb8d3d 100644 --- a/lib/axlsx/workbook/worksheet/cfvo.rb +++ b/lib/axlsx/workbook/worksheet/cfvo.rb @@ -7,7 +7,6 @@ module Axlsx # @see ConditionalFormattingRule#initialize # class Cfvo - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/cfvos.rb b/lib/axlsx/workbook/worksheet/cfvos.rb index eb44f9d8..2fc2e65a 100644 --- a/lib/axlsx/workbook/worksheet/cfvos.rb +++ b/lib/axlsx/workbook/worksheet/cfvos.rb @@ -1,9 +1,7 @@ module Axlsx - #A collection of Cfvo objects that initializes with the required #first two items class Cfvos < SimpleTypedList - def initialize super(Cfvo) end diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index 29840c7a..6305b8c9 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -1,8 +1,6 @@ module Axlsx - # The Col class defines column attributes for columns in sheets. class Col - # Maximum column width limit in MS Excel is 255 characters # https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3 MAX_WIDTH = 255 @@ -139,6 +137,5 @@ module Axlsx def to_xml_string(str = '') serialized_tag('col', str) end - end end diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb index c803fc70..df7da37b 100644 --- a/lib/axlsx/workbook/worksheet/col_breaks.rb +++ b/lib/axlsx/workbook/worksheet/col_breaks.rb @@ -1,10 +1,8 @@ module Axlsx - # A collection of Brake objects. # Please do not use this class directly. Instead use # Worksheet#add_break class ColBreaks < SimpleTypedList - # Instantiates a new list restricted to Break types def initialize super Break diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb index b93240a5..60b0e183 100644 --- a/lib/axlsx/workbook/worksheet/color_scale.rb +++ b/lib/axlsx/workbook/worksheet/color_scale.rb @@ -6,9 +6,7 @@ module Axlsx # @see Worksheet#add_conditional_formatting # @see ConditionalFormattingRule#initialize class ColorScale - class << self - # These are the default conditional formatting value objects # that define a two tone color gradient. def default_cfvos diff --git a/lib/axlsx/workbook/worksheet/cols.rb b/lib/axlsx/workbook/worksheet/cols.rb index c0704343..7d93e603 100644 --- a/lib/axlsx/workbook/worksheet/cols.rb +++ b/lib/axlsx/workbook/worksheet/cols.rb @@ -1,9 +1,7 @@ module Axlsx - # The cols class manages the col object used to manage column widths. # This is where the magic happens with autowidth class Cols < SimpleTypedList - def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) super Col diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index 5230c940..9efdb1f0 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -1,8 +1,6 @@ module Axlsx - # A comment is the text data for a comment class Comment - include Axlsx::OptionsParser include Axlsx::Accessors diff --git a/lib/axlsx/workbook/worksheet/comments.rb b/lib/axlsx/workbook/worksheet/comments.rb index 72281f58..71a58c46 100644 --- a/lib/axlsx/workbook/worksheet/comments.rb +++ b/lib/axlsx/workbook/worksheet/comments.rb @@ -1,8 +1,6 @@ module Axlsx - # Comments is a collection of Comment objects for a worksheet class Comments < SimpleTypedList - # the vml_drawing that holds the shapes for comments # @return [VmlDrawing] attr_reader :vml_drawing @@ -73,9 +71,6 @@ module Axlsx comment.to_xml_string str end str << '' - end - end - end diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb index 4fe6578d..2ff13682 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb @@ -5,7 +5,6 @@ module Axlsx # @see Worksheet#add_conditional_formatting # @see ConditionalFormattingRule class ConditionalFormatting - include Axlsx::OptionsParser # Creates a new {ConditionalFormatting} object diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb index 8fa0c5b5..de1c4032 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb @@ -6,7 +6,6 @@ module Axlsx # @see Worksheet#add_conditional_formatting # @see ConditionalFormattingRule#initialize class ConditionalFormattingRule - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/conditional_formattings.rb b/lib/axlsx/workbook/worksheet/conditional_formattings.rb index 23301ff8..ad2e9c97 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formattings.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formattings.rb @@ -1,8 +1,6 @@ module Axlsx - # A simple, self serializing class for storing conditional formattings class ConditionalFormattings < SimpleTypedList - # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @@ -20,5 +18,4 @@ module Axlsx each { |item| item.to_xml_string(str) } end end - end diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb index e6455f1c..c89c421d 100644 --- a/lib/axlsx/workbook/worksheet/data_bar.rb +++ b/lib/axlsx/workbook/worksheet/data_bar.rb @@ -6,7 +6,6 @@ module Axlsx # @see Worksheet#add_conditional_formatting # @see ConditionalFormattingRule#initialize class DataBar - include Axlsx::OptionsParser include Axlsx::SerializedAttributes @@ -124,6 +123,5 @@ module Axlsx end end end - end end diff --git a/lib/axlsx/workbook/worksheet/data_validations.rb b/lib/axlsx/workbook/worksheet/data_validations.rb index 44afadf6..46cebe29 100644 --- a/lib/axlsx/workbook/worksheet/data_validations.rb +++ b/lib/axlsx/workbook/worksheet/data_validations.rb @@ -1,8 +1,6 @@ module Axlsx - # A simple, self serializing class for storing conditional formattings class DataValidations < SimpleTypedList - # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @@ -22,5 +20,4 @@ module Axlsx str << '' end end - end diff --git a/lib/axlsx/workbook/worksheet/date_time_converter.rb b/lib/axlsx/workbook/worksheet/date_time_converter.rb index 74199f2d..48d69d94 100644 --- a/lib/axlsx/workbook/worksheet/date_time_converter.rb +++ b/lib/axlsx/workbook/worksheet/date_time_converter.rb @@ -3,7 +3,6 @@ require "date" module Axlsx # The DateTimeConverter class converts both data and time types to their apprpriate excel serializations class DateTimeConverter - # The date_to_serial method converts Date objects to the equivelant excel serialized forms # @param [Date] date the date to be serialized # @return [Numeric] diff --git a/lib/axlsx/workbook/worksheet/dimension.rb b/lib/axlsx/workbook/worksheet/dimension.rb index 48b3a1c2..eaf0d038 100644 --- a/lib/axlsx/workbook/worksheet/dimension.rb +++ b/lib/axlsx/workbook/worksheet/dimension.rb @@ -1,10 +1,8 @@ module Axlsx - # This class manages the dimensions for a worksheet. # While this node is optional in the specification some readers like # LibraOffice require this node to render the sheet class Dimension - # the default value for the first cell in the dimension # @return [String] def self.default_first diff --git a/lib/axlsx/workbook/worksheet/header_footer.rb b/lib/axlsx/workbook/worksheet/header_footer.rb index db684fc9..5ad00565 100644 --- a/lib/axlsx/workbook/worksheet/header_footer.rb +++ b/lib/axlsx/workbook/worksheet/header_footer.rb @@ -9,7 +9,6 @@ module Axlsx # @note The recommended way of managing header/footers is via Worksheet#header_footer # @see Worksheet#initialize class HeaderFooter - include Axlsx::OptionsParser include Axlsx::SerializedAttributes include Axlsx::Accessors diff --git a/lib/axlsx/workbook/worksheet/icon_set.rb b/lib/axlsx/workbook/worksheet/icon_set.rb index 42afaa4d..0042e757 100644 --- a/lib/axlsx/workbook/worksheet/icon_set.rb +++ b/lib/axlsx/workbook/worksheet/icon_set.rb @@ -6,7 +6,6 @@ module Axlsx # @see Worksheet#add_conditional_formatting # @see ConditionalFormattingRule#initialize class IconSet - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/merged_cells.rb b/lib/axlsx/workbook/worksheet/merged_cells.rb index cb5bae93..60d95003 100644 --- a/lib/axlsx/workbook/worksheet/merged_cells.rb +++ b/lib/axlsx/workbook/worksheet/merged_cells.rb @@ -1,8 +1,6 @@ module Axlsx - # A simple list of merged cells class MergedCells < SimpleTypedList - # creates a new MergedCells object # @param [Worksheet] worksheet def initialize(worksheet) diff --git a/lib/axlsx/workbook/worksheet/outline_pr.rb b/lib/axlsx/workbook/worksheet/outline_pr.rb index f25ef4fa..5db0d825 100644 --- a/lib/axlsx/workbook/worksheet/outline_pr.rb +++ b/lib/axlsx/workbook/worksheet/outline_pr.rb @@ -1,5 +1,4 @@ module Axlsx - # The OutlinePr class manages serialization of a worksheet's outlinePr element, which provides various # options to control outlining. class OutlinePr diff --git a/lib/axlsx/workbook/worksheet/page_margins.rb b/lib/axlsx/workbook/worksheet/page_margins.rb index b3f8ddee..2dec65e6 100644 --- a/lib/axlsx/workbook/worksheet/page_margins.rb +++ b/lib/axlsx/workbook/worksheet/page_margins.rb @@ -9,7 +9,6 @@ module Axlsx # @see Worksheet#page_margins # @see Worksheet#initialize class PageMargins - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb index 03378a1a..2242f2bc 100644 --- a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +++ b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb @@ -1,9 +1,7 @@ module Axlsx - # Page setup properties of the worksheet # This class name is not a typo, its spec. class PageSetUpPr - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb index b3117942..6281eb74 100644 --- a/lib/axlsx/workbook/worksheet/page_setup.rb +++ b/lib/axlsx/workbook/worksheet/page_setup.rb @@ -5,7 +5,6 @@ module Axlsx # @see Worksheet#print_options # @see Worksheet#initialize class PageSetup - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb index bff08bb5..9acfa14b 100644 --- a/lib/axlsx/workbook/worksheet/pane.rb +++ b/lib/axlsx/workbook/worksheet/pane.rb @@ -4,7 +4,6 @@ module Axlsx # @note The recommended way to manage the pane options is via SheetView#pane # @see SheetView#pane class Pane - include Axlsx::OptionsParser include Axlsx::SerializedAttributes # Creates a new {Pane} object diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb index 23d9828e..ed51d5cf 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table.rb @@ -3,7 +3,6 @@ module Axlsx # @note Worksheet#add_pivot_table is the recommended way to create tables for your worksheets. # @see README for examples class PivotTable - include Axlsx::OptionsParser # Creates a new PivotTable object diff --git a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb index b0e764ca..2c7c05e4 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb @@ -3,7 +3,6 @@ module Axlsx # @note Worksheet#add_pivot_table is the recommended way to create tables for your worksheets. # @see README for examples class PivotTableCacheDefinition - include Axlsx::OptionsParser # Creates a new PivotTable object @@ -60,6 +59,5 @@ module Axlsx str << '' str << '' end - end end diff --git a/lib/axlsx/workbook/worksheet/pivot_tables.rb b/lib/axlsx/workbook/worksheet/pivot_tables.rb index 912d9f41..8aaebea2 100644 --- a/lib/axlsx/workbook/worksheet/pivot_tables.rb +++ b/lib/axlsx/workbook/worksheet/pivot_tables.rb @@ -1,8 +1,6 @@ module Axlsx - # A simple, self serializing class for storing pivot tables class PivotTables < SimpleTypedList - # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @@ -20,5 +18,4 @@ module Axlsx map{ |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, "../#{pivot_table.pn}") } end end - end diff --git a/lib/axlsx/workbook/worksheet/print_options.rb b/lib/axlsx/workbook/worksheet/print_options.rb index e57c2094..7ba52861 100644 --- a/lib/axlsx/workbook/worksheet/print_options.rb +++ b/lib/axlsx/workbook/worksheet/print_options.rb @@ -5,7 +5,6 @@ module Axlsx # @see Worksheet#print_options # @see Worksheet#initialize class PrintOptions - include Axlsx::OptionsParser include Axlsx::SerializedAttributes include Axlsx::Accessors diff --git a/lib/axlsx/workbook/worksheet/protected_range.rb b/lib/axlsx/workbook/worksheet/protected_range.rb index e0da00df..07f9a20c 100644 --- a/lib/axlsx/workbook/worksheet/protected_range.rb +++ b/lib/axlsx/workbook/worksheet/protected_range.rb @@ -3,7 +3,6 @@ module Axlsx # @note the recommended way to manage protected ranges with via Worksheet#protect_range # @see Worksheet#protect_range class ProtectedRange - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/protected_ranges.rb b/lib/axlsx/workbook/worksheet/protected_ranges.rb index d274cf80..d16dbbd6 100644 --- a/lib/axlsx/workbook/worksheet/protected_ranges.rb +++ b/lib/axlsx/workbook/worksheet/protected_ranges.rb @@ -1,9 +1,7 @@ module Axlsx - # A self serializing collection of ranges that should be protected in # the worksheet class ProtectedRanges < SimpleTypedList - attr_reader :worksheet def initialize(worksheet) diff --git a/lib/axlsx/workbook/worksheet/rich_text.rb b/lib/axlsx/workbook/worksheet/rich_text.rb index 81af32b2..e5156047 100644 --- a/lib/axlsx/workbook/worksheet/rich_text.rb +++ b/lib/axlsx/workbook/worksheet/rich_text.rb @@ -1,8 +1,6 @@ module Axlsx - # A simple, self serializing class for storing TextRuns class RichText < SimpleTypedList - # creates a new RichText collection # @param [String] text -optional The text to use in creating the first RichTextRun # @param [Object] options -optional The options to use in creating the first RichTextRun diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb index 89dcd157..44046709 100644 --- a/lib/axlsx/workbook/worksheet/rich_text_run.rb +++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb @@ -1,8 +1,6 @@ module Axlsx - # The RichTextRun class creates and self serializing text run. class RichTextRun - include Axlsx::OptionsParser attr_reader :value diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index ee5b9509..fc044124 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -159,5 +159,4 @@ module Axlsx end end end - end diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb index 0e6e8646..e4cbf4f2 100644 --- a/lib/axlsx/workbook/worksheet/row_breaks.rb +++ b/lib/axlsx/workbook/worksheet/row_breaks.rb @@ -1,9 +1,7 @@ module Axlsx - # A collection of break objects that define row breaks (page breaks) for printing and preview class RowBreaks < SimpleTypedList - def initialize super Break end diff --git a/lib/axlsx/workbook/worksheet/selection.rb b/lib/axlsx/workbook/worksheet/selection.rb index 4c02d286..efa56056 100644 --- a/lib/axlsx/workbook/worksheet/selection.rb +++ b/lib/axlsx/workbook/worksheet/selection.rb @@ -4,7 +4,6 @@ module Axlsx # @note The recommended way to manage the selection pane options is via SheetView#add_selection # @see SheetView#add_selection class Selection - include Axlsx::OptionsParser include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb index 88ada9ae..b42ecb31 100644 --- a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb @@ -1,5 +1,4 @@ module Axlsx - # the SheetCalcPr object for the worksheet # This object contains calculation properties for the worksheet. class SheetCalcPr diff --git a/lib/axlsx/workbook/worksheet/sheet_data.rb b/lib/axlsx/workbook/worksheet/sheet_data.rb index 0b697fbb..f245d07c 100644 --- a/lib/axlsx/workbook/worksheet/sheet_data.rb +++ b/lib/axlsx/workbook/worksheet/sheet_data.rb @@ -1,8 +1,6 @@ module Axlsx - # This class manages the serialization of rows for worksheets class SheetData - # Creates a new SheetData object # @param [Worksheet] worksheet The worksheet that owns this sheet data. def initialize(worksheet) @@ -22,6 +20,5 @@ module Axlsx end str << '' end - end end diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index e0b981ef..de4c6e16 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -1,5 +1,4 @@ module Axlsx - # Sheet formatting properties # # diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb index e369cb52..6f76b580 100644 --- a/lib/axlsx/workbook/worksheet/sheet_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb @@ -1,5 +1,4 @@ module Axlsx - # The SheetPr class manages serialization of a worksheet's sheetPr element. class SheetPr include Axlsx::OptionsParser diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index d1aaf00c..c921d381 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -1,8 +1,6 @@ module Axlsx - # The SheetProtection object manages worksheet protection options per sheet. class SheetProtection - include Axlsx::OptionsParser include Axlsx::SerializedAttributes include Axlsx::Accessors diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index 104243ce..17a547ea 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -4,7 +4,6 @@ module Axlsx # @note The recommended way to manage the sheet view is via Worksheet#sheet_view # @see Worksheet#sheet_view class SheetView - include Axlsx::OptionsParser include Axlsx::Accessors include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb index e660d26c..5053c5fd 100644 --- a/lib/axlsx/workbook/worksheet/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -3,7 +3,6 @@ module Axlsx # @note Worksheet#add_table is the recommended way to create tables for your worksheets. # @see README for examples class Table - include Axlsx::OptionsParser # Creates a new Table object diff --git a/lib/axlsx/workbook/worksheet/table_style_info.rb b/lib/axlsx/workbook/worksheet/table_style_info.rb index c4678310..f7b7bff4 100644 --- a/lib/axlsx/workbook/worksheet/table_style_info.rb +++ b/lib/axlsx/workbook/worksheet/table_style_info.rb @@ -1,5 +1,4 @@ module Axlsx - # The table style info class manages style attributes for defined tables in # a worksheet class TableStyleInfo diff --git a/lib/axlsx/workbook/worksheet/tables.rb b/lib/axlsx/workbook/worksheet/tables.rb index d033212c..bf6efe0c 100644 --- a/lib/axlsx/workbook/worksheet/tables.rb +++ b/lib/axlsx/workbook/worksheet/tables.rb @@ -1,8 +1,6 @@ module Axlsx - # A simple, self serializing class for storing tables class Tables < SimpleTypedList - # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @@ -30,5 +28,4 @@ module Axlsx str << '' end end - end diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index a32bc5b6..c3960af3 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -1,7 +1,6 @@ require_relative "border_creator" module Axlsx - # The Worksheet class represents a worksheet in the workbook. class Worksheet include Axlsx::OptionsParser @@ -831,6 +830,5 @@ module Axlsx return if !auto_filter.range workbook.add_defined_name auto_filter.defined_name, name: '_xlnm._FilterDatabase', local_sheet_id: index, hidden: 1 end - end end diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb index e976ad5c..d8aed8e0 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb @@ -1,9 +1,7 @@ module Axlsx - # A wraper class for comments that defines its on worksheet # serailization class WorksheetComments - # Creates a new WorksheetComments object # param [Worksheet] worksheet The worksheet comments in thes object belong to def initialize(worksheet) diff --git a/lib/axlsx/workbook/worksheet/worksheet_drawing.rb b/lib/axlsx/workbook/worksheet/worksheet_drawing.rb index ae03ac0f..e461ffa9 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_drawing.rb @@ -1,11 +1,9 @@ module Axlsx - # This is a utility class for serialing the drawing node in a # worksheet. Drawing objects have their own serialization that exports # a drawing document. This is only for the single node in the # worksheet class WorksheetDrawing - # Creates a new WorksheetDrawing # @param [Worksheet] worksheet def initialize(worksheet) diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb index 2a241287..f79bc814 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb @@ -1,8 +1,6 @@ module Axlsx - # A worksheet hyperlink object. Note that this is not the same as a drawing hyperlink object. class WorksheetHyperlink - include Axlsx::OptionsParser include Axlsx::Accessors include Axlsx::SerializedAttributes diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb index a242f0f8..5d5a2186 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb @@ -1,8 +1,6 @@ module Axlsx - #A collection of hyperlink objects for a worksheet class WorksheetHyperlinks < SimpleTypedList - # Creates a new Hyperlinks collection # @param [Worksheet] worksheet the worksheet that owns these hyperlinks def initialize(worksheet) diff --git a/test/content_type/tc_content_type.rb b/test/content_type/tc_content_type.rb index 60fa9c76..278cd67b 100644 --- a/test/content_type/tc_content_type.rb +++ b/test/content_type/tc_content_type.rb @@ -12,7 +12,6 @@ class TestContentType < Test::Unit::TestCase end def test_pre_built_types - o_path = "//xmlns:Override[@ContentType='%s']" d_path = "//xmlns:Default[@ContentType='%s']" @@ -53,7 +52,6 @@ class TestContentType < Test::Unit::TestCase doc = Nokogiri::XML(@package.send(:content_types).to_xml_string) assert_equal(doc.xpath("//xmlns:Override").size, 6, "adding workship should add another type") assert_equal(doc.xpath(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid") - end def test_drawings_and_charts_need_content_types @@ -71,5 +69,4 @@ class TestContentType < Test::Unit::TestCase assert_equal(doc.xpath("//xmlns:Override").size, 8, "expected 7 types got #{doc.css("Types Override").size}") assert_equal(doc.xpath(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid") end - end diff --git a/test/content_type/tc_default.rb b/test/content_type/tc_default.rb index b6c040ac..77915ea0 100644 --- a/test/content_type/tc_default.rb +++ b/test/content_type/tc_default.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestDefault < Test::Unit::TestCase - def test_content_type_restriction assert_raise(ArgumentError, "raises argument error if invlalid ContentType is") { Axlsx::Default.new :ContentType=>"asdf" } end diff --git a/test/content_type/tc_override.rb b/test/content_type/tc_override.rb index d9bec90c..c21f9f27 100644 --- a/test/content_type/tc_override.rb +++ b/test/content_type/tc_override.rb @@ -1,6 +1,5 @@ require 'tc_helper.rb' class TestOverride < Test::Unit::TestCase - def test_content_type_restriction assert_raise(ArgumentError, "requires known content type") { Axlsx::Override.new :ContentType=>"asdf" } end diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb index 8d8efd4b..7718a6c2 100644 --- a/test/doc_props/tc_app.rb +++ b/test/doc_props/tc_app.rb @@ -29,7 +29,6 @@ class TestApp < Test::Unit::TestCase } @app = Axlsx::App.new options - end def test_valid_document diff --git a/test/doc_props/tc_core.rb b/test/doc_props/tc_core.rb index 0eddfed7..6ba01b5f 100644 --- a/test/doc_props/tc_core.rb +++ b/test/doc_props/tc_core.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestCore < Test::Unit::TestCase - def setup @core = Axlsx::Core.new # could still see some false positives if the second changes between the next two calls diff --git a/test/drawing/tc_area_chart.rb b/test/drawing/tc_area_chart.rb index b3013c12..fc928db9 100644 --- a/test/drawing/tc_area_chart.rb +++ b/test/drawing/tc_area_chart.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestAreaChart < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet @@ -35,5 +34,4 @@ class TestAreaChart < Test::Unit::TestCase end assert(errors.empty?, "error free validation") end - end diff --git a/test/drawing/tc_area_series.rb b/test/drawing/tc_area_series.rb index 00229a39..efe48256 100644 --- a/test/drawing/tc_area_series.rb +++ b/test/drawing/tc_area_series.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestAreaSeries < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" diff --git a/test/drawing/tc_bar_3D_chart.rb b/test/drawing/tc_bar_3D_chart.rb index b7a1eca4..f7e15dea 100644 --- a/test/drawing/tc_bar_3D_chart.rb +++ b/test/drawing/tc_bar_3D_chart.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestBar3DChart < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet diff --git a/test/drawing/tc_bar_chart.rb b/test/drawing/tc_bar_chart.rb index c8bdc8d0..75a2970d 100644 --- a/test/drawing/tc_bar_chart.rb +++ b/test/drawing/tc_bar_chart.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestBarChart < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet diff --git a/test/drawing/tc_bar_series.rb b/test/drawing/tc_bar_series.rb index f076fae0..81b88683 100644 --- a/test/drawing/tc_bar_series.rb +++ b/test/drawing/tc_bar_series.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestBarSeries < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" diff --git a/test/drawing/tc_bubble_chart.rb b/test/drawing/tc_bubble_chart.rb index 7adad218..7a9af423 100644 --- a/test/drawing/tc_bubble_chart.rb +++ b/test/drawing/tc_bubble_chart.rb @@ -40,5 +40,4 @@ class TestBubbleChart < Test::Unit::TestCase end assert(errors.empty?, "error free validation") end - end diff --git a/test/drawing/tc_bubble_series.rb b/test/drawing/tc_bubble_series.rb index e601912f..a784619f 100644 --- a/test/drawing/tc_bubble_series.rb +++ b/test/drawing/tc_bubble_series.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestBubbleSeries < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" @@ -17,5 +16,4 @@ class TestBubbleSeries < Test::Unit::TestCase doc = Nokogiri::XML(@chart.to_xml_string) assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size,2) end - end diff --git a/test/drawing/tc_cat_axis.rb b/test/drawing/tc_cat_axis.rb index b020fc53..79c0f8db 100644 --- a/test/drawing/tc_cat_axis.rb +++ b/test/drawing/tc_cat_axis.rb @@ -28,5 +28,4 @@ class TestCatAxis < Test::Unit::TestCase assert_raise(ArgumentError, "requires valid label offset") { @axis.lbl_offset = 'foo' } assert_nothing_raised("accepts valid label offset") { @axis.lbl_offset = "20" } end - end diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb index 65d7877c..c322b37a 100644 --- a/test/drawing/tc_chart.rb +++ b/test/drawing/tc_chart.rb @@ -3,7 +3,6 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../" require 'tc_helper.rb' class TestChart < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet @@ -46,7 +45,6 @@ class TestChart < Test::Unit::TestCase assert_raise(ArgumentError) { @chart.bg_color = 2 } assert_nothing_raised { @chart.bg_color = "FFFFFF" } assert_equal(@chart.bg_color, "FFFFFF") - end def test_title_size @@ -80,7 +78,6 @@ class TestChart < Test::Unit::TestCase @chart.start_at [5,6] assert_equal(@chart.graphic_frame.anchor.from.col, 5) assert_equal(@chart.graphic_frame.anchor.from.row, 6) - end def test_end_at @@ -93,7 +90,6 @@ class TestChart < Test::Unit::TestCase @chart.end_at [10,11] assert_equal(@chart.graphic_frame.anchor.to.col, 10) assert_equal(@chart.graphic_frame.anchor.to.row, 11) - end def test_add_series @@ -107,7 +103,6 @@ class TestChart < Test::Unit::TestCase end def test_d_lbls - assert_equal(nil, Axlsx.instance_values_for(@chart)[:d_lbls]) @chart.d_lbls.d_lbl_pos = :t assert(@chart.d_lbls.is_a?(Axlsx::DLbls), 'DLbls instantiated on access') diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb index cc12b561..ce71a00f 100644 --- a/test/drawing/tc_d_lbls.rb +++ b/test/drawing/tc_d_lbls.rb @@ -1,7 +1,6 @@ require 'tc_helper' class TestDLbls < Test::Unit::TestCase - def setup @d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart) @boolean_attributes =[:show_legend_key, @@ -21,7 +20,6 @@ class TestDLbls < Test::Unit::TestCase end def test_initialization_with_optoins - options_hash = Hash[*[@boolean_attributes.map { |name| [name, true] }]] d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge( { :d_lbl_pos => :t })) diff --git a/test/drawing/tc_data_source.rb b/test/drawing/tc_data_source.rb index 9ec260d8..2fec667f 100644 --- a/test/drawing/tc_data_source.rb +++ b/test/drawing/tc_data_source.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestNumDataSource < Test::Unit::TestCase - def setup @data_source = Axlsx::NumDataSource.new :data => ["1", "2", "3"] end @@ -19,5 +18,4 @@ require 'tc_helper.rb' doc = Nokogiri::XML(str) assert_equal(doc.xpath("//c:val").size, 1) end - end diff --git a/test/drawing/tc_drawing.rb b/test/drawing/tc_drawing.rb index bc9fc686..04b6ead6 100644 --- a/test/drawing/tc_drawing.rb +++ b/test/drawing/tc_drawing.rb @@ -4,7 +4,6 @@ class TestDrawing < Test::Unit::TestCase def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet - end def test_initialization @@ -78,5 +77,4 @@ class TestDrawing < Test::Unit::TestCase end assert(errors.empty?, "error free validation") end - end diff --git a/test/drawing/tc_hyperlink.rb b/test/drawing/tc_hyperlink.rb index d4fd4e13..ad8299b7 100644 --- a/test/drawing/tc_hyperlink.rb +++ b/test/drawing/tc_hyperlink.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestHyperlink < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet diff --git a/test/drawing/tc_line_3d_chart.rb b/test/drawing/tc_line_3d_chart.rb index ea0748c7..55398d50 100644 --- a/test/drawing/tc_line_3d_chart.rb +++ b/test/drawing/tc_line_3d_chart.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestLine3DChart < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet @@ -42,5 +41,4 @@ class TestLine3DChart < Test::Unit::TestCase end assert(errors.empty?, "error free validation") end - end diff --git a/test/drawing/tc_line_chart.rb b/test/drawing/tc_line_chart.rb index 0783edae..113ef844 100644 --- a/test/drawing/tc_line_chart.rb +++ b/test/drawing/tc_line_chart.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestLineChart < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet @@ -35,5 +34,4 @@ class TestLineChart < Test::Unit::TestCase end assert(errors.empty?, "error free validation") end - end diff --git a/test/drawing/tc_line_series.rb b/test/drawing/tc_line_series.rb index d939096f..1327a48f 100644 --- a/test/drawing/tc_line_series.rb +++ b/test/drawing/tc_line_series.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestLineSeries < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" diff --git a/test/drawing/tc_marker.rb b/test/drawing/tc_marker.rb index 05137ae7..fdc6d5a1 100644 --- a/test/drawing/tc_marker.rb +++ b/test/drawing/tc_marker.rb @@ -40,5 +40,4 @@ class TestMarker < Test::Unit::TestCase assert_equal(@marker.col, 5) assert_equal(@marker.row, 10) end - end diff --git a/test/drawing/tc_num_data.rb b/test/drawing/tc_num_data.rb index f2ac64b8..fc5fabee 100644 --- a/test/drawing/tc_num_data.rb +++ b/test/drawing/tc_num_data.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestNumData < Test::Unit::TestCase - def setup @num_data = Axlsx::NumData.new :data => [1, 2, 3] end @@ -11,7 +10,6 @@ class TestNumData < Test::Unit::TestCase end def test_formula_based_cell - end def test_format_code @@ -27,5 +25,4 @@ class TestNumData < Test::Unit::TestCase assert_equal(doc.xpath("//c:numLit/c:ptCount[@val=3]").size, 1) assert_equal(doc.xpath("//c:numLit/c:pt/c:v[text()='1']").size, 1) end - end diff --git a/test/drawing/tc_num_val.rb b/test/drawing/tc_num_val.rb index ef27deb9..9722b434 100644 --- a/test/drawing/tc_num_val.rb +++ b/test/drawing/tc_num_val.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestNumVal < Test::Unit::TestCase - def setup @num_val = Axlsx::NumVal.new :v => 1 end @@ -23,7 +22,5 @@ class TestNumVal < Test::Unit::TestCase doc = Nokogiri::XML(str) # lets see if this works? assert_equal(doc.xpath("//c:pt/c:v[text()='1']").size, 1) - end - end diff --git a/test/drawing/tc_one_cell_anchor.rb b/test/drawing/tc_one_cell_anchor.rb index 3c1db55f..f9a04492 100644 --- a/test/drawing/tc_one_cell_anchor.rb +++ b/test/drawing/tc_one_cell_anchor.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestOneCellAnchor < Test::Unit::TestCase - def setup @p = Axlsx::Package.new @ws = @p.workbook.add_worksheet @@ -62,5 +61,4 @@ class TestOneCellAnchor < Test::Unit::TestCase assert_equal(2, i.anchor.from.row) assert_equal(@test_img, i.image_src) end - end diff --git a/test/drawing/tc_pic.rb b/test/drawing/tc_pic.rb index 8c2088d4..bb81fc00 100644 --- a/test/drawing/tc_pic.rb +++ b/test/drawing/tc_pic.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestPic < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet @@ -35,7 +34,6 @@ class TestPic < Test::Unit::TestCase assert_equal(start_at.col, @image.anchor.from.col) assert_equal(start_at.row, @image.anchor.from.row) assert_equal(200, @image.width) - end def test_hyperlink diff --git a/test/drawing/tc_picture_locking.rb b/test/drawing/tc_picture_locking.rb index 3714df0b..7347a571 100644 --- a/test/drawing/tc_picture_locking.rb +++ b/test/drawing/tc_picture_locking.rb @@ -66,5 +66,4 @@ class TestPictureLocking < Test::Unit::TestCase assert_nothing_raised { @item.noChangeShapeType = false } assert_equal(@item.noChangeShapeType, false ) end - end diff --git a/test/drawing/tc_pie_3D_chart.rb b/test/drawing/tc_pie_3D_chart.rb index a941eacd..6eb0dfe5 100644 --- a/test/drawing/tc_pie_3D_chart.rb +++ b/test/drawing/tc_pie_3D_chart.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestPie3DChart < Test::Unit::TestCase - def setup p = Axlsx::Package.new ws = p.workbook.add_worksheet @@ -24,5 +23,4 @@ class TestPie3DChart < Test::Unit::TestCase errors = schema.validate(doc).map {|error| puts error.message; error } assert(errors.empty?, "error free validation") end - end diff --git a/test/drawing/tc_pie_series.rb b/test/drawing/tc_pie_series.rb index 18e4bbd0..7ab81f46 100644 --- a/test/drawing/tc_pie_series.rb +++ b/test/drawing/tc_pie_series.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestPieSeries < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" @@ -29,5 +28,4 @@ class TestPieSeries < Test::Unit::TestCase assert(doc.xpath("//srgbClr[@val='#{@series.colors[0]}']")) end #TODO test unique serialization parts - end diff --git a/test/drawing/tc_scaling.rb b/test/drawing/tc_scaling.rb index 361f0b5d..909dded5 100644 --- a/test/drawing/tc_scaling.rb +++ b/test/drawing/tc_scaling.rb @@ -31,5 +31,4 @@ class TestScaling < Test::Unit::TestCase assert_raise(ArgumentError) { @scaling.min = 1} assert_nothing_raised {@scaling.min = 10.5} end - end diff --git a/test/drawing/tc_scatter_chart.rb b/test/drawing/tc_scatter_chart.rb index 37748b2f..a8d713eb 100644 --- a/test/drawing/tc_scatter_chart.rb +++ b/test/drawing/tc_scatter_chart.rb @@ -45,5 +45,4 @@ class TestScatterChart < Test::Unit::TestCase end assert(errors.empty?, "error free validation") end - end diff --git a/test/drawing/tc_scatter_series.rb b/test/drawing/tc_scatter_series.rb index 3d1d294d..fb30dd70 100644 --- a/test/drawing/tc_scatter_series.rb +++ b/test/drawing/tc_scatter_series.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestScatterSeries < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" @@ -70,5 +69,4 @@ class TestScatterSeries < Test::Unit::TestCase @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :marker_symbol => :diamond assert_equal(@series.marker_symbol, :diamond, 'series could have own custom marker symbol') end - end diff --git a/test/drawing/tc_ser_axis.rb b/test/drawing/tc_ser_axis.rb index 342099cc..4b498a12 100644 --- a/test/drawing/tc_ser_axis.rb +++ b/test/drawing/tc_ser_axis.rb @@ -25,5 +25,4 @@ class TestSerAxis < Test::Unit::TestCase assert_nothing_raised("accepts valid tick_mark_skip") { @axis.tick_mark_skip = 2 } assert_equal(@axis.tick_mark_skip, 2) end - end diff --git a/test/drawing/tc_series.rb b/test/drawing/tc_series.rb index b32595a7..fc4d97e3 100644 --- a/test/drawing/tc_series.rb +++ b/test/drawing/tc_series.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestSeries < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" @@ -19,5 +18,4 @@ class TestSeries < Test::Unit::TestCase @series.order = 2 assert_equal(@series.order, 2) end - end diff --git a/test/drawing/tc_str_data.rb b/test/drawing/tc_str_data.rb index a116965b..f964a7b3 100644 --- a/test/drawing/tc_str_data.rb +++ b/test/drawing/tc_str_data.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestStrData < Test::Unit::TestCase - def setup @str_data = Axlsx::StrData.new :data => ["1", "2", "3"] end @@ -14,5 +13,4 @@ class TestStrData < Test::Unit::TestCase assert_equal(doc.xpath("//c:strLit/c:ptCount[@val=3]").size, 1) assert_equal(doc.xpath("//c:strLit/c:pt/c:v[text()='1']").size, 1) end - end diff --git a/test/drawing/tc_str_val.rb b/test/drawing/tc_str_val.rb index e4547f62..03b0b32a 100644 --- a/test/drawing/tc_str_val.rb +++ b/test/drawing/tc_str_val.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestStrVal < Test::Unit::TestCase - def setup @str_val = Axlsx::StrVal.new :v => "1" @str_val_with_special_characters = Axlsx::StrVal.new :v => "a & b " @@ -26,5 +25,4 @@ class TestStrVal < Test::Unit::TestCase doc = Nokogiri::XML(str) assert_equal(doc.xpath("//c:pt/c:v[text()='a & b ']").size, 1) end - end diff --git a/test/drawing/tc_two_cell_anchor.rb b/test/drawing/tc_two_cell_anchor.rb index db84521d..2c0f32bd 100644 --- a/test/drawing/tc_two_cell_anchor.rb +++ b/test/drawing/tc_two_cell_anchor.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestTwoCellAnchor < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet @@ -32,5 +31,4 @@ class TestTwoCellAnchor < Test::Unit::TestCase assert_equal(a.graphic_frame.anchor.to.col, 90) assert_equal(a.graphic_frame.anchor.to.row, 45) end - end diff --git a/test/drawing/tc_val_axis.rb b/test/drawing/tc_val_axis.rb index 7fd9d1dd..a607ddb1 100644 --- a/test/drawing/tc_val_axis.rb +++ b/test/drawing/tc_val_axis.rb @@ -21,5 +21,4 @@ class TestValAxis < Test::Unit::TestCase assert_raise(ArgumentError, "requires valid crossBetween") { @axis.cross_between = :my_eyes } assert_nothing_raised("accepts valid crossBetween") { @axis.cross_between = :midCat } end - end diff --git a/test/drawing/tc_view_3D.rb b/test/drawing/tc_view_3D.rb index 175428ca..6202d851 100644 --- a/test/drawing/tc_view_3D.rb +++ b/test/drawing/tc_view_3D.rb @@ -47,5 +47,4 @@ class TestView3D < Test::Unit::TestCase assert_raise(ArgumentError) {@view.perspective = "bob"} assert_nothing_raised {@view.perspective = 30} end - end diff --git a/test/drawing/tc_vml_drawing.rb b/test/drawing/tc_vml_drawing.rb index ac95a2f3..792384e9 100644 --- a/test/drawing/tc_vml_drawing.rb +++ b/test/drawing/tc_vml_drawing.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestVmlDrawing < Test::Unit::TestCase - def setup p = Axlsx::Package.new wb = p.workbook @@ -21,5 +20,4 @@ class TestVmlDrawing < Test::Unit::TestCase assert_equal(doc.xpath("//v:shape").size, 2) assert(doc.xpath("//o:idmap[@o:data='#{@ws.index+1}']")) end - end diff --git a/test/drawing/tc_vml_shape.rb b/test/drawing/tc_vml_shape.rb index d8f10b56..b8344a92 100644 --- a/test/drawing/tc_vml_shape.rb +++ b/test/drawing/tc_vml_shape.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestVmlShape < Test::Unit::TestCase - def setup p = Axlsx::Package.new wb = p.workbook @@ -104,5 +103,4 @@ class TestVmlShape < Test::Unit::TestCase assert(doc.xpath("//v:shape/x:ClientData/x:Anchor[text()='#{shape.left_column}, #{shape.left_offset}, #{shape.top_row}, #{shape.top_offset}, #{shape.right_column}, #{shape.right_offset}, #{shape.bottom_row}, #{shape.bottom_offset}']").size == 1) end end - end diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb index b9674a19..afdf5d1f 100644 --- a/test/rels/tc_relationship.rb +++ b/test/rels/tc_relationship.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestRelationships < Test::Unit::TestCase - def test_instances_with_different_attributes_have_unique_ids rel_1 = Axlsx::Relationship.new(Object.new, Axlsx::WORKSHEET_R, 'target') rel_2 = Axlsx::Relationship.new(Object.new, Axlsx::COMMENT_R, 'foobar') diff --git a/test/rels/tc_relationships.rb b/test/rels/tc_relationships.rb index 768570b1..43e413cd 100644 --- a/test/rels/tc_relationships.rb +++ b/test/rels/tc_relationships.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestRelationships < Test::Unit::TestCase - def test_for source_obj_1, source_obj_2 = Object.new, Object.new rel_1 = Axlsx::Relationship.new(source_obj_1, Axlsx::WORKSHEET_R, "bar") @@ -33,5 +32,4 @@ class TestRelationships < Test::Unit::TestCase assert(errors.size == 0) end - end diff --git a/test/stylesheet/tc_cell_alignment.rb b/test/stylesheet/tc_cell_alignment.rb index 6b8cd5cd..a61d764f 100644 --- a/test/stylesheet/tc_cell_alignment.rb +++ b/test/stylesheet/tc_cell_alignment.rb @@ -77,5 +77,4 @@ class TestCellAlignment < Test::Unit::TestCase assert_nothing_raised { @item.readingOrder = 2 } assert_equal(@item.readingOrder, 2 ) end - end diff --git a/test/stylesheet/tc_cell_protection.rb b/test/stylesheet/tc_cell_protection.rb index b2161fa6..a9648745 100644 --- a/test/stylesheet/tc_cell_protection.rb +++ b/test/stylesheet/tc_cell_protection.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestCellProtection < Test::Unit::TestCase - def setup @item = Axlsx::CellProtection.new end @@ -25,5 +24,4 @@ class TestCellProtection < Test::Unit::TestCase assert_nothing_raised { @item.locked = false } assert_equal(@item.locked, false ) end - end diff --git a/test/stylesheet/tc_cell_style.rb b/test/stylesheet/tc_cell_style.rb index 8700d8c3..5e71a698 100644 --- a/test/stylesheet/tc_cell_style.rb +++ b/test/stylesheet/tc_cell_style.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestCellStyle < Test::Unit::TestCase - def setup @item = Axlsx::CellStyle.new end @@ -53,5 +52,4 @@ class TestCellStyle < Test::Unit::TestCase assert_nothing_raised { @item.customBuiltin = true } assert_equal(@item.customBuiltin, true ) end - end diff --git a/test/stylesheet/tc_color.rb b/test/stylesheet/tc_color.rb index 660cc672..1fff4c3b 100644 --- a/test/stylesheet/tc_color.rb +++ b/test/stylesheet/tc_color.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestColor < Test::Unit::TestCase - def setup @item = Axlsx::Color.new end @@ -38,5 +37,4 @@ class TestColor < Test::Unit::TestCase assert_nothing_raised { @item.tint = -1.0 } assert_equal(@item.tint, -1.0 ) end - end diff --git a/test/stylesheet/tc_dxf.rb b/test/stylesheet/tc_dxf.rb index eb5c4014..ffc59dfb 100644 --- a/test/stylesheet/tc_dxf.rb +++ b/test/stylesheet/tc_dxf.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestDxf < Test::Unit::TestCase - def setup @item = Axlsx::Dxf.new @styles = Axlsx::Styles.new diff --git a/test/stylesheet/tc_fill.rb b/test/stylesheet/tc_fill.rb index 9aadef29..dd61204f 100644 --- a/test/stylesheet/tc_fill.rb +++ b/test/stylesheet/tc_fill.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestFill < Test::Unit::TestCase - def setup @item = Axlsx::Fill.new Axlsx::PatternFill.new end @@ -14,5 +13,4 @@ class TestFill < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx::Fill.new } assert_nothing_raised { Axlsx::Fill.new(Axlsx::GradientFill.new) } end - end diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb index aaa72aa0..fb52f846 100644 --- a/test/stylesheet/tc_font.rb +++ b/test/stylesheet/tc_font.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestFont < Test::Unit::TestCase - def setup @item = Axlsx::Font.new end @@ -127,5 +126,4 @@ class TestFont < Test::Unit::TestCase assert_nothing_raised { @item.sz = 5 } assert_equal(@item.sz, 5) end - end diff --git a/test/stylesheet/tc_gradient_fill.rb b/test/stylesheet/tc_gradient_fill.rb index b8ce757b..9ff043cc 100644 --- a/test/stylesheet/tc_gradient_fill.rb +++ b/test/stylesheet/tc_gradient_fill.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestGradientFill < Test::Unit::TestCase - def setup @item = Axlsx::GradientFill.new end diff --git a/test/stylesheet/tc_gradient_stop.rb b/test/stylesheet/tc_gradient_stop.rb index 1340e225..2865f12d 100644 --- a/test/stylesheet/tc_gradient_stop.rb +++ b/test/stylesheet/tc_gradient_stop.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestGradientStop < Test::Unit::TestCase - def setup @item = Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"FFFF0000"), 1.0) end @@ -26,5 +25,4 @@ class TestGradientStop < Test::Unit::TestCase @item.color = color assert_equal(@item.color.rgb, "FF0000FF") end - end diff --git a/test/stylesheet/tc_num_fmt.rb b/test/stylesheet/tc_num_fmt.rb index 5309f189..7c34be28 100644 --- a/test/stylesheet/tc_num_fmt.rb +++ b/test/stylesheet/tc_num_fmt.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestNumFmt < Test::Unit::TestCase - def setup @item = Axlsx::NumFmt.new end @@ -25,5 +24,4 @@ class TestNumFmt < Test::Unit::TestCase assert_nothing_raised { @item.formatCode = "0" } assert_equal(@item.formatCode, "0") end - end diff --git a/test/stylesheet/tc_pattern_fill.rb b/test/stylesheet/tc_pattern_fill.rb index ed567c7e..e22f4de6 100644 --- a/test/stylesheet/tc_pattern_fill.rb +++ b/test/stylesheet/tc_pattern_fill.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestPatternFill < Test::Unit::TestCase - def setup @item = Axlsx::PatternFill.new end diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index 37dc4fb4..627acbe3 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -305,6 +305,5 @@ class TestStyles < Test::Unit::TestCase border_pr = current_border.prs.detect{|x| x.name == edge } assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}") end - end end diff --git a/test/stylesheet/tc_table_style.rb b/test/stylesheet/tc_table_style.rb index f58a7a0d..f86cc54c 100644 --- a/test/stylesheet/tc_table_style.rb +++ b/test/stylesheet/tc_table_style.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestTableStyle < Test::Unit::TestCase - def setup @item = Axlsx::TableStyle.new "fisher" end diff --git a/test/stylesheet/tc_table_style_element.rb b/test/stylesheet/tc_table_style_element.rb index 554636eb..4af3aeb5 100644 --- a/test/stylesheet/tc_table_style_element.rb +++ b/test/stylesheet/tc_table_style_element.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestTableStyleElement < Test::Unit::TestCase - def setup @item = Axlsx::TableStyleElement.new end diff --git a/test/stylesheet/tc_table_styles.rb b/test/stylesheet/tc_table_styles.rb index cc8da9d5..751874b1 100644 --- a/test/stylesheet/tc_table_styles.rb +++ b/test/stylesheet/tc_table_styles.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestTableStyles < Test::Unit::TestCase - def setup @item = Axlsx::TableStyles.new end @@ -25,5 +24,4 @@ class TestTableStyles < Test::Unit::TestCase assert_nothing_raised { @item.defaultPivotStyle = "anyones guess" } assert_equal(@item.defaultPivotStyle, "anyones guess") end - end diff --git a/test/stylesheet/tc_xf.rb b/test/stylesheet/tc_xf.rb index fdaef970..00e2a8a3 100644 --- a/test/stylesheet/tc_xf.rb +++ b/test/stylesheet/tc_xf.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestXf < Test::Unit::TestCase - def setup @item = Axlsx::Xf.new end @@ -116,5 +115,4 @@ class TestXf < Test::Unit::TestCase assert_nothing_raised { @item.applyProtection = false } assert_equal(@item.applyProtection, false) end - end diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index af9d505c..fc23cc5f 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestAxlsx < Test::Unit::TestCase - def setup_wide @wide_test_points = { "A3" => 0, @@ -140,5 +139,4 @@ class TestAxlsx < Test::Unit::TestCase assert_equal({foo: {baz: true}}, h1.merge(h2)) assert_equal({foo: {bar: true, baz: true}}, Axlsx.hash_deep_merge(h1, h2)) end - end diff --git a/test/tc_package.rb b/test/tc_package.rb index 82c4cb83..b3ca6810 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -90,7 +90,6 @@ class TestPackage < Test::Unit::TestCase ws.add_pivot_table 'G5:G6', 'A1:B3' ws.add_page_break "B2" - end def test_use_autowidth diff --git a/test/workbook/tc_defined_name.rb b/test/workbook/tc_defined_name.rb index aa4f84e1..e7fbe6b5 100644 --- a/test/workbook/tc_defined_name.rb +++ b/test/workbook/tc_defined_name.rb @@ -44,5 +44,4 @@ class TestDefinedNames < Test::Unit::TestCase assert_equal(doc.xpath("//definedName[@hidden='1']").size, 1) assert_equal('Sheet1!A1:A1', doc.xpath('//definedName').text) end - end diff --git a/test/workbook/tc_shared_strings_table.rb b/test/workbook/tc_shared_strings_table.rb index b9347903..7e8fb38e 100644 --- a/test/workbook/tc_shared_strings_table.rb +++ b/test/workbook/tc_shared_strings_table.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestSharedStringsTable < Test::Unit::TestCase - def setup @p = Axlsx::Package.new :use_shared_strings=>true diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb index f8d0b1f7..b678a183 100644 --- a/test/workbook/tc_workbook.rb +++ b/test/workbook/tc_workbook.rb @@ -44,7 +44,6 @@ class TestWorkbook < Test::Unit::TestCase @wb.add_worksheet(:name=>'foo') @wb.add_worksheet(:name=>'bar') assert_equal('foo', @wb.sheet_by_name('foo').name) - end def test_worksheet_empty_name diff --git a/test/workbook/tc_workbook_view.rb b/test/workbook/tc_workbook_view.rb index 2aa6521a..8280d8d5 100644 --- a/test/workbook/tc_workbook_view.rb +++ b/test/workbook/tc_workbook_view.rb @@ -1,7 +1,6 @@ require 'tc_helper' class TestWorkbookView < Test::Unit::TestCase - def setup @options = { visibility: :hidden, minimized: true, show_horizontal_scroll: true, show_vertical_scroll: true, show_sheet_tabs: true, tab_ratio: 750, first_sheet: 0, active_tab: 1, x_window: 500, y_window: 400, diff --git a/test/workbook/worksheet/auto_filter/tc_auto_filter.rb b/test/workbook/worksheet/auto_filter/tc_auto_filter.rb index d7d3b47c..60089d22 100644 --- a/test/workbook/worksheet/auto_filter/tc_auto_filter.rb +++ b/test/workbook/worksheet/auto_filter/tc_auto_filter.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestAutoFilter < Test::Unit::TestCase - def setup ws = Axlsx::Package.new.workbook.add_worksheet 3.times { |index| ws.add_row [1*index,2*index,3*index] } diff --git a/test/workbook/worksheet/auto_filter/tc_filter_column.rb b/test/workbook/worksheet/auto_filter/tc_filter_column.rb index 934931fd..642b7b6e 100644 --- a/test/workbook/worksheet/auto_filter/tc_filter_column.rb +++ b/test/workbook/worksheet/auto_filter/tc_filter_column.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestFilterColumn < Test::Unit::TestCase - def setup @filter_column = Axlsx::FilterColumn.new(0, :filters, :filter_items => [200]) end diff --git a/test/workbook/worksheet/tc_border_creator.rb b/test/workbook/worksheet/tc_border_creator.rb index 6a0f8424..eb27fe98 100644 --- a/test/workbook/worksheet/tc_border_creator.rb +++ b/test/workbook/worksheet/tc_border_creator.rb @@ -76,5 +76,4 @@ class TestBorderCreator < Test::Unit::TestCase assert_equal [:thick], @ws.styles.borders[4].prs.map(&:style).uniq assert_equal [:left], @ws.styles.borders[4].prs.map(&:name) end - end diff --git a/test/workbook/worksheet/tc_break.rb b/test/workbook/worksheet/tc_break.rb index 814a4878..884d9e01 100644 --- a/test/workbook/worksheet/tc_break.rb +++ b/test/workbook/worksheet/tc_break.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestBreak < Test::Unit::TestCase - def setup @break = Axlsx::Break.new(:id => 1, :min => 1, :max => 10, :man => true, :pt => false) end diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb index bdbfd59d..af3699ad 100644 --- a/test/workbook/worksheet/tc_cell.rb +++ b/test/workbook/worksheet/tc_cell.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestCell < Test::Unit::TestCase - def setup p = Axlsx::Package.new p.use_shared_strings = true diff --git a/test/workbook/worksheet/tc_cfvo.rb b/test/workbook/worksheet/tc_cfvo.rb index d846f57d..71ba6bbc 100644 --- a/test/workbook/worksheet/tc_cfvo.rb +++ b/test/workbook/worksheet/tc_cfvo.rb @@ -27,5 +27,4 @@ class TestCfvo < Test::Unit::TestCase doc = Nokogiri::XML.parse(@cfvo.to_xml_string) assert doc.xpath(".//cfvo[@type='min'][@val=0][@gte=true]") end - end diff --git a/test/workbook/worksheet/tc_col.rb b/test/workbook/worksheet/tc_col.rb index 00c5f058..2f31d7a2 100644 --- a/test/workbook/worksheet/tc_col.rb +++ b/test/workbook/worksheet/tc_col.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestCol < Test::Unit::TestCase - def setup @col = Axlsx::Col.new 1, 1 end @@ -89,5 +88,4 @@ class TestCol < Test::Unit::TestCase assert_equal(@col.style, 1) #TODO check that the style specified is actually in the styles xfs collection end - end diff --git a/test/workbook/worksheet/tc_color_scale.rb b/test/workbook/worksheet/tc_color_scale.rb index 56afe338..7f9e5def 100644 --- a/test/workbook/worksheet/tc_color_scale.rb +++ b/test/workbook/worksheet/tc_color_scale.rb @@ -55,5 +55,4 @@ class TestColorScale < Test::Unit::TestCase assert_equal(doc.xpath(".//colorScale//cfvo").size, 2) assert_equal(doc.xpath(".//colorScale//color").size, 2) end - end diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index d9652ebf..cc885255 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestConditionalFormatting < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" @@ -17,7 +16,6 @@ class TestConditionalFormatting < Test::Unit::TestCase end def test_add_as_rule - color_scale = Axlsx::ColorScale.new do |cs| cs.colors.first.rgb = "FFDFDFDF" cs.colors.last.rgb = "FF00FF00" @@ -57,11 +55,9 @@ class TestConditionalFormatting < Test::Unit::TestCase doc = Nokogiri::XML.parse(cfs.last.to_xml_string) assert_equal(doc.xpath(".//conditionalFormatting//cfRule//iconSet//cfvo").size, 3) assert_equal(doc.xpath(".//conditionalFormatting//cfRule//iconSet[@iconSet='5Rating']").size, 1) - end def test_add_as_hash - color_scale = Axlsx::ColorScale.new do |cs| cs.colors.first.rgb = "FFDFDFDF" cs.colors.last.rgb = "FF00FF00" @@ -97,7 +93,6 @@ class TestConditionalFormatting < Test::Unit::TestCase doc = Nokogiri::XML.parse(cfs.last.to_xml_string) assert_equal(doc.xpath(".//conditionalFormatting//cfRule//iconSet//cfvo").size, 3) assert_equal(doc.xpath(".//conditionalFormatting//cfRule//iconSet[@iconSet='5Rating']").size, 1) - end def test_single_rule @@ -220,5 +215,4 @@ class TestConditionalFormatting < Test::Unit::TestCase assert_nothing_raised { @cfr.timePeriod = :today } assert_equal(@cfr.timePeriod, :today) end - end diff --git a/test/workbook/worksheet/tc_data_bar.rb b/test/workbook/worksheet/tc_data_bar.rb index fe02976d..65995dd2 100644 --- a/test/workbook/worksheet/tc_data_bar.rb +++ b/test/workbook/worksheet/tc_data_bar.rb @@ -41,5 +41,4 @@ class TestDataBar < Test::Unit::TestCase assert_equal(doc.xpath(".//dataBar//cfvo").size, 2) assert_equal(doc.xpath(".//dataBar//color").size, 1) end - end diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 1d55aca3..0d9a2eb0 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -274,6 +274,5 @@ class TestDataValidation < Test::Unit::TestCase def test_empty_attributes v = Axlsx::DataValidation.new assert_equal(nil, v.send(:get_valid_attributes)) - end end diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index 225c1893..fafd66c6 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -110,7 +110,6 @@ class TestDateTimeConverter < Test::Unit::TestCase end def test_timezone - utc = Time.utc 2012 # January 1st, 2012 at 0:00 UTC local = Time.parse "2012-01-01 09:00:00 +0900" @@ -119,5 +118,4 @@ class TestDateTimeConverter < Test::Unit::TestCase Axlsx::Workbook.date1904 = true assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f/86400, Axlsx::DateTimeConverter::time_to_serial(utc) end - end diff --git a/test/workbook/worksheet/tc_header_footer.rb b/test/workbook/worksheet/tc_header_footer.rb index fb95d7bf..1ecea096 100644 --- a/test/workbook/worksheet/tc_header_footer.rb +++ b/test/workbook/worksheet/tc_header_footer.rb @@ -1,7 +1,6 @@ require 'tc_helper' class TestHeaderFooter < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet :name => 'test' diff --git a/test/workbook/worksheet/tc_icon_set.rb b/test/workbook/worksheet/tc_icon_set.rb index 9096625a..483de228 100644 --- a/test/workbook/worksheet/tc_icon_set.rb +++ b/test/workbook/worksheet/tc_icon_set.rb @@ -41,5 +41,4 @@ class TestIconSet < Test::Unit::TestCase assert_equal(doc.xpath(".//iconSet[@iconSet='3TrafficLights1'][@percent=1][@reverse=0][@showValue=1]").size, 1) assert_equal(doc.xpath(".//iconSet//cfvo").size, 3) end - end diff --git a/test/workbook/worksheet/tc_page_margins.rb b/test/workbook/worksheet/tc_page_margins.rb index 96695846..c1f2a626 100644 --- a/test/workbook/worksheet/tc_page_margins.rb +++ b/test/workbook/worksheet/tc_page_margins.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestPageMargins < Test::Unit::TestCase - def setup p = Axlsx::Package.new ws = p.workbook.add_worksheet :name=>"hmmm" diff --git a/test/workbook/worksheet/tc_page_setup.rb b/test/workbook/worksheet/tc_page_setup.rb index 8c566a61..c7cec18b 100644 --- a/test/workbook/worksheet/tc_page_setup.rb +++ b/test/workbook/worksheet/tc_page_setup.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestPageSetup < Test::Unit::TestCase - def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet :name => "hmmm" @@ -137,6 +136,5 @@ class TestPageSetup < Test::Unit::TestCase fits = @ps.fit_to :height => 7, :width => 2 assert_equal(fits, [2, 7]) assert_raise(ArgumentError) { puts @ps.fit_to(:width => true)} - end end diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb index b3ca647e..e03c5599 100644 --- a/test/workbook/worksheet/tc_pivot_table.rb +++ b/test/workbook/worksheet/tc_pivot_table.rb @@ -181,7 +181,6 @@ class TestPivotTable < Test::Unit::TestCase assert_nil( doc.at_css('colItems i')['x']) assert_equal('1', doc.at_css('colItems i[i=1] x')['v']) assert_equal('2', doc.at_css('colItems i[i=2] x')['v']) - end def test_pivot_table_with_only_one_data_row diff --git a/test/workbook/worksheet/tc_print_options.rb b/test/workbook/worksheet/tc_print_options.rb index 32af9cd0..8dc2b804 100644 --- a/test/workbook/worksheet/tc_print_options.rb +++ b/test/workbook/worksheet/tc_print_options.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestPrintOptions < Test::Unit::TestCase - def setup p = Axlsx::Package.new ws = p.workbook.add_worksheet :name => "hmmm" @@ -68,5 +67,4 @@ class TestPrintOptions < Test::Unit::TestCase assert_nothing_raised { @po.vertical_centered = true } assert_equal(@po.vertical_centered, true) end - end diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb index e919b914..900e751e 100644 --- a/test/workbook/worksheet/tc_row.rb +++ b/test/workbook/worksheet/tc_row.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestRow < Test::Unit::TestCase - def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name=>"hmmm" @@ -57,7 +56,6 @@ class TestRow < Test::Unit::TestCase r = @ws.add_row [1,2,3], :style=>[1] assert_equal(r.cells.first.style, 1, "only apply style to cells with at the same index of of the style array") assert_equal(r.cells.last.style, 0, "only apply style to cells with at the same index of of the style array") - end def test_array_to_cells_with_escape_formulas @@ -155,5 +153,4 @@ class TestRow < Test::Unit::TestCase assert_equal(c.value, index < offset ? nil : values[index - offset]) end end - end diff --git a/test/workbook/worksheet/tc_sheet_calc_pr.rb b/test/workbook/worksheet/tc_sheet_calc_pr.rb index 05b837cf..9473c94b 100644 --- a/test/workbook/worksheet/tc_sheet_calc_pr.rb +++ b/test/workbook/worksheet/tc_sheet_calc_pr.rb @@ -1,7 +1,6 @@ require 'tc_helper' class TestSheetCalcPr < Test::Unit::TestCase - def setup @sheet_calc_pr = Axlsx::SheetCalcPr.new(:full_calc_on_load => false) end diff --git a/test/workbook/worksheet/tc_sheet_format_pr.rb b/test/workbook/worksheet/tc_sheet_format_pr.rb index ec98988b..ef4eb0d8 100644 --- a/test/workbook/worksheet/tc_sheet_format_pr.rb +++ b/test/workbook/worksheet/tc_sheet_format_pr.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestSheetFormatPr < Test::Unit::TestCase - def setup @options = { :base_col_width => 5, @@ -86,5 +85,4 @@ class TestSheetFormatPr < Test::Unit::TestCase assert doc.xpath("sheetFormatPr[@outline_level_row=0]") assert doc.xpath("sheetFormatPr[@outline_level_col=0]") end - end diff --git a/test/workbook/worksheet/tc_sheet_pr.rb b/test/workbook/worksheet/tc_sheet_pr.rb index e39c8bca..f6ffcfdb 100644 --- a/test/workbook/worksheet/tc_sheet_pr.rb +++ b/test/workbook/worksheet/tc_sheet_pr.rb @@ -1,7 +1,6 @@ require 'tc_helper.rb' class TestSheetPr < Test::Unit::TestCase - def setup worksheet = Axlsx::Package.new.workbook.add_worksheet @options = { diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb index 78969d34..26297bc4 100644 --- a/test/workbook/worksheet/tc_sheet_protection.rb +++ b/test/workbook/worksheet/tc_sheet_protection.rb @@ -58,5 +58,4 @@ class TestSheetProtection < Test::Unit::TestCase assert(doc.xpath("//sheetProtection[@#{key.to_s.gsub(/_(.)/){ $1.upcase }}='#{value}']")) end end - end diff --git a/test/workbook/worksheet/tc_sheet_view.rb b/test/workbook/worksheet/tc_sheet_view.rb index 386777b2..a09287aa 100644 --- a/test/workbook/worksheet/tc_sheet_view.rb +++ b/test/workbook/worksheet/tc_sheet_view.rb @@ -208,5 +208,4 @@ class TestSheetView < Test::Unit::TestCase @sv.add_selection(:top_left, :active_cell => "A1") assert_equal('A1', @sv.selections[:top_left].active_cell) end - end diff --git a/test/workbook/worksheet/tc_table.rb b/test/workbook/worksheet/tc_table.rb index fd6c1923..1a90f0bc 100644 --- a/test/workbook/worksheet/tc_table.rb +++ b/test/workbook/worksheet/tc_table.rb @@ -12,7 +12,6 @@ class TestTable < Test::Unit::TestCase def test_initialization assert(@ws.workbook.tables.empty?) assert(@ws.tables.empty?) - end def test_table_style_info diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb index 9ba03ea7..19beaaba 100644 --- a/test/workbook/worksheet/tc_table_style_info.rb +++ b/test/workbook/worksheet/tc_table_style_info.rb @@ -13,7 +13,6 @@ class TestTableStyleInfo < Test::Unit::TestCase :show_row_stripes => 1, :show_column_stripes => 1, :name => "TableStyleDark4" } - end def test_initialize diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 529fab5d..c264ec83 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -130,7 +130,6 @@ class TestWorksheet < Test::Unit::TestCase assert_equal(header_footer[key], optioned.header_footer.send(key)) end assert_equal(optioned.name, 'bob') - end # def test_use_gridlines @@ -892,5 +891,4 @@ class TestWorksheet < Test::Unit::TestCase wb.styles.style_index.values.first ) end - end diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb index f64dc6b1..98b6937b 100644 --- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb +++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb @@ -22,7 +22,6 @@ class TestWorksheetHyperlink < Test::Unit::TestCase end def test_target - assert_equal(@options[:target], Axlsx.instance_values_for(@a)['target']) end -- cgit v1.2.3 From acf00d356494ef504c3de0e4a0db6b25f2bd7636 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 8 Apr 2023 11:45:31 +0200 Subject: Fix offenses related to trailing commas --- .rubocop_todo.yml | 19 ------------------- lib/axlsx/workbook/worksheet/border_creator.rb | 2 +- test/stylesheet/tc_styles.rb | 2 +- test/workbook/worksheet/tc_date_time_converter.rb | 8 ++++---- test/workbook/worksheet/tc_pivot_table.rb | 4 ++-- test/workbook/worksheet/tc_worksheet.rb | 2 +- 6 files changed, 9 insertions(+), 28 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7dc60f46..86b99a38 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1163,25 +1163,6 @@ Style/TernaryParentheses: - 'lib/axlsx/drawing/scatter_series.rb' - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInArrayLiteral: - Exclude: - - 'test/stylesheet/tc_styles.rb' - - 'test/workbook/worksheet/tc_pivot_table.rb' - -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInHashLiteral: - Exclude: - - 'lib/axlsx/workbook/worksheet/border_creator.rb' - - 'test/workbook/worksheet/tc_date_time_converter.rb' - - 'test/workbook/worksheet/tc_worksheet.rb' - # Offense count: 11 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods. diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb index b949a76e..2dcbdf0f 100644 --- a/lib/axlsx/workbook/worksheet/border_creator.rb +++ b/lib/axlsx/workbook/worksheet/border_creator.rb @@ -48,7 +48,7 @@ module Axlsx top: "#{first_cell}:#{last_col}#{first_row}", right: "#{last_col}#{first_row}:#{last_cell}", bottom: "#{first_col}#{last_row}:#{last_cell}", - left: "#{first_cell}:#{first_col}#{last_row}", + left: "#{first_cell}:#{first_col}#{last_row}" } end diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index 627acbe3..8bb6ff32 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -37,7 +37,7 @@ class TestStyles < Test::Unit::TestCase {:edges => [:bottom], :style => :thick, :color => "FF0000"}, {:edges => [:left], :style => :dotted, :color => "FFFF00"}, {:edges => [:right], :style => :dashed, :color => "FFFFFF"}, - {:style => :thick, :color => "CCCCCC"}, + {:style => :thick, :color => "CCCCCC"} ] @styles.add_style(border: borders_array) diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index fafd66c6..393a9d1a 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -27,7 +27,7 @@ class TestDateTimeConverter < Test::Unit::TestCase "1970-01-01" => 25569.0, # Unix epoch "1970-01-02" => 25570.0, "2006-02-01" => 38749.0, - "2038-01-19" => 50424.0, # max date using signed timestamp in 32bit + "2038-01-19" => 50424.0 # max date using signed timestamp in 32bit } end tests.each do |date_string, expected| @@ -51,7 +51,7 @@ class TestDateTimeConverter < Test::Unit::TestCase "1970-01-01" => 24107.0, # Unix epoch "1970-01-02" => 24108.0, "2006-02-01" => 37287.0, - "2038-01-19" => 48962.0, # max date using signed timestamp in 32bit + "2038-01-19" => 48962.0 # max date using signed timestamp in 32bit } end tests.each do |date_string, expected| @@ -75,7 +75,7 @@ class TestDateTimeConverter < Test::Unit::TestCase "1970-01-01T00:00:00Z" => 25569.0, # Unix epoch "1970-01-01T12:00:00Z" => 25569.5, "2000-01-01T00:00:00Z" => 36526.0, - "2038-01-19T03:14:07Z" => 50424.134803, # max signed timestamp in 32bit + "2038-01-19T03:14:07Z" => 50424.134803 # max signed timestamp in 32bit } end tests.each do |time_string, expected| @@ -100,7 +100,7 @@ class TestDateTimeConverter < Test::Unit::TestCase "1970-01-01T00:00:00Z" => 24107.0, # Unix epoch "1970-01-01T12:00:00Z" => 24107.5, "2000-01-01T00:00:00Z" => 35064.0, - "2038-01-19T03:14:07Z" => 48962.134803, # max signed timestamp in 32bit + "2038-01-19T03:14:07Z" => 48962.134803 # max signed timestamp in 32bit } end tests.each do |time_string, expected| diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb index e03c5599..85aa14cd 100644 --- a/test/workbook/worksheet/tc_pivot_table.rb +++ b/test/workbook/worksheet/tc_pivot_table.rb @@ -161,7 +161,7 @@ class TestPivotTable < Test::Unit::TestCase pt.data = [ {ref: "Gross amount", num_fmt: 2}, {ref: "Net amount", num_fmt: 2}, - {ref: "Margin", num_fmt: 2}, + {ref: "Margin", num_fmt: 2} ] end @@ -189,7 +189,7 @@ class TestPivotTable < Test::Unit::TestCase pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt| pt.rows = ["Date", "Name"] pt.data = [ - {ref: "Gross amount", num_fmt: 2}, + {ref: "Gross amount", num_fmt: 2} ] end diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index c264ec83..8475f5aa 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -886,7 +886,7 @@ class TestWorksheet < Test::Unit::TestCase name: "Times New Roman", sz: 12, family: 1, - color: "FFFFFF", + color: "FFFFFF" }, wb.styles.style_index.values.first ) -- cgit v1.2.3 From 55526805cf28cc91a22df5811b26cd23bdefa8d3 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 8 Apr 2023 11:53:12 +0200 Subject: Fix space-related offenses - Layout/SpaceAfterComma - Layout/SpaceAroundEqualsInParameterDefault - Layout/SpaceAroundOperators - Layout/SpaceBeforeBlockBraces - Layout/SpaceInsideBlockBraces - Layout/SpaceInsideHashLiteralBraces - Layout/SpaceInsideParens --- .rubocop_todo.yml | 50 ----------- lib/axlsx.rb | 10 +-- lib/axlsx/content_type/abstract_content_type.rb | 2 +- lib/axlsx/content_type/default.rb | 2 +- lib/axlsx/doc_props/app.rb | 2 +- lib/axlsx/doc_props/core.rb | 2 +- lib/axlsx/drawing/area_chart.rb | 4 +- lib/axlsx/drawing/area_series.rb | 2 +- lib/axlsx/drawing/ax_data_source.rb | 2 +- lib/axlsx/drawing/axes.rb | 2 +- lib/axlsx/drawing/axis.rb | 6 +- lib/axlsx/drawing/bar_3D_chart.rb | 8 +- lib/axlsx/drawing/bar_chart.rb | 6 +- lib/axlsx/drawing/bar_series.rb | 4 +- lib/axlsx/drawing/bubble_chart.rb | 2 +- lib/axlsx/drawing/bubble_series.rb | 6 +- lib/axlsx/drawing/cat_axis.rb | 2 +- lib/axlsx/drawing/chart.rb | 12 +-- lib/axlsx/drawing/d_lbls.rb | 4 +- lib/axlsx/drawing/drawing.rb | 8 +- lib/axlsx/drawing/hyperlink.rb | 4 +- lib/axlsx/drawing/line_3D_chart.rb | 6 +- lib/axlsx/drawing/line_chart.rb | 4 +- lib/axlsx/drawing/line_series.rb | 2 +- lib/axlsx/drawing/marker.rb | 6 +- lib/axlsx/drawing/num_data.rb | 6 +- lib/axlsx/drawing/num_data_source.rb | 4 +- lib/axlsx/drawing/num_val.rb | 2 +- lib/axlsx/drawing/one_cell_anchor.rb | 6 +- lib/axlsx/drawing/pic.rb | 10 +-- lib/axlsx/drawing/picture_locking.rb | 2 +- lib/axlsx/drawing/pie_3D_chart.rb | 4 +- lib/axlsx/drawing/pie_series.rb | 2 +- lib/axlsx/drawing/scaling.rb | 4 +- lib/axlsx/drawing/scatter_chart.rb | 2 +- lib/axlsx/drawing/scatter_series.rb | 4 +- lib/axlsx/drawing/ser_axis.rb | 2 +- lib/axlsx/drawing/series.rb | 2 +- lib/axlsx/drawing/str_data.rb | 4 +- lib/axlsx/drawing/str_val.rb | 2 +- lib/axlsx/drawing/title.rb | 2 +- lib/axlsx/drawing/two_cell_anchor.rb | 10 +-- lib/axlsx/drawing/val_axis.rb | 2 +- lib/axlsx/drawing/view_3D.rb | 4 +- lib/axlsx/drawing/vml_drawing.rb | 2 +- lib/axlsx/drawing/vml_shape.rb | 6 +- lib/axlsx/package.rb | 42 ++++----- lib/axlsx/rels/relationship.rb | 10 +-- lib/axlsx/rels/relationships.rb | 4 +- lib/axlsx/stylesheet/border.rb | 2 +- lib/axlsx/stylesheet/border_pr.rb | 2 +- lib/axlsx/stylesheet/cell_alignment.rb | 2 +- lib/axlsx/stylesheet/cell_protection.rb | 2 +- lib/axlsx/stylesheet/cell_style.rb | 2 +- lib/axlsx/stylesheet/color.rb | 2 +- lib/axlsx/stylesheet/dxf.rb | 2 +- lib/axlsx/stylesheet/font.rb | 6 +- lib/axlsx/stylesheet/gradient_fill.rb | 4 +- lib/axlsx/stylesheet/gradient_stop.rb | 4 +- lib/axlsx/stylesheet/num_fmt.rb | 2 +- lib/axlsx/stylesheet/pattern_fill.rb | 6 +- lib/axlsx/stylesheet/styles.rb | 56 ++++++------ lib/axlsx/stylesheet/table_style.rb | 10 +-- lib/axlsx/stylesheet/table_style_element.rb | 2 +- lib/axlsx/stylesheet/table_styles.rb | 4 +- lib/axlsx/stylesheet/xf.rb | 2 +- lib/axlsx/util/constants.rb | 2 +- lib/axlsx/util/options_parser.rb | 2 +- lib/axlsx/util/serialized_attributes.rb | 2 +- lib/axlsx/util/simple_typed_list.rb | 6 +- lib/axlsx/util/storage.rb | 14 +-- lib/axlsx/util/validators.rb | 2 +- lib/axlsx/workbook/defined_name.rb | 4 +- lib/axlsx/workbook/shared_strings_table.rb | 6 +- lib/axlsx/workbook/workbook.rb | 20 ++--- lib/axlsx/workbook/workbook_view.rb | 2 +- .../workbook/worksheet/auto_filter/auto_filter.rb | 6 +- .../worksheet/auto_filter/filter_column.rb | 6 +- .../workbook/worksheet/auto_filter/filters.rb | 4 +- lib/axlsx/workbook/worksheet/border_creator.rb | 6 +- lib/axlsx/workbook/worksheet/break.rb | 4 +- lib/axlsx/workbook/worksheet/cell.rb | 6 +- lib/axlsx/workbook/worksheet/cell_serializer.rb | 20 ++--- lib/axlsx/workbook/worksheet/cfvo.rb | 2 +- lib/axlsx/workbook/worksheet/cfvos.rb | 2 +- lib/axlsx/workbook/worksheet/col.rb | 2 +- lib/axlsx/workbook/worksheet/col_breaks.rb | 2 +- lib/axlsx/workbook/worksheet/color_scale.rb | 16 ++-- lib/axlsx/workbook/worksheet/comment.rb | 2 +- lib/axlsx/workbook/worksheet/comments.rb | 6 +- .../workbook/worksheet/conditional_formatting.rb | 4 +- .../worksheet/conditional_formatting_rule.rb | 4 +- lib/axlsx/workbook/worksheet/data_bar.rb | 6 +- lib/axlsx/workbook/worksheet/data_validation.rb | 2 +- .../workbook/worksheet/date_time_converter.rb | 2 +- lib/axlsx/workbook/worksheet/icon_set.rb | 2 +- lib/axlsx/workbook/worksheet/page_margins.rb | 2 +- lib/axlsx/workbook/worksheet/page_set_up_pr.rb | 2 +- lib/axlsx/workbook/worksheet/page_setup.rb | 2 +- lib/axlsx/workbook/worksheet/pane.rb | 4 +- lib/axlsx/workbook/worksheet/pivot_table.rb | 16 ++-- .../worksheet/pivot_table_cache_definition.rb | 16 ++-- lib/axlsx/workbook/worksheet/pivot_tables.rb | 2 +- lib/axlsx/workbook/worksheet/protected_range.rb | 4 +- lib/axlsx/workbook/worksheet/rich_text.rb | 8 +- lib/axlsx/workbook/worksheet/rich_text_run.rb | 6 +- lib/axlsx/workbook/worksheet/row.rb | 6 +- lib/axlsx/workbook/worksheet/row_breaks.rb | 2 +- lib/axlsx/workbook/worksheet/selection.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_calc_pr.rb | 4 +- lib/axlsx/workbook/worksheet/sheet_format_pr.rb | 4 +- lib/axlsx/workbook/worksheet/sheet_pr.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_protection.rb | 4 +- lib/axlsx/workbook/worksheet/sheet_view.rb | 2 +- lib/axlsx/workbook/worksheet/table.rb | 12 +-- lib/axlsx/workbook/worksheet/tables.rb | 2 +- lib/axlsx/workbook/worksheet/worksheet.rb | 42 ++++----- lib/axlsx/workbook/worksheet/worksheet_comments.rb | 4 +- .../workbook/worksheet/worksheet_hyperlink.rb | 6 +- .../workbook/worksheet/worksheet_hyperlinks.rb | 2 +- test/benchmark.rb | 2 +- test/content_type/tc_content_type.rb | 4 +- test/content_type/tc_default.rb | 4 +- test/content_type/tc_override.rb | 4 +- test/doc_props/tc_app.rb | 2 +- test/doc_props/tc_core.rb | 2 +- test/drawing/tc_area_series.rb | 4 +- test/drawing/tc_axis.rb | 10 +-- test/drawing/tc_bar_series.rb | 6 +- test/drawing/tc_bubble_series.rb | 6 +- test/drawing/tc_chart.rb | 8 +- test/drawing/tc_d_lbls.rb | 16 ++-- test/drawing/tc_drawing.rb | 18 ++-- test/drawing/tc_hyperlink.rb | 12 +-- test/drawing/tc_line_series.rb | 4 +- test/drawing/tc_marker.rb | 16 ++-- test/drawing/tc_num_data.rb | 4 +- test/drawing/tc_num_val.rb | 4 +- test/drawing/tc_one_cell_anchor.rb | 6 +- test/drawing/tc_pic.rb | 8 +- test/drawing/tc_picture_locking.rb | 18 ++-- test/drawing/tc_pie_3D_chart.rb | 2 +- test/drawing/tc_pie_series.rb | 4 +- test/drawing/tc_scaling.rb | 16 ++-- test/drawing/tc_scatter_series.rb | 22 ++--- test/drawing/tc_series.rb | 4 +- test/drawing/tc_two_cell_anchor.rb | 4 +- test/drawing/tc_view_3D.rb | 24 ++--- test/drawing/tc_vml_drawing.rb | 2 +- test/profile.rb | 2 +- test/rels/tc_relationship.rb | 2 +- test/stylesheet/tc_border.rb | 8 +- test/stylesheet/tc_border_pr.rb | 2 +- test/stylesheet/tc_cell_alignment.rb | 22 ++--- test/stylesheet/tc_cell_protection.rb | 4 +- test/stylesheet/tc_cell_style.rb | 12 +-- test/stylesheet/tc_color.rb | 6 +- test/stylesheet/tc_dxf.rb | 6 +- test/stylesheet/tc_font.rb | 2 +- test/stylesheet/tc_gradient_fill.rb | 2 +- test/stylesheet/tc_gradient_stop.rb | 4 +- test/stylesheet/tc_pattern_fill.rb | 2 +- test/stylesheet/tc_styles.rb | 82 ++++++++--------- test/tc_axlsx.rb | 20 ++--- test/tc_package.rb | 68 +++++++------- test/util/tc_simple_typed_list.rb | 22 ++--- test/util/tc_validators.rb | 6 +- test/workbook/tc_shared_strings_table.rb | 6 +- test/workbook/tc_workbook.rb | 28 +++--- test/workbook/tc_workbook_view.rb | 4 +- .../worksheet/auto_filter/tc_auto_filter.rb | 2 +- test/workbook/worksheet/auto_filter/tc_filters.rb | 2 +- test/workbook/worksheet/tc_border_creator.rb | 6 +- test/workbook/worksheet/tc_break.rb | 2 +- test/workbook/worksheet/tc_cell.rb | 28 +++--- test/workbook/worksheet/tc_col.rb | 4 +- test/workbook/worksheet/tc_color_scale.rb | 14 +-- test/workbook/worksheet/tc_comment.rb | 2 +- test/workbook/worksheet/tc_comments.rb | 4 +- .../worksheet/tc_conditional_formatting.rb | 24 ++--- test/workbook/worksheet/tc_data_bar.rb | 8 +- test/workbook/worksheet/tc_data_validation.rb | 20 ++--- test/workbook/worksheet/tc_date_time_converter.rb | 4 +- test/workbook/worksheet/tc_icon_set.rb | 8 +- test/workbook/worksheet/tc_page_margins.rb | 2 +- test/workbook/worksheet/tc_page_setup.rb | 4 +- test/workbook/worksheet/tc_pivot_table.rb | 54 +++++------ .../worksheet/tc_pivot_table_cache_definition.rb | 2 +- test/workbook/worksheet/tc_protected_range.rb | 4 +- test/workbook/worksheet/tc_rich_text.rb | 6 +- test/workbook/worksheet/tc_rich_text_run.rb | 4 +- test/workbook/worksheet/tc_row.rb | 24 ++--- test/workbook/worksheet/tc_sheet_format_pr.rb | 12 +-- test/workbook/worksheet/tc_sheet_pr.rb | 2 +- test/workbook/worksheet/tc_sheet_protection.rb | 2 +- test/workbook/worksheet/tc_table.rb | 2 +- test/workbook/worksheet/tc_table_style_info.rb | 2 +- test/workbook/worksheet/tc_worksheet.rb | 100 ++++++++++----------- 198 files changed, 785 insertions(+), 835 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 86b99a38..08ae966d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -100,56 +100,6 @@ Layout/IndentationWidth: Layout/LeadingCommentSpace: Enabled: false -# Offense count: 264 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceAfterComma: - Enabled: false - -# Offense count: 184 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space -Layout/SpaceAroundEqualsInParameterDefault: - Enabled: false - -# Offense count: 342 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. -# SupportedStylesForExponentOperator: space, no_space -Layout/SpaceAroundOperators: - Enabled: false - -# Offense count: 55 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceBeforeBlockBraces: - Enabled: false - -# Offense count: 139 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceInsideBlockBraces: - Enabled: false - -# Offense count: 227 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space, compact -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceInsideHashLiteralBraces: - Enabled: false - -# Offense count: 82 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, compact, no_space -Layout/SpaceInsideParens: - Enabled: false - # Offense count: 1 Lint/AmbiguousAssignment: Exclude: diff --git a/lib/axlsx.rb b/lib/axlsx.rb index 931feb2d..df847a18 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -54,7 +54,7 @@ module Axlsx end # determines the cell range for the items provided - def self.cell_range(cells, absolute=true) + def self.cell_range(cells, absolute = true) return "" unless cells.first.is_a? Cell first_cell, last_cell = cells.minmax_by(&:pos) @@ -88,7 +88,7 @@ module Axlsx letters_str = name[/[A-Z]+/] # capitalization?!? - v = letters_str.reverse.chars.reduce({:base=>1, :i=>0}) do |val, c| + v = letters_str.reverse.chars.reduce({ :base => 1, :i => 0 }) do |val, c| val[:i] += ((c.bytes.first - 64) * val[:base]) val[:base] *= 26 @@ -123,7 +123,7 @@ module Axlsx # @example Relative Cell Reference # ws.rows.first.cells.first.r #=> "A1" def self.cell_r(c_index, r_index) - col_ref(c_index) << (r_index+1).to_s + col_ref(c_index) << (r_index + 1).to_s end # Creates an array of individual cell references based on an excel reference range. @@ -143,10 +143,10 @@ module Axlsx # performs the increadible feat of changing snake_case to CamelCase # @param [String] s The snake case string to camelize # @return [String] - def self.camel(s="", all_caps = true) + def self.camel(s = "", all_caps = true) s = s.to_s s = s.capitalize if all_caps - s.gsub(/_(.)/){ $1.upcase } + s.gsub(/_(.)/) { $1.upcase } end # returns the provided string with all invalid control charaters diff --git a/lib/axlsx/content_type/abstract_content_type.rb b/lib/axlsx/content_type/abstract_content_type.rb index 73d8a678..023c9086 100644 --- a/lib/axlsx/content_type/abstract_content_type.rb +++ b/lib/axlsx/content_type/abstract_content_type.rb @@ -5,7 +5,7 @@ module Axlsx # Initializes an abstract content type # @see Default, Override - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb index 691b7e87..d5901456 100644 --- a/lib/axlsx/content_type/default.rb +++ b/lib/axlsx/content_type/default.rb @@ -14,7 +14,7 @@ module Axlsx alias :Extension= :extension= # Serializes this object to xml - def to_xml_string(str ='') + def to_xml_string(str = '') super(NODE_NAME, str) end end diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb index ed46cf56..965b34dc 100644 --- a/lib/axlsx/doc_props/app.rb +++ b/lib/axlsx/doc_props/app.rb @@ -33,7 +33,7 @@ module Axlsx # @option options [String] application # @option options [String] app_version # @option options [Integer] doc_security - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/doc_props/core.rb b/lib/axlsx/doc_props/core.rb index 279b7493..0f3b6333 100644 --- a/lib/axlsx/doc_props/core.rb +++ b/lib/axlsx/doc_props/core.rb @@ -6,7 +6,7 @@ module Axlsx # Creates a new Core object. # @option options [String] creator # @option options [Time] created - def initialize(options={}) + def initialize(options = {}) @creator = options[:creator] || 'axlsx' @created = options[:created] end diff --git a/lib/axlsx/drawing/area_chart.rb b/lib/axlsx/drawing/area_chart.rb index 7e831447..0c5193c6 100644 --- a/lib/axlsx/drawing/area_chart.rb +++ b/lib/axlsx/drawing/area_chart.rb @@ -42,7 +42,7 @@ module Axlsx # @option options [Boolean] show_legend # @option options [Symbol] grouping # @see Chart - def initialize(frame, options={}) + def initialize(frame, options = {}) @vary_colors = false @grouping = :standard super(frame, options) @@ -63,7 +63,7 @@ module Axlsx def node_name path = self.class.to_s if i = path.rindex('::') - path = path[(i+2)..-1] + path = path[(i + 2)..-1] end path[0] = path[0].chr.downcase path diff --git a/lib/axlsx/drawing/area_series.rb b/lib/axlsx/drawing/area_series.rb index fd3dd501..7995c5bc 100644 --- a/lib/axlsx/drawing/area_series.rb +++ b/lib/axlsx/drawing/area_series.rb @@ -33,7 +33,7 @@ module Axlsx # @option options [Array, SimpleTypedList] data # @option options [Array, SimpleTypedList] labels # @param [Chart] chart - def initialize(chart, options={}) + def initialize(chart, options = {}) @show_marker = false @marker_symbol = options[:marker_symbol] ? options[:marker_symbol] : :default @smooth = false diff --git a/lib/axlsx/drawing/ax_data_source.rb b/lib/axlsx/drawing/ax_data_source.rb index 10eb6c5e..b8aafc5e 100644 --- a/lib/axlsx/drawing/ax_data_source.rb +++ b/lib/axlsx/drawing/ax_data_source.rb @@ -5,7 +5,7 @@ module Axlsx # creates a new NumDataSource object # @option options [Array] data An array of Cells or Numeric objects # @option options [Symbol] tag_name see tag_name - def initialize(options={}) + def initialize(options = {}) @tag_name = :cat @data_type = StrData @ref_tag_name = :strRef diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb index 146d566e..0e4403ab 100644 --- a/lib/axlsx/drawing/axes.rb +++ b/lib/axlsx/drawing/axes.rb @@ -6,7 +6,7 @@ module Axlsx # should be an axis name like :val_axis and its value should be the # class of the axis type to construct. The :cat_axis, if there is one, # must come first (we assume a Ruby 1.9+ Hash or an OrderedHash). - def initialize(options={}) + def initialize(options = {}) raise(ArgumentError, "CatAxis must come first") if options.keys.include?(:cat_axis) && options.keys.first != :cat_axis options.each do |name, axis_class| add_axis(name, axis_class) diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index 6f65f147..89915b68 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -9,11 +9,11 @@ module Axlsx # @option options [Symbol] crosses # @option options [Symbol] tick_lbl_pos # @raise [ArgumentError] If axi_id or cross_ax are not unsigned integers - def initialize(options={}) - @id = rand(8 ** 8) + def initialize(options = {}) + @id = rand(8**8) @format_code = "General" @delete = @label_rotation = 0 - @scaling = Scaling.new(:orientation=>:minMax) + @scaling = Scaling.new(:orientation => :minMax) @title = @color = nil self.ax_pos = :b self.tick_lbl_pos = :nextTo diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index 1bb47da7..f8dca9ad 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -70,12 +70,12 @@ module Axlsx # @option options [Integer] perspective # @see Chart # @see View3D - def initialize(frame, options={}) + def initialize(frame, options = {}) @vary_colors = true @gap_width, @gap_depth, @shape = nil, nil, nil super(frame, options) @series_type = BarSeries - @view_3D = View3D.new({:r_ang_ax=>1}.merge(options)) + @view_3D = View3D.new({ :r_ang_ax => 1 }.merge(options)) @d_lbls = nil end @@ -97,14 +97,14 @@ module Axlsx # space between bar or column clusters, as a percentage of the bar or column width. def gap_width=(v) RangeValidator.validate "Bar3DChart.gap_width", 0, 500, v - @gap_width=(v) + @gap_width = (v) end alias :gapWidth= :gap_width= # space between bar or column clusters, as a percentage of the bar or column width. def gap_depth=(v) RangeValidator.validate "Bar3DChart.gap_depth", 0, 500, v - @gap_depth=(v) + @gap_depth = (v) end alias :gapDepth= :gap_depth= diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb index 84b9faa1..51046533 100644 --- a/lib/axlsx/drawing/bar_chart.rb +++ b/lib/axlsx/drawing/bar_chart.rb @@ -63,7 +63,7 @@ module Axlsx # @option options [String] gap_width # @option options [Symbol] shape # @see Chart - def initialize(frame, options={}) + def initialize(frame, options = {}) @vary_colors = true @gap_width, @overlap, @shape = nil, nil, nil super(frame, options) @@ -89,13 +89,13 @@ module Axlsx # space between bar or column clusters, as a percentage of the bar or column width. def gap_width=(v) RangeValidator.validate "BarChart.gap_width", 0, 500, v - @gap_width=(v) + @gap_width = (v) end alias :gapWidth= :gap_width= def overlap=(v) RangeValidator.validate "BarChart.overlap", -100, 100, v - @overlap=(v) + @overlap = (v) end # The shape of the bars or columns diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb index fcf7d98f..0b4d9614 100644 --- a/lib/axlsx/drawing/bar_series.rb +++ b/lib/axlsx/drawing/bar_series.rb @@ -32,11 +32,11 @@ module Axlsx # @option options [String] colors an array of colors to use when rendering each data point # @option options [String] series_color a color to use when rendering series # @param [Chart] chart - def initialize(chart, options={}) + def initialize(chart, options = {}) @shape = :box @colors = [] super(chart, options) - self.labels = AxDataSource.new({:data => options[:labels]}) unless options[:labels].nil? + self.labels = AxDataSource.new({ :data => options[:labels] }) unless options[:labels].nil? self.data = NumDataSource.new(options) unless options[:data].nil? end diff --git a/lib/axlsx/drawing/bubble_chart.rb b/lib/axlsx/drawing/bubble_chart.rb index 9d0f3ff1..edd1a9b5 100644 --- a/lib/axlsx/drawing/bubble_chart.rb +++ b/lib/axlsx/drawing/bubble_chart.rb @@ -21,7 +21,7 @@ module Axlsx alias :yValAxis :y_val_axis # Creates a new bubble chart - def initialize(frame, options={}) + def initialize(frame, options = {}) @vary_colors = 0 super(frame, options) diff --git a/lib/axlsx/drawing/bubble_series.rb b/lib/axlsx/drawing/bubble_series.rb index 7d6e7bf6..78b44bf1 100644 --- a/lib/axlsx/drawing/bubble_series.rb +++ b/lib/axlsx/drawing/bubble_series.rb @@ -23,12 +23,12 @@ module Axlsx attr_reader :color # Creates a new BubbleSeries - def initialize(chart, options={}) + def initialize(chart, options = {}) @xData, @yData, @bubbleSize = nil super(chart, options) @xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil? - @yData = NumDataSource.new({:tag_name => :yVal, :data => options[:yData]}) unless options[:yData].nil? - @bubbleSize = NumDataSource.new({:tag_name => :bubbleSize, :data => options[:bubbleSize]}) unless options[:bubbleSize].nil? + @yData = NumDataSource.new({ :tag_name => :yVal, :data => options[:yData] }) unless options[:yData].nil? + @bubbleSize = NumDataSource.new({ :tag_name => :bubbleSize, :data => options[:bubbleSize] }) unless options[:bubbleSize].nil? end # @see color diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index 925d6ad6..ded05ee8 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -4,7 +4,7 @@ module Axlsx # Creates a new CatAxis object # @option options [Integer] tick_lbl_skip # @option options [Integer] tick_mark_skip - def initialize(options={}) + def initialize(options = {}) @tick_lbl_skip = 1 @tick_mark_skip = 1 self.auto = 1 diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index 49c72b58..e64163d9 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -13,10 +13,10 @@ module Axlsx # @option options [Array|String|Cell] end_at The X, Y coordinates defining the bottom right corner of the chart. # @option options [Boolean] plot_visible_only (true) Whether only data from visible cells should be plotted. # @option options [Boolean] rounded_corners (true) Whether the chart area shall have rounded corners. - def initialize(frame, options={}) + def initialize(frame, options = {}) @style = 18 @view_3D = nil - @graphic_frame=frame + @graphic_frame = frame @graphic_frame.anchor.drawing.worksheet.workbook.charts << self @series = SimpleTypedList.new Series @show_legend = true @@ -122,7 +122,7 @@ module Axlsx # The part name for this chart # @return [String] def pn - "#{CHART_PN % (index+1)}" + "#{CHART_PN % (index + 1)}" end # The title object for the chart. @@ -178,7 +178,7 @@ module Axlsx # Adds a new series to the chart's series collection. # @return [Series] # @see Series - def add_series(options={}) + def add_series(options = {}) @series_type.new(self, options) @series.last end @@ -272,7 +272,7 @@ module Axlsx # reference or cell to use in setting the start marker position. # @param [Integer] y The row # @return [Marker] - def start_at(x=0, y=0) + def start_at(x = 0, y = 0) @graphic_frame.anchor.start_at(x, y) end @@ -283,7 +283,7 @@ module Axlsx # @param [Integer] y The row - default 10 # @return [Marker] # @see start_at - def end_at(x=10, y=10) + def end_at(x = 10, y = 10) @graphic_frame.anchor.end_at(x, y) end diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index fe204ddc..d997d9a9 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -8,7 +8,7 @@ module Axlsx include Axlsx::Accessors include Axlsx::OptionsParser # creates a new DLbls object - def initialize(chart_type, options={}) + def initialize(chart_type, options = {}) raise ArgumentError, 'chart_type must inherit from Chart' unless [Chart, LineChart].include?(chart_type.superclass) @chart_type = chart_type initialize_defaults @@ -72,7 +72,7 @@ module Axlsx instance_vals = Axlsx.instance_values_for(self) %w(d_lbl_pos show_legend_key show_val show_cat_name show_ser_name show_percent show_bubble_size show_leader_lines).each do |key| next unless instance_vals.keys.include?(key) && instance_vals[key] != nil - str << "" + str << "" end str << '' end diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index 0de5dc15..bc6dd1cf 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -79,7 +79,7 @@ module Axlsx # @note The recommended way to manage images is to use Worksheet.add_image. Please refer to that method for documentation. # @see Worksheet#add_image # @return [Pic] - def add_image(options={}) + def add_image(options = {}) if options[:end_at] TwoCellAnchor.new(self, options).add_pic(options) else @@ -91,7 +91,7 @@ module Axlsx # Adds a chart to the drawing. # @note The recommended way to manage charts is to use Worksheet.add_chart. Please refer to that method for documentation. # @see Worksheet#add_chart - def add_chart(chart_type, options={}) + def add_chart(chart_type, options = {}) TwoCellAnchor.new(self, options) @anchors.last.add_chart(chart_type, options) end @@ -126,14 +126,14 @@ module Axlsx # The part name for this drawing # @return [String] def pn - "#{DRAWING_PN % (index+1)}" + "#{DRAWING_PN % (index + 1)}" end # The relational part name for this drawing # #NOTE This should be rewritten to return an Axlsx::Relationship object. # @return [String] def rels_pn - "#{DRAWING_RELS_PN % (index+1)}" + "#{DRAWING_RELS_PN % (index + 1)}" end # A list of objects this drawing holds. diff --git a/lib/axlsx/drawing/hyperlink.rb b/lib/axlsx/drawing/hyperlink.rb index 9ff9ee4a..979fdd6a 100644 --- a/lib/axlsx/drawing/hyperlink.rb +++ b/lib/axlsx/drawing/hyperlink.rb @@ -17,7 +17,7 @@ module Axlsx # @option options [Boolean] endSnd terminate any sound events when processing this link # @option options [Boolean] history include this link in the list of visited links for the applications history. # @option options [Boolean] highlightClick indicate that the link has already been visited. - def initialize(parent, options={}) + def initialize(parent, options = {}) DataTypeValidator.validate "Hyperlink.parent", [Pic], parent @parent = parent parse_options options @@ -91,7 +91,7 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = '') - serialized_tag 'a:hlinkClick', str, {:'r:id' => relationship.Id, :'xmlns:r' => XML_NS_R } + serialized_tag 'a:hlinkClick', str, { :'r:id' => relationship.Id, :'xmlns:r' => XML_NS_R } end end end diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index da62851f..d45a417f 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -38,9 +38,9 @@ module Axlsx # @see Chart # @see lineChart # @see View3D - def initialize(frame, options={}) + def initialize(frame, options = {}) @gap_depth = nil - @view_3D = View3D.new({:r_ang_ax=>1}.merge(options)) + @view_3D = View3D.new({ :r_ang_ax => 1 }.merge(options)) super(frame, options) axes.add_axis :ser_axis, SerAxis end @@ -48,7 +48,7 @@ module Axlsx # @see gapDepth def gap_depth=(v) RegexValidator.validate "Line3DChart.gapWidth", GAP_AMOUNT_PERCENT, v - @gap_depth=(v) + @gap_depth = (v) end alias :gapDepth= :gap_depth= diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb index a1734dea..1ff2bde5 100644 --- a/lib/axlsx/drawing/line_chart.rb +++ b/lib/axlsx/drawing/line_chart.rb @@ -42,7 +42,7 @@ module Axlsx # @option options [Boolean] show_legend # @option options [Symbol] grouping # @see Chart - def initialize(frame, options={}) + def initialize(frame, options = {}) @vary_colors = false @grouping = :standard super(frame, options) @@ -63,7 +63,7 @@ module Axlsx def node_name path = self.class.to_s if i = path.rindex('::') - path = path[(i+2)..-1] + path = path[(i + 2)..-1] end path[0] = path[0].chr.downcase path diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb index 2ef18484..18719277 100644 --- a/lib/axlsx/drawing/line_series.rb +++ b/lib/axlsx/drawing/line_series.rb @@ -33,7 +33,7 @@ module Axlsx # @option options [Array, SimpleTypedList] data # @option options [Array, SimpleTypedList] labels # @param [Chart] chart - def initialize(chart, options={}) + def initialize(chart, options = {}) @show_marker = false @marker_symbol = options[:marker_symbol] ? options[:marker_symbol] : :default @smooth = false diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index 53a52dd1..a4933c33 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -10,7 +10,7 @@ module Axlsx # @option options [Integer] colOff # @option options [Integer] row # @option options [Integer] rowOff - def initialize(options={}) + def initialize(options = {}) @col, @colOff, @row, @rowOff = 0, 0, 0, 0 parse_options options end @@ -45,7 +45,7 @@ module Axlsx # or an Array. # @param row the row of the marker. This is ignored if the col parameter is a Cell or # String or Array. - def coord(col, row=0) + def coord(col, row = 0) coordinates = parse_coord_args(col, row) self.col = coordinates[0] self.row = coordinates[1] @@ -64,7 +64,7 @@ module Axlsx # handles multiple inputs for setting the position of a marker # @see Chart#start_at - def parse_coord_args(x, y=0) + def parse_coord_args(x, y = 0) if x.is_a?(String) x, y = *Axlsx::name_to_indices(x) end diff --git a/lib/axlsx/drawing/num_data.rb b/lib/axlsx/drawing/num_data.rb index 9374dac3..140cfb9f 100644 --- a/lib/axlsx/drawing/num_data.rb +++ b/lib/axlsx/drawing/num_data.rb @@ -7,7 +7,7 @@ module Axlsx # @option options [String] formatCode # @option options [Array] :data # @see StrData - def initialize(options={}) + def initialize(options = {}) @format_code = "General" @pt = SimpleTypedList.new NumVal parse_options options @@ -19,7 +19,7 @@ module Axlsx # Creates the val objects for this data set. I am not overly confident this is going to play nicely with time and data types. # @param [Array] values An array of cells or values. - def data=(values=[]) + def data=(values = []) @tag_name = values.first.is_a?(Cell) ? :numCache : :numLit values.each do |value| value = value.is_formula? ? 0 : value.value if value.is_a?(Cell) @@ -28,7 +28,7 @@ module Axlsx end # @see format_code - def format_code=(v='General') + def format_code=(v = 'General') Axlsx::validate_string(v) @format_code = v end diff --git a/lib/axlsx/drawing/num_data_source.rb b/lib/axlsx/drawing/num_data_source.rb index bf5ad9ad..46f6ba71 100644 --- a/lib/axlsx/drawing/num_data_source.rb +++ b/lib/axlsx/drawing/num_data_source.rb @@ -6,7 +6,7 @@ module Axlsx # creates a new NumDataSource object # @option options [Array] data An array of Cells or Numeric objects # @option options [Symbol] tag_name see tag_name - def initialize(options={}) + def initialize(options = {}) # override these three in child classes @data_type ||= NumData @tag_name ||= :val @@ -42,7 +42,7 @@ module Axlsx # serialize the object # @param [String] str - def to_xml_string(str="") + def to_xml_string(str = "") str << ('') if @f str << ('') diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb index 113fe865..c03a0fa1 100644 --- a/lib/axlsx/drawing/num_val.rb +++ b/lib/axlsx/drawing/num_val.rb @@ -9,7 +9,7 @@ module Axlsx # creates a new NumVal object # @option options [String] formatCode # @option options [Integer] v - def initialize(options={}) + def initialize(options = {}) @format_code = "General" super(options) end diff --git a/lib/axlsx/drawing/one_cell_anchor.rb b/lib/axlsx/drawing/one_cell_anchor.rb index c17f4a25..52cf2244 100644 --- a/lib/axlsx/drawing/one_cell_anchor.rb +++ b/lib/axlsx/drawing/one_cell_anchor.rb @@ -14,7 +14,7 @@ module Axlsx # @option options [String] image_src the file location of the image you will render # @option options [String] name the name attribute for the rendered image # @option options [String] descr the description of the image rendered - def initialize(drawing, options={}) + def initialize(drawing, options = {}) @drawing = drawing @width = 0 @height = 0 @@ -52,7 +52,7 @@ module Axlsx # We just 'figure it out' for you. # @param [Array, String, Cell, Integer] x Accepts many inputs for defining the starting position of the cell. # @param [Integer] y When x is an integer, this value is used for the row index at which the anchor starts. - def start_at(x, y=0) + def start_at(x, y = 0) from.coord x, y end @@ -91,7 +91,7 @@ module Axlsx def ext cy = @height * 914400 / 96 cx = @width * 914400 / 96 - {:cy=>cy, :cx=>cx} + { :cy => cy, :cx => cx } end end end diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 869dde4a..7d9cb532 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -14,7 +14,7 @@ module Axlsx # @option options [Integer] :width # @option options [Integer] :height # @option options [Float] :opacity - set the picture opacity, accepts a value between 0.0 and 1.0 - def initialize(anchor, options={}) + def initialize(anchor, options = {}) @anchor = anchor @hyperlink = nil @anchor.drawing.worksheet.workbook.images << self @@ -57,7 +57,7 @@ module Axlsx # sets or updates a hyperlink for this image. # @param [String] v The href value for the hyper link # @option options @see Hyperlink#initialize All options available to the Hyperlink class apply - however href will be overridden with the v parameter value. - def hyperlink=(v, options={}) + def hyperlink=(v, options = {}) options[:href] = v if hyperlink.is_a?(Hyperlink) options.each do |o| @@ -103,7 +103,7 @@ module Axlsx # The part name for this image used in serialization and relationship building # @return [String] def pn - "#{IMAGE_PN % [(index+1), extname]}" + "#{IMAGE_PN % [(index + 1), extname]}" end # The relationship object for this pic. @@ -145,7 +145,7 @@ module Axlsx # @param [Integer] x The column # @param [Integer] y The row # @return [Marker] - def start_at(x, y=nil) + def start_at(x, y = nil) @anchor.start_at x, y @anchor.from end @@ -154,7 +154,7 @@ module Axlsx # @param [Integer] x The column # @param [Integer] y The row # @return [Marker] - def end_at(x, y=nil) + def end_at(x, y = nil) use_two_cell_anchor unless @anchor.is_a?(TwoCellAnchor) @anchor.end_at x, y @anchor.to diff --git a/lib/axlsx/drawing/picture_locking.rb b/lib/axlsx/drawing/picture_locking.rb index e230ec89..2e68a957 100644 --- a/lib/axlsx/drawing/picture_locking.rb +++ b/lib/axlsx/drawing/picture_locking.rb @@ -24,7 +24,7 @@ module Axlsx # @option options [Boolean] noAdjustHandles # @option options [Boolean] noChangeArrowheads # @option options [Boolean] noChangeShapeType - def initialize(options={}) + def initialize(options = {}) @noChangeAspect = true parse_options options end diff --git a/lib/axlsx/drawing/pie_3D_chart.rb b/lib/axlsx/drawing/pie_3D_chart.rb index 5c2b57ac..1772c537 100644 --- a/lib/axlsx/drawing/pie_3D_chart.rb +++ b/lib/axlsx/drawing/pie_3D_chart.rb @@ -18,11 +18,11 @@ module Axlsx # @option options [Integer] perspective # @see Chart # @see View3D - def initialize(frame, options={}) + def initialize(frame, options = {}) @vary_colors = true super(frame, options) @series_type = PieSeries - @view_3D = View3D.new({:rot_x =>30, :perspective=>30}.merge(options)) + @view_3D = View3D.new({ :rot_x => 30, :perspective => 30 }.merge(options)) @d_lbls = nil end diff --git a/lib/axlsx/drawing/pie_series.rb b/lib/axlsx/drawing/pie_series.rb index 4c1b37fb..29b71e36 100644 --- a/lib/axlsx/drawing/pie_series.rb +++ b/lib/axlsx/drawing/pie_series.rb @@ -25,7 +25,7 @@ module Axlsx # @option options [String] title # @option options [Integer] explosion # @param [Chart] chart - def initialize(chart, options={}) + def initialize(chart, options = {}) @explosion = nil @colors = [] super(chart, options) diff --git a/lib/axlsx/drawing/scaling.rb b/lib/axlsx/drawing/scaling.rb index 82811c11..8d2d8ed7 100644 --- a/lib/axlsx/drawing/scaling.rb +++ b/lib/axlsx/drawing/scaling.rb @@ -8,7 +8,7 @@ module Axlsx # @option options [Symbol] orientation # @option options [Float] max # @option options [Float] min - def initialize(options={}) + def initialize(options = {}) @orientation = :minMax @logBase, @min, @max = nil, nil, nil parse_options options @@ -33,7 +33,7 @@ module Axlsx attr_reader :min # @see logBase - def logBase=(v) DataTypeValidator.validate "Scaling.logBase", [Integer], v, lambda { |arg| arg >= 2 && arg <= 1000}; @logBase = v; end + def logBase=(v) DataTypeValidator.validate "Scaling.logBase", [Integer], v, lambda { |arg| arg >= 2 && arg <= 1000 }; @logBase = v; end # @see orientation def orientation=(v) RestrictionValidator.validate "Scaling.orientation", [:minMax, :maxMin], v; @orientation = v; end # @see max diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb index fd6fa3d7..e43647a0 100644 --- a/lib/axlsx/drawing/scatter_chart.rb +++ b/lib/axlsx/drawing/scatter_chart.rb @@ -27,7 +27,7 @@ module Axlsx alias :yValAxis :y_val_axis # Creates a new scatter chart - def initialize(frame, options={}) + def initialize(frame, options = {}) @vary_colors = 0 @scatter_style = :lineMarker diff --git a/lib/axlsx/drawing/scatter_series.rb b/lib/axlsx/drawing/scatter_series.rb index dba1fdf5..e4e1f27a 100644 --- a/lib/axlsx/drawing/scatter_series.rb +++ b/lib/axlsx/drawing/scatter_series.rb @@ -34,7 +34,7 @@ module Axlsx attr_reader :marker_symbol # Creates a new ScatterSeries - def initialize(chart, options={}) + def initialize(chart, options = {}) @xData, @yData = nil if options[:smooth].nil? # If caller hasn't specified smoothing or not, turn smoothing on or off based on scatter style @@ -50,7 +50,7 @@ module Axlsx super(chart, options) @xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil? - @yData = NumDataSource.new({:tag_name => :yVal, :data => options[:yData]}) unless options[:yData].nil? + @yData = NumDataSource.new({ :tag_name => :yVal, :data => options[:yData] }) unless options[:yData].nil? end # @see color diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb index f1da6037..b5844454 100644 --- a/lib/axlsx/drawing/ser_axis.rb +++ b/lib/axlsx/drawing/ser_axis.rb @@ -14,7 +14,7 @@ module Axlsx # Creates a new SerAxis object # @option options [Integer] tick_lbl_skip # @option options [Integer] tick_mark_skip - def initialize(options={}) + def initialize(options = {}) @tick_lbl_skip, @tick_mark_skip = 1, 1 super(options) end diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb index e2445bc9..e5c66b59 100644 --- a/lib/axlsx/drawing/series.rb +++ b/lib/axlsx/drawing/series.rb @@ -18,7 +18,7 @@ module Axlsx # @param [Chart] chart # @option options [Integer] order # @option options [String] title - def initialize(chart, options={}) + def initialize(chart, options = {}) @order = nil self.chart = chart @chart.series << self diff --git a/lib/axlsx/drawing/str_data.rb b/lib/axlsx/drawing/str_data.rb index e4f94e89..843c90a7 100644 --- a/lib/axlsx/drawing/str_data.rb +++ b/lib/axlsx/drawing/str_data.rb @@ -7,7 +7,7 @@ module Axlsx # creates a new StrVal object # @option options [Array] :data # @option options [String] :tag_name - def initialize(options={}) + def initialize(options = {}) @tag_prefix = :str @type = StrVal @pt = SimpleTypedList.new(@type) @@ -16,7 +16,7 @@ module Axlsx # Creates the val objects for this data set. I am not overly confident this is going to play nicely with time and data types. # @param [Array] values An array of cells or values. - def data=(values=[]) + def data=(values = []) @tag_name = values.first.is_a?(Cell) ? :strCache : :strLit values.each do |value| v = value.is_a?(Cell) ? value.value : value diff --git a/lib/axlsx/drawing/str_val.rb b/lib/axlsx/drawing/str_val.rb index 26f12e26..4a85d256 100644 --- a/lib/axlsx/drawing/str_val.rb +++ b/lib/axlsx/drawing/str_val.rb @@ -5,7 +5,7 @@ module Axlsx # creates a new StrVal object # @option options [String] v - def initialize(options={}) + def initialize(options = {}) @v = "" @idx = 0 parse_options options diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index 0c613e13..1a43ba80 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -15,7 +15,7 @@ module Axlsx # Creates a new Title object # @param [String, Cell] title The cell or string to be used for the chart's title - def initialize(title="", title_size="") + def initialize(title = "", title_size = "") self.cell = title if title.is_a?(Cell) self.text = title.to_s unless title.is_a?(Cell) if title_size.to_s.empty? diff --git a/lib/axlsx/drawing/two_cell_anchor.rb b/lib/axlsx/drawing/two_cell_anchor.rb index aa38c3db..7b77de13 100644 --- a/lib/axlsx/drawing/two_cell_anchor.rb +++ b/lib/axlsx/drawing/two_cell_anchor.rb @@ -30,10 +30,10 @@ module Axlsx # @param [Drawing] drawing # @option options [Array] :start_at the col, row to start at THIS IS DOCUMENTED BUT NOT IMPLEMENTED HERE! # @option options [Array] :end_at the col, row to end at - def initialize(drawing, options={}) + def initialize(drawing, options = {}) @drawing = drawing drawing.anchors << self - @from, @to = Marker.new, Marker.new(:col => 5, :row=>10) + @from, @to = Marker.new, Marker.new(:col => 5, :row => 10) parse_options options # bit of a hack to work around the fact that the coords for start at and end at @@ -46,7 +46,7 @@ module Axlsx # @note The recommended way to set the start position for graphical # objects is directly thru the object. # @see Chart#start_at - def start_at(x, y=nil) + def start_at(x, y = nil) from.coord x, y end @@ -54,7 +54,7 @@ module Axlsx # @note the recommended way to set the to position for graphical # objects is directly thru the object # @see Char#end_at - def end_at(x, y=nil) + def end_at(x, y = nil) to.coord x, y end @@ -66,7 +66,7 @@ module Axlsx end # Creates an image associated with this anchor. - def add_pic(options={}) + def add_pic(options = {}) @object = Pic.new(self, options) end diff --git a/lib/axlsx/drawing/val_axis.rb b/lib/axlsx/drawing/val_axis.rb index ead09ff8..8cd131cc 100644 --- a/lib/axlsx/drawing/val_axis.rb +++ b/lib/axlsx/drawing/val_axis.rb @@ -9,7 +9,7 @@ module Axlsx # Creates a new ValAxis object # @option options [Symbol] crosses_between - def initialize(options={}) + def initialize(options = {}) self.cross_between = :between super(options) end diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 250f53f2..1adf9e28 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -10,7 +10,7 @@ module Axlsx # @option options [String] depth_percent # @option options [Boolean] r_ang_ax # @option options [Integer] perspective - def initialize(options={}) + def initialize(options = {}) @rot_x, @h_percent, @rot_y, @depth_percent, @r_ang_ax, @perspective = nil, nil, nil, nil, nil, nil parse_options options end @@ -105,7 +105,7 @@ module Axlsx private # Note: move this to Axlsx module if we find the smae pattern elsewhere. - def element_for_attribute(name, namespace='') + def element_for_attribute(name, namespace = '') val = Axlsx.instance_values_for(self)[name] return "" if val == nil "<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val] diff --git a/lib/axlsx/drawing/vml_drawing.rb b/lib/axlsx/drawing/vml_drawing.rb index ccf3e421..e314b736 100644 --- a/lib/axlsx/drawing/vml_drawing.rb +++ b/lib/axlsx/drawing/vml_drawing.rb @@ -23,7 +23,7 @@ module Axlsx xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"> - + diff --git a/lib/axlsx/drawing/vml_shape.rb b/lib/axlsx/drawing/vml_shape.rb index 951cd58d..2ba388b3 100644 --- a/lib/axlsx/drawing/vml_shape.rb +++ b/lib/axlsx/drawing/vml_shape.rb @@ -15,14 +15,14 @@ module Axlsx # @option options [Integer] right_offset # @option options [Integer] bottom_row # @option options [Integer] bottom_offset - def initialize(options={}) + def initialize(options = {}) @row = @column = @left_column = @top_row = @right_column = @bottom_row = 0 @left_offset = 15 @top_offset = 2 @right_offset = 50 @bottom_offset = 5 @visible = true - @id = (0...8).map{65.+(rand(25)).chr}.join + @id = (0...8).map { 65.+(rand(25)).chr }.join parse_options options yield self if block_given? end @@ -35,7 +35,7 @@ module Axlsx # serialize the shape to a string # @param [String] str # @return [String] - def to_xml_string(str ='') + def to_xml_string(str = '') str << < 'you!', :workbook => Workbook.new - def initialize(options={}) + def initialize(options = {}) @workbook = nil @core, @app = Core.new, App.new @core.creator = options[:author] || @core.creator @@ -122,7 +122,7 @@ module Axlsx # Serialize your workbook to a StringIO instance # @param [Boolean] confirm_valid Validate the package prior to serialization. # @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not. - def to_stream(confirm_valid=false) + def to_stream(confirm_valid = false) if !workbook.styles_applied workbook.apply_styles end @@ -211,26 +211,26 @@ module Axlsx # @private def parts parts = [ - {:entry => "xl/#{STYLES_PN}", :doc => workbook.styles, :schema => SML_XSD}, - {:entry => CORE_PN, :doc => @core, :schema => CORE_XSD}, - {:entry => APP_PN, :doc => @app, :schema => APP_XSD}, - {:entry => WORKBOOK_RELS_PN, :doc => workbook.relationships, :schema => RELS_XSD}, - {:entry => WORKBOOK_PN, :doc => workbook, :schema => SML_XSD} + { :entry => "xl/#{STYLES_PN}", :doc => workbook.styles, :schema => SML_XSD }, + { :entry => CORE_PN, :doc => @core, :schema => CORE_XSD }, + { :entry => APP_PN, :doc => @app, :schema => APP_XSD }, + { :entry => WORKBOOK_RELS_PN, :doc => workbook.relationships, :schema => RELS_XSD }, + { :entry => WORKBOOK_PN, :doc => workbook, :schema => SML_XSD } ] workbook.drawings.each do |drawing| - parts << {:entry => "xl/#{drawing.rels_pn}", :doc => drawing.relationships, :schema => RELS_XSD} - parts << {:entry => "xl/#{drawing.pn}", :doc => drawing, :schema => DRAWING_XSD} + parts << { :entry => "xl/#{drawing.rels_pn}", :doc => drawing.relationships, :schema => RELS_XSD } + parts << { :entry => "xl/#{drawing.pn}", :doc => drawing, :schema => DRAWING_XSD } end workbook.tables.each do |table| - parts << {:entry => "xl/#{table.pn}", :doc => table, :schema => SML_XSD} + parts << { :entry => "xl/#{table.pn}", :doc => table, :schema => SML_XSD } end workbook.pivot_tables.each do |pivot_table| cache_definition = pivot_table.cache_definition - parts << {:entry => "xl/#{pivot_table.rels_pn}", :doc => pivot_table.relationships, :schema => RELS_XSD} - parts << {:entry => "xl/#{pivot_table.pn}", :doc => pivot_table} #, :schema => SML_XSD} - parts << {:entry => "xl/#{cache_definition.pn}", :doc => cache_definition} #, :schema => SML_XSD} + parts << { :entry => "xl/#{pivot_table.rels_pn}", :doc => pivot_table.relationships, :schema => RELS_XSD } + parts << { :entry => "xl/#{pivot_table.pn}", :doc => pivot_table } #, :schema => SML_XSD} + parts << { :entry => "xl/#{cache_definition.pn}", :doc => cache_definition } #, :schema => SML_XSD} end workbook.comments.each do |comment| @@ -241,26 +241,26 @@ module Axlsx end workbook.charts.each do |chart| - parts << {:entry => "xl/#{chart.pn}", :doc => chart, :schema => DRAWING_XSD} + parts << { :entry => "xl/#{chart.pn}", :doc => chart, :schema => DRAWING_XSD } end workbook.images.each do |image| - parts << {:entry => "xl/#{image.pn}", :path => image.image_src} + parts << { :entry => "xl/#{image.pn}", :path => image.image_src } end if use_shared_strings - parts << {:entry => "xl/#{SHARED_STRINGS_PN}", :doc => workbook.shared_strings, :schema => SML_XSD} + parts << { :entry => "xl/#{SHARED_STRINGS_PN}", :doc => workbook.shared_strings, :schema => SML_XSD } end workbook.worksheets.each do |sheet| - parts << {:entry => "xl/#{sheet.rels_pn}", :doc => sheet.relationships, :schema => RELS_XSD} - parts << {:entry => "xl/#{sheet.pn}", :doc => sheet, :schema => SML_XSD} + parts << { :entry => "xl/#{sheet.rels_pn}", :doc => sheet.relationships, :schema => RELS_XSD } + parts << { :entry => "xl/#{sheet.pn}", :doc => sheet, :schema => SML_XSD } end # Sort parts for correct MIME detection [ - {:entry => CONTENT_TYPES_PN, :doc => content_types, :schema => CONTENT_TYPES_XSD}, - {:entry => RELS_PN, :doc => relationships, :schema => RELS_XSD}, + { :entry => CONTENT_TYPES_PN, :doc => content_types, :schema => CONTENT_TYPES_XSD }, + { :entry => RELS_PN, :doc => relationships, :schema => RELS_XSD }, *(parts.sort_by { |part| part[:entry] }.reverse) ] end @@ -332,7 +332,7 @@ module Axlsx elsif ext == 'png' PNG_CT end - c_types << Axlsx::Default.new(:ContentType => ct, :Extension => ext ) + c_types << Axlsx::Default.new(:ContentType => ct, :Extension => ext) end if use_shared_strings c_types << Axlsx::Override.new(:PartName => "/xl/#{SHARED_STRINGS_PN}", diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index f1759649..aff9fa55 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -81,10 +81,10 @@ module Axlsx # @param [String] type The type of the relationship # @param [String] target The target for the relationship # @option [Symbol] :target_mode only accepts :external. - def initialize(source_obj, type, target, options={}) + def initialize(source_obj, type, target, options = {}) @source_obj = source_obj - self.Target=target - self.Type=type + self.Target = target + self.Type = type self.TargetMode = options[:target_mode] if options[:target_mode] @Id = (self.class.ids_cache[ids_cache_key] ||= self.class.next_free_id) end @@ -101,9 +101,9 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = '') - h = Axlsx.instance_values_for(self).reject{|k, _| k == "source_obj"} + h = Axlsx.instance_values_for(self).reject { |k, _| k == "source_obj" } str << '' end diff --git a/lib/axlsx/rels/relationships.rb b/lib/axlsx/rels/relationships.rb index 8f3b62cc..686059fb 100644 --- a/lib/axlsx/rels/relationships.rb +++ b/lib/axlsx/rels/relationships.rb @@ -13,7 +13,7 @@ require 'axlsx/rels/relationship.rb' # @see Relationship#source_obj # @return [Relationship] def for(source_obj) - find{ |rel| rel.source_obj == source_obj } + find { |rel| rel.source_obj == source_obj } end # serialize relationships @@ -22,7 +22,7 @@ require 'axlsx/rels/relationship.rb' def to_xml_string(str = '') str << '' str << ('') - each{ |rel| rel.to_xml_string(str) } + each { |rel| rel.to_xml_string(str) } str << '' end end diff --git a/lib/axlsx/stylesheet/border.rb b/lib/axlsx/stylesheet/border.rb index b9ff785b..af564b22 100644 --- a/lib/axlsx/stylesheet/border.rb +++ b/lib/axlsx/stylesheet/border.rb @@ -19,7 +19,7 @@ module Axlsx # # @note The recommended way to manage borders is with Style#add_style # @see Style#add_style - def initialize(options={}) + def initialize(options = {}) @prs = SimpleTypedList.new BorderPr parse_options options end diff --git a/lib/axlsx/stylesheet/border_pr.rb b/lib/axlsx/stylesheet/border_pr.rb index 630cf42e..8300f4bc 100644 --- a/lib/axlsx/stylesheet/border_pr.rb +++ b/lib/axlsx/stylesheet/border_pr.rb @@ -43,7 +43,7 @@ module Axlsx # @option options [Symbol] name # @option options [Symbol] style # @see Axlsx::Border - def initialize(options={}) + def initialize(options = {}) parse_options(options) #options.each do |o| # self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb index cf03c171..906c7870 100644 --- a/lib/axlsx/stylesheet/cell_alignment.rb +++ b/lib/axlsx/stylesheet/cell_alignment.rb @@ -17,7 +17,7 @@ module Axlsx # @option options [Boolean] justify_last_line # @option options [Boolean] shrink_to_fit # @option options [Integer] reading_order - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/stylesheet/cell_protection.rb b/lib/axlsx/stylesheet/cell_protection.rb index 6d98ff19..f040f207 100644 --- a/lib/axlsx/stylesheet/cell_protection.rb +++ b/lib/axlsx/stylesheet/cell_protection.rb @@ -19,7 +19,7 @@ module Axlsx # Creates a new CellProtection # @option options [Boolean] hidden value for hidden protection # @option options [Boolean] locked value for locked protection - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/stylesheet/cell_style.rb b/lib/axlsx/stylesheet/cell_style.rb index e2c3a09e..1e35a1a4 100644 --- a/lib/axlsx/stylesheet/cell_style.rb +++ b/lib/axlsx/stylesheet/cell_style.rb @@ -13,7 +13,7 @@ module Axlsx # @option options [Integer] iLevel # @option options [Boolean] hidden # @option options [Boolean] customBuiltIn - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index 709d22c3..28afaf11 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -8,7 +8,7 @@ module Axlsx # @option options [Boolean] auto # @option options [String] rgb # @option options [Float] tint - def initialize(options={}) + def initialize(options = {}) @rgb = "FF000000" parse_options options end diff --git a/lib/axlsx/stylesheet/dxf.rb b/lib/axlsx/stylesheet/dxf.rb index 637e3d54..a3f15581 100644 --- a/lib/axlsx/stylesheet/dxf.rb +++ b/lib/axlsx/stylesheet/dxf.rb @@ -42,7 +42,7 @@ module Axlsx # @option options [Font] font # @option options [CellAlignment] alignment # @option options [CellProtection] protection - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index 9ce5ae4a..0f432d58 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -20,7 +20,7 @@ module Axlsx # @option options [Boolean] extend # @option options [Color] color # @option options [Integer] sz - def initialize(options={}) + def initialize(options = {}) parse_options options end @@ -139,9 +139,9 @@ module Axlsx # @see extend def extend=(v) Axlsx::validate_boolean v; @extend = v end # @see color - def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end + def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color = v end # @see sz - def sz=(v) Axlsx::validate_unsigned_int v; @sz=v end + def sz=(v) Axlsx::validate_unsigned_int v; @sz = v end # Serializes the object # @param [String] str diff --git a/lib/axlsx/stylesheet/gradient_fill.rb b/lib/axlsx/stylesheet/gradient_fill.rb index 8d88f373..dc4e562b 100644 --- a/lib/axlsx/stylesheet/gradient_fill.rb +++ b/lib/axlsx/stylesheet/gradient_fill.rb @@ -12,7 +12,7 @@ module Axlsx # @option options [Float] right # @option options [Float] top # @option options [Float] bottom - def initialize(options={}) + def initialize(options = {}) options[:type] ||= :linear parse_options options @stop = SimpleTypedList.new GradientStop @@ -84,7 +84,7 @@ module Axlsx # validates that the value provided is between 0.0 and 1.0 def validate_format_percentage(name, value) - DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0} + DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0 } end # Serializes the object diff --git a/lib/axlsx/stylesheet/gradient_stop.rb b/lib/axlsx/stylesheet/gradient_stop.rb index 63778b58..2325ee66 100644 --- a/lib/axlsx/stylesheet/gradient_stop.rb +++ b/lib/axlsx/stylesheet/gradient_stop.rb @@ -20,9 +20,9 @@ module Axlsx end # @see color - def color=(v) DataTypeValidator.validate "GradientStop.color", Color, v; @color=v end + def color=(v) DataTypeValidator.validate "GradientStop.color", Color, v; @color = v end # @see position - def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1}; @position = v end + def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1 }; @position = v end # Serializes the object # @param [String] str diff --git a/lib/axlsx/stylesheet/num_fmt.rb b/lib/axlsx/stylesheet/num_fmt.rb index ed239dfc..388f0d59 100644 --- a/lib/axlsx/stylesheet/num_fmt.rb +++ b/lib/axlsx/stylesheet/num_fmt.rb @@ -9,7 +9,7 @@ module Axlsx # @param [Hash] options Options for the number format object # @option [Integer] numFmtId The predefined format id or new format id for this format # @option [String] formatCode The format code for this number format - def initialize(options={}) + def initialize(options = {}) @numFmtId = 0 @formatCode = "" parse_options options diff --git a/lib/axlsx/stylesheet/pattern_fill.rb b/lib/axlsx/stylesheet/pattern_fill.rb index 0bcef74b..3ebd4ff6 100644 --- a/lib/axlsx/stylesheet/pattern_fill.rb +++ b/lib/axlsx/stylesheet/pattern_fill.rb @@ -8,7 +8,7 @@ module Axlsx # @option options [Symbol] patternType # @option options [Color] fgColor # @option options [Color] bgColor - def initialize(options={}) + def initialize(options = {}) @patternType = :none parse_options options end @@ -47,9 +47,9 @@ module Axlsx attr_reader :patternType # @see fgColor - def fgColor=(v) DataTypeValidator.validate "PatternFill.fgColor", Color, v; @fgColor=v end + def fgColor=(v) DataTypeValidator.validate "PatternFill.fgColor", Color, v; @fgColor = v end # @see bgColor - def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor=v end + def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor = v end # @see patternType def patternType=(v) Axlsx::validate_pattern_type v; @patternType = v end diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index a1f541c9..e55e2c95 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -224,11 +224,11 @@ module Axlsx # # An index for cell styles where keys are styles codes as per Axlsx::Style and values are Cell#raw_style # The reason for the backward key/value ordering is that style lookup must be most efficient, while `add_style` can be less efficient - def add_style(options={}) + def add_style(options = {}) # Default to :xf options[:type] ||= :xf - raise ArgumentError, "Type must be one of [:xf, :dxf]" unless [:xf, :dxf].include?(options[:type] ) + raise ArgumentError, "Type must be one of [:xf, :dxf]" unless [:xf, :dxf].include?(options[:type]) if options[:border].is_a?(Hash) if options[:border][:edges] == :all @@ -241,9 +241,9 @@ module Axlsx if options[:type] == :xf # Check to see if style in cache already - font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family} + font_defaults = { name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family } - raw_style = {type: :xf}.merge(font_defaults).merge(options) + raw_style = { type: :xf }.merge(font_defaults).merge(options) if raw_style[:format_code] raw_style.delete(:num_fmt) @@ -267,7 +267,7 @@ module Axlsx when :dxf style = Dxf.new :fill => fill, :font => font, :numFmt => numFmt, :border => border, :alignment => alignment, :protection => protection else - style = Xf.new :fillId=>fill || 0, :fontId=>font || 0, :numFmtId=>numFmt || 0, :borderId=>border || 0, :alignment => alignment, :protection => protection, :applyFill=>!fill.nil?, :applyFont=>!font.nil?, :applyNumberFormat =>!numFmt.nil?, :applyBorder=>!border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil? + style = Xf.new :fillId => fill || 0, :fontId => font || 0, :numFmtId => numFmt || 0, :borderId => border || 0, :alignment => alignment, :protection => protection, :applyFill => !fill.nil?, :applyFont => !font.nil?, :applyNumberFormat => !numFmt.nil?, :applyBorder => !border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil? end if options[:type] == :xf @@ -290,7 +290,7 @@ module Axlsx # @option options [Boolean] hide boolean value defining cell protection attribute for hiding. # @option options [Boolean] locked boolean value defining cell protection attribute for locking. # @return [CellProtection] - def parse_protection_options(options={}) + def parse_protection_options(options = {}) return if (options.keys & [:hidden, :locked]).empty? CellProtection.new(options) end @@ -300,7 +300,7 @@ module Axlsx # @option options [Hash] alignment A hash of options to prive the CellAlignment intializer # @return [CellAlignment] # @see CellAlignment - def parse_alignment_options(options={}) + def parse_alignment_options(options = {}) return unless options[:alignment] CellAlignment.new options[:alignment] end @@ -320,7 +320,7 @@ module Axlsx # @option options [Integer] family The font family to use. # @option options [String] font_name The name of the font to use # @return [Font|Integer] - def parse_font_options(options={}) + def parse_font_options(options = {}) return if (options.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty? Axlsx.instance_values_for(fonts.first).each do |key, value| # Thanks for that 1.8.7 - cant do a simple merge... @@ -336,12 +336,12 @@ module Axlsx # @note noop if :bg_color is not specified in options # @option options [String] bg_color The rgb color to apply to the fill # @return [Fill|Integer] - def parse_fill_options(options={}) + def parse_fill_options(options = {}) return unless options[:bg_color] - color = Color.new(:rgb=>options[:bg_color]) + color = Color.new(:rgb => options[:bg_color]) dxf = options[:type] == :dxf color_key = dxf ? :bgColor : :fgColor - pattern = PatternFill.new(:patternType =>:solid, color_key=>color) + pattern = PatternFill.new(:patternType => :solid, color_key => color) fill = Fill.new(pattern) dxf ? fill : fills << fill end @@ -359,8 +359,8 @@ module Axlsx # #apply a thick red border to the top and bottom # { :border => { :style => :thick, :color => "FFFF0000", :edges => [:top, :bottom] } # @return [Border|Integer] - def parse_border_options(options={}) - if options[:border].nil? && Border::EDGES.all?{|x| options["border_#{x}".to_sym].nil? } + def parse_border_options(options = {}) + if options[:border].nil? && Border::EDGES.all? { |x| options["border_#{x}".to_sym].nil? } return nil end @@ -376,7 +376,7 @@ module Axlsx end end - validate_border_hash = ->(val){ + validate_border_hash = ->(val) { if !(val.keys.include?(:style) && val.keys.include?(:color)) raise ArgumentError, (ERR_INVALID_BORDER_OPTIONS % options[:border]) end @@ -461,15 +461,15 @@ module Axlsx # noop if neither :format_code or :num_format options are set. # @option options [Hash] A hash describing the :format_code and/or :num_fmt integer for the style. # @return [NumFmt|Integer] - def parse_num_fmt_options(options={}) + def parse_num_fmt_options(options = {}) return if (options.keys & [:format_code, :num_fmt]).empty? #When the user provides format_code - we always need to create a new numFmt object #When the type is :dxf we always need to create a new numFmt object if options[:format_code] || options[:type] == :dxf #If this is a standard xf we pull from numFmts the highest current and increment for num_fmt - options[:num_fmt] ||= (@numFmts.map{ |num_fmt| num_fmt.numFmtId }.max + 1) if options[:type] != :dxf - numFmt = NumFmt.new(:numFmtId => options[:num_fmt] || 0, :formatCode=> options[:format_code].to_s) + options[:num_fmt] ||= (@numFmts.map { |num_fmt| num_fmt.numFmtId }.max + 1) if options[:type] != :dxf + numFmt = NumFmt.new(:numFmtId => options[:num_fmt] || 0, :formatCode => options[:format_code].to_s) options[:type] == :dxf ? numFmt : (numFmts << numFmt; numFmt.numFmtId) else options[:num_fmt] @@ -494,42 +494,42 @@ module Axlsx # Axlsx::STYLE_THIN_BORDER def load_default_styles @numFmts = SimpleTypedList.new NumFmt, 'numFmts' - @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDD, :formatCode=> "yyyy/mm/dd") - @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDDHHMMSS, :formatCode=> "yyyy/mm/dd hh:mm:ss") + @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDD, :formatCode => "yyyy/mm/dd") + @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDDHHMMSS, :formatCode => "yyyy/mm/dd hh:mm:ss") @numFmts.lock @fonts = SimpleTypedList.new Font, 'fonts' - @fonts << Font.new(:name => "Arial", :sz => 11, :family=>1) + @fonts << Font.new(:name => "Arial", :sz => 11, :family => 1) @fonts.lock @fills = SimpleTypedList.new Fill, 'fills' - @fills << Fill.new(Axlsx::PatternFill.new(:patternType=>:none)) - @fills << Fill.new(Axlsx::PatternFill.new(:patternType=>:gray125)) + @fills << Fill.new(Axlsx::PatternFill.new(:patternType => :none)) + @fills << Fill.new(Axlsx::PatternFill.new(:patternType => :gray125)) @fills.lock @borders = SimpleTypedList.new Border, 'borders' @borders << Border.new black_border = Border.new [:left, :right, :top, :bottom].each do |item| - black_border.prs << BorderPr.new(:name=>item, :style=>:thin, :color=>Color.new(:rgb=>"FF000000")) + black_border.prs << BorderPr.new(:name => item, :style => :thin, :color => Color.new(:rgb => "FF000000")) end @borders << black_border @borders.lock @cellStyleXfs = SimpleTypedList.new Xf, "cellStyleXfs" - @cellStyleXfs << Xf.new(:borderId=>0, :numFmtId=>0, :fontId=>0, :fillId=>0) + @cellStyleXfs << Xf.new(:borderId => 0, :numFmtId => 0, :fontId => 0, :fillId => 0) @cellStyleXfs.lock @cellStyles = SimpleTypedList.new CellStyle, 'cellStyles' - @cellStyles << CellStyle.new(:name =>"Normal", :builtinId =>0, :xfId=>0) + @cellStyles << CellStyle.new(:name => "Normal", :builtinId => 0, :xfId => 0) @cellStyles.lock @cellXfs = SimpleTypedList.new Xf, "cellXfs" - @cellXfs << Xf.new(:borderId=>0, :xfId=>0, :numFmtId=>0, :fontId=>0, :fillId=>0) - @cellXfs << Xf.new(:borderId=>1, :xfId=>0, :numFmtId=>0, :fontId=>0, :fillId=>0) + @cellXfs << Xf.new(:borderId => 0, :xfId => 0, :numFmtId => 0, :fontId => 0, :fillId => 0) + @cellXfs << Xf.new(:borderId => 1, :xfId => 0, :numFmtId => 0, :fontId => 0, :fillId => 0) # default date formatting - @cellXfs << Xf.new(:borderId=>0, :xfId=>0, :numFmtId=>14, :fontId=>0, :fillId=>0, :applyNumberFormat=>1) + @cellXfs << Xf.new(:borderId => 0, :xfId => 0, :numFmtId => 14, :fontId => 0, :fillId => 0, :applyNumberFormat => 1) @cellXfs.lock @dxfs = SimpleTypedList.new(Dxf, "dxfs"); @dxfs.lock diff --git a/lib/axlsx/stylesheet/table_style.rb b/lib/axlsx/stylesheet/table_style.rb index edef6216..f656ce3d 100644 --- a/lib/axlsx/stylesheet/table_style.rb +++ b/lib/axlsx/stylesheet/table_style.rb @@ -10,7 +10,7 @@ module Axlsx # @param [String] name # @option options [Boolean] pivot # @option options [Boolean] table - def initialize(name, options={}) + def initialize(name, options = {}) self.name = name parse_options options super TableStyleElement @@ -31,18 +31,18 @@ module Axlsx attr_reader :table # @see name - def name=(v) Axlsx::validate_string v; @name=v end + def name=(v) Axlsx::validate_string v; @name = v end # @see pivot - def pivot=(v) Axlsx::validate_boolean v; @pivot=v end + def pivot=(v) Axlsx::validate_boolean v; @pivot = v end # @see table - def table=(v) Axlsx::validate_boolean v; @table=v end + def table=(v) Axlsx::validate_boolean v; @table = v end # Serializes the object # @param [String] str # @return [String] def to_xml_string(str = '') str << ' self.size} + serialized_attributes str, { :count => self.size } str << '>' each { |table_style_el| table_style_el.to_xml_string(str) } str << '' diff --git a/lib/axlsx/stylesheet/table_style_element.rb b/lib/axlsx/stylesheet/table_style_element.rb index 4bc2a787..845d6bac 100644 --- a/lib/axlsx/stylesheet/table_style_element.rb +++ b/lib/axlsx/stylesheet/table_style_element.rb @@ -9,7 +9,7 @@ module Axlsx # @option options [Symbol] type # @option options [Integer] size # @option options [Integer] dxfId - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/stylesheet/table_styles.rb b/lib/axlsx/stylesheet/table_styles.rb index 27c75609..a55180a5 100644 --- a/lib/axlsx/stylesheet/table_styles.rb +++ b/lib/axlsx/stylesheet/table_styles.rb @@ -7,7 +7,7 @@ module Axlsx # Creates a new TableStyles object that is a container for TableStyle objects # @option options [String] defaultTableStyle # @option options [String] defaultPivotStyle - def initialize(options={}) + def initialize(options = {}) @defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9" @defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16" super TableStyle @@ -33,7 +33,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') str << ' self.size } + serialized_attributes str, { :count => self.size } str << '>' each { |table_style| table_style.to_xml_string(str) } str << '' diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb index 8b3b11b6..e7a84a46 100644 --- a/lib/axlsx/stylesheet/xf.rb +++ b/lib/axlsx/stylesheet/xf.rb @@ -22,7 +22,7 @@ module Axlsx # @option options [Boolean] applyProtection # @option options [CellAlignment] alignment # @option options [CellProtection] protection - def initialize(options={}) + def initialize(options = {}) parse_options options end diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb index 401db1b8..7a49a0eb 100644 --- a/lib/axlsx/util/constants.rb +++ b/lib/axlsx/util/constants.rb @@ -237,7 +237,7 @@ module Axlsx COMMENT_PN = "comments%d.xml".freeze # location of schema files for validation - SCHEMA_BASE = (File.dirname(__FILE__)+'/../../schema/').freeze + SCHEMA_BASE = (File.dirname(__FILE__) + '/../../schema/').freeze # App validation schema APP_XSD = (SCHEMA_BASE + "shared-documentPropertiesExtended.xsd").freeze diff --git a/lib/axlsx/util/options_parser.rb b/lib/axlsx/util/options_parser.rb index 01a1b29b..3f2c1937 100644 --- a/lib/axlsx/util/options_parser.rb +++ b/lib/axlsx/util/options_parser.rb @@ -5,7 +5,7 @@ module Axlsx # Parses an options hash by calling any defined method by the same # name of the key postfixed with an '=' # @param [Hash] options Options to parse. - def parse_options(options={}) + def parse_options(options = {}) options.each do |key, value| key = :"#{key}=" self.send(key, value) if !value.nil? && self.respond_to?(key) diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index 2ac5c05f..9d46de75 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -71,7 +71,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 = [], &block) attrs = self.class.xml_element_attributes + additional_attributes values = Axlsx.instance_values_for(self) attrs.each do |attribute_name| diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index ddab916e..36651f1f 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -6,7 +6,7 @@ module Axlsx # @param [Array, Class] type An array of Class objects or a single Class object # @param [String] serialize_as The tag name to use in serialization # @raise [ArgumentError] if all members of type are not Class objects - def initialize type, serialize_as=nil, start_size = 0 + def initialize type, serialize_as = nil, start_size = 0 if type.is_a? Array type.each { |item| raise ArgumentError, "All members of type must be Class objects" unless item.is_a? Class } @allowed_types = type @@ -38,7 +38,7 @@ module Axlsx def transpose return @list.clone if @list.size == 0 row_count = @list.size - max_column_count = @list.map{|row| row.cells.size}.max + max_column_count = @list.map { |row| row.cells.size }.max result = Array.new(max_column_count) { Array.new(row_count) } # yes, I know it is silly, but that warning is really annoying row_count.times do |row_index| @@ -164,7 +164,7 @@ module Axlsx def to_xml_string(str = '') classname = @allowed_types[0].name.split('::').last - el_name = serialize_as.to_s || (classname[0,1].downcase + classname[1..-1]) + el_name = serialize_as.to_s || (classname[0, 1].downcase + classname[1..-1]) str << ('<' << el_name << ' count="' << size.to_s << '">') each { |item| item.to_xml_string(str) } str << ('') diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb index 9712c563..c2f0739c 100644 --- a/lib/axlsx/util/storage.rb +++ b/lib/axlsx/util/storage.rb @@ -7,15 +7,15 @@ module Axlsx # storage types TYPES = { - :root=>5, - :stream=>2, - :storage=>1 + :root => 5, + :stream => 2, + :storage => 1 }.freeze # Creates a byte string for this storage # @return [String] def to_s - data = [@name.concat(Array.new(32-@name.size, 0)), + data = [@name.concat(Array.new(32 - @name.size, 0)), @name_size, @type, @color, @@ -31,8 +31,8 @@ module Axlsx # storage colors COLORS = { - :red=>0, - :black=>1 + :red => 0, + :black => 1 } # The color of this node in the directory tree. Defaults to black if not specified @@ -128,7 +128,7 @@ module Axlsx # @option options [Integer] created (0) # @option options [Integer] modified (0) # @option options [Integer] sector (0) - def initialize(name, options= {}) + def initialize(name, options = {}) @left = @right = @child = -1 @sector = @size = @created = @modified = 0 options.each do |o| diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index ebf8a280..266709b0 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -51,7 +51,7 @@ module Axlsx # @raise [ArugumentError] Raised if the class of the value provided is not in the specified array of types or the block passed returns false # @return [Boolean] true if validation succeeds. # @see validate_boolean - def self.validate(name, types, v, other=false) + def self.validate(name, types, v, other = false) if other.is_a?(Proc) raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect]) unless other.call(v) end diff --git a/lib/axlsx/workbook/defined_name.rb b/lib/axlsx/workbook/defined_name.rb index 283a8e9d..4b819d4c 100644 --- a/lib/axlsx/workbook/defined_name.rb +++ b/lib/axlsx/workbook/defined_name.rb @@ -97,7 +97,7 @@ module Axlsx # version of the workbook that is published to or rendered on a Web or application server. # @option [Boolean] workbook_parameter - Specifies a boolean value that indicates that the name is used as a workbook parameter on a # version of the workbook that is published to or rendered on a Web or application server. - def initialize(formula, options={}) + def initialize(formula, options = {}) @formula = formula parse_options options end @@ -118,7 +118,7 @@ module Axlsx serializable_attributes :short_cut_key, :status_bar, :help, :description, :custom_menu, :comment, :workbook_parameter, :publish_to_server, :xlm, :vb_proceedure, :function, :hidden, :local_sheet_id - def to_xml_string(str='') + def to_xml_string(str = '') raise ArgumentError, 'you must specify the name for this defined name. Please read the documentation for Axlsx::DefinedName for more details' unless name str << (' 0 str << '' str << ('') diff --git a/lib/axlsx/workbook/workbook_view.rb b/lib/axlsx/workbook/workbook_view.rb index b2656d00..5b6d5bfb 100644 --- a/lib/axlsx/workbook/workbook_view.rb +++ b/lib/axlsx/workbook/workbook_view.rb @@ -44,7 +44,7 @@ module Axlsx # @option [Integer] window_width Specifies the width of the workbook window. The unit of measurement for this value is twips. # @option [Integer] window_height Specifies the height of the workbook window. The unit of measurement for this value is twips. # @option [Boolean] auto_filter_date_grouping Specifies a boolean value that indicates whether to group dates when presenting the user with filtering options in the user interface. - def initialize(options={}) + def initialize(options = {}) parse_options options yield self if block_given? end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb index fa0716a2..ac630f69 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb @@ -24,7 +24,7 @@ module Axlsx # @return [String] def defined_name return unless range - Axlsx.cell_range(range.split(':').collect { |name| worksheet.name_to_cell(name)}) + Axlsx.cell_range(range.split(':').collect { |name| worksheet.name_to_cell(name) }) end # A collection of filterColumns for this auto_filter @@ -51,7 +51,7 @@ module Axlsx start_point = Axlsx::name_to_indices(first_cell) end_point = Axlsx::name_to_indices(last_cell) # The +1 is so we skip the header row with the filter drop downs - rows = worksheet.rows[(start_point.last+1)..end_point.last] || [] + rows = worksheet.rows[(start_point.last + 1)..end_point.last] || [] column_offset = start_point.first columns.each do |column| @@ -64,7 +64,7 @@ module Axlsx # serialize the object # @return [String] - def to_xml_string(str='') + def to_xml_string(str = '') return unless range str << "" columns.each { |filter_column| filter_column.to_xml_string(str) } diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb index 54d43acf..1fa2ff78 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb @@ -26,7 +26,7 @@ module Axlsx serializable_attributes :col_id, :hidden_button, :show_button # Allowed filters - FILTERS = [:filters] #, :top10, :custom_filters, :dynamic_filters, :color_filters, :icon_filters] + FILTERS = [:filters] #, :top10, :custom_filters, :dynamic_filters, :color_filters, :icon_filters] # Zero-based index indicating the AutoFilter column to which this filter information applies. # @return [Integer] @@ -64,7 +64,7 @@ module Axlsx # @param [Array] row A row from a worksheet that needs to be # filtered. def apply(row, offset) - row.hidden = @filter.apply(row.cells[offset+col_id.to_i]) + row.hidden = @filter.apply(row.cells[offset + col_id.to_i]) end # @param [Boolean] hidden Flag indicating whether the AutoFilter button for this column is hidden. @@ -85,7 +85,7 @@ module Axlsx end # Serialize the object to xml - def to_xml_string(str='') + def to_xml_string(str = '') str << "" @filter.to_xml_string(str) str << "" diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index 7b503acd..da43a471 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -15,7 +15,7 @@ module Axlsx # @note The recommended way to interact with filter objects is via AutoFilter#add_column # @example # ws.auto_filter.add_column(0, :filters, :blank => true, :calendar_type => 'japan', :filter_items => [100, 'a']) - def initialize(options={}) + def initialize(options = {}) parse_options options end @@ -141,7 +141,7 @@ include Axlsx::SerializedAttributes # @option [Integer] hour @see hour # @option [Integer] minute @see minute # @option [Integer] second @see second - def initialize(options={}) + def initialize(options = {}) raise ArgumentError, "You must specify a year for date time grouping" unless options[:year] raise ArgumentError, "You must specify a date_time_grouping when creating a DateGroupItem for auto filter" unless options[:date_time_grouping] parse_options options diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb index 2dcbdf0f..0e2fa87b 100644 --- a/lib/axlsx/workbook/worksheet/border_creator.rb +++ b/lib/axlsx/workbook/worksheet/border_creator.rb @@ -13,7 +13,7 @@ module Axlsx elsif !@edges.is_a?(Array) raise ArgumentError.new("Invalid edges provided, #{@edges}") else - @edges = @edges.map{|x| x&.to_sym}.uniq + @edges = @edges.map { |x| x&.to_sym }.uniq if !(@edges - Axlsx::Border::EDGES).empty? raise ArgumentError.new("Invalid edges provided, #{edges}") @@ -26,7 +26,7 @@ module Axlsx @worksheet.add_style( first_cell, { - border: {style: @style, color: @color, edges: @edges} + border: { style: @style, color: @color, edges: @edges } } ) else @@ -34,7 +34,7 @@ module Axlsx @worksheet.add_style( border_cells[edge], { - border: {style: @style, color: @color, edges: [edge]} + border: { style: @style, color: @color, edges: [edge] } } ) end diff --git a/lib/axlsx/workbook/worksheet/break.rb b/lib/axlsx/workbook/worksheet/break.rb index a9e5fb11..f8cc452e 100644 --- a/lib/axlsx/workbook/worksheet/break.rb +++ b/lib/axlsx/workbook/worksheet/break.rb @@ -13,7 +13,7 @@ module Axlsx # @option options [Integer] max Zero-based index of end row or column of the break. For row breaks, specifies column index; for column breaks, specifies row index. # @option options [Boolean] man Manual Break flag. 1 means the break is a manually inserted break. # @option option [Boolean] pt Flag indicating that a PivotTable created this break. - def initialize(options={}) + def initialize(options = {}) parse_options options yield self if block_given? end @@ -25,7 +25,7 @@ module Axlsx serializable_attributes :id, :min, :max, :man, :pt # serializes the break to xml - def to_xml_string(str='') + def to_xml_string(str = '') serialized_tag('brk', str) end end diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 725b1a39..a9685dac 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -289,7 +289,7 @@ module Axlsx # @param [String] v The 8 character representation for an rgb color #FFFFFFFF" def color=(v) - @color = v.is_a?(Color) ? v : Color.new(:rgb=>v) + @color = v.is_a?(Color) ? v : Color.new(:rgb => v) @is_text_run = true end @@ -342,7 +342,7 @@ module Axlsx # @example Absolute Cell Reference # ws.rows.first.cells.first.r #=> "$A$1" def r_abs - "$#{r.match(%r{([A-Z]+)([0-9]+)})[1,2].join('$')}" + "$#{r.match(%r{([A-Z]+)([0-9]+)})[1, 2].join('$')}" end # @return [Integer] The cellXfs item index applied to this cell. @@ -395,7 +395,7 @@ module Axlsx # @param [Boolean] absolute -when false a relative reference will be # returned. # @return [String] - def reference(absolute=true) + def reference(absolute = true) absolute ? r_abs : r end diff --git a/lib/axlsx/workbook/worksheet/cell_serializer.rb b/lib/axlsx/workbook/worksheet/cell_serializer.rb index b1ac8207..15113fcd 100644 --- a/lib/axlsx/workbook/worksheet/cell_serializer.rb +++ b/lib/axlsx/workbook/worksheet/cell_serializer.rb @@ -7,7 +7,7 @@ module Axlsx # @param [Integer] column_index The index of the cell's column # @param [String] str The string to apend serialization to. # @return [String] - def to_xml_string(row_index, column_index, cell, str='') + def to_xml_string(row_index, column_index, cell, str = '') str << ('' if cell.value.nil? method = cell.type @@ -21,7 +21,7 @@ module Axlsx def run_xml_string(cell, str = '') if cell.is_text_run? valid = RichTextRun::INLINE_STYLES - [:value, :type] - data = Hash[Axlsx.instance_values_for(cell).map{ |k, v| [k.to_sym, v] }] + data = Hash[Axlsx.instance_values_for(cell).map { |k, v| [k.to_sym, v] }] data = data.select { |key, value| valid.include?(key) && !value.nil? } RichText.new(cell.value.to_s, data).to_xml_string(str) elsif cell.contains_rich_text? @@ -36,7 +36,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def iso_8601(cell, str='') + def iso_8601(cell, str = '') value_serialization 'd', cell.value, str end @@ -44,7 +44,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def date(cell, str='') + def date(cell, str = '') value_serialization false, DateTimeConverter::date_to_serial(cell.value).to_s, str end @@ -52,7 +52,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def time(cell, str='') + def time(cell, str = '') value_serialization false, DateTimeConverter::time_to_serial(cell.value).to_s, str end @@ -60,7 +60,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def boolean(cell, str='') + def boolean(cell, str = '') value_serialization 'b', cell.value.to_s, str end @@ -68,7 +68,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def float(cell, str='') + def float(cell, str = '') numeric cell, str end @@ -84,7 +84,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def formula_serialization(cell, str='') + def formula_serialization(cell, str = '') str << ('t="str">' << cell.clean_value.to_s.sub('=', '') << '') str << ('' << cell.formula_value.to_s << '') unless cell.formula_value.nil? end @@ -93,7 +93,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def array_formula_serialization(cell, str='') + def array_formula_serialization(cell, str = '') str << ('t="str">' << '' << cell.clean_value.to_s.sub('{=', '').sub(/}$/, '') << '') str << ('' << cell.formula_value.to_s << '') unless cell.formula_value.nil? end @@ -112,7 +112,7 @@ module Axlsx # @param [Cell] cell The cell that is being serialized # @param [String] str The string the serialized content will be appended to. # @return [String] - def string(cell, str='') + def string(cell, str = '') if cell.is_array_formula? array_formula_serialization cell, str elsif cell.is_formula? diff --git a/lib/axlsx/workbook/worksheet/cfvo.rb b/lib/axlsx/workbook/worksheet/cfvo.rb index c9eb8d3d..773745f4 100644 --- a/lib/axlsx/workbook/worksheet/cfvo.rb +++ b/lib/axlsx/workbook/worksheet/cfvo.rb @@ -14,7 +14,7 @@ module Axlsx # @option options [Symbol] type The type of conditional formatting value object # @option options [Boolean] gte threshold value usage indicator # @option options [String] val The value of the conditional formatting object - def initialize(options={}) + def initialize(options = {}) @gte = true parse_options options end diff --git a/lib/axlsx/workbook/worksheet/cfvos.rb b/lib/axlsx/workbook/worksheet/cfvos.rb index 2fc2e65a..44db4dfd 100644 --- a/lib/axlsx/workbook/worksheet/cfvos.rb +++ b/lib/axlsx/workbook/worksheet/cfvos.rb @@ -9,7 +9,7 @@ module Axlsx # Serialize the Cfvo object # @param [String] str # @return [String] - def to_xml_string(str='') + def to_xml_string(str = '') each { |cfvo| cfvo.to_xml_string(str) } end end diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index 6305b8c9..0b39024f 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -16,7 +16,7 @@ module Axlsx # @option options [Boolean] phonetic see Col#phonetic # @option options [Integer] style see Col#style # @option options [Numeric] width see Col#width - def initialize(min, max, options={}) + def initialize(min, max, options = {}) Axlsx.validate_unsigned_int(max) Axlsx.validate_unsigned_int(min) @min = min diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb index df7da37b..763e4268 100644 --- a/lib/axlsx/workbook/worksheet/col_breaks.rb +++ b/lib/axlsx/workbook/worksheet/col_breaks.rb @@ -23,7 +23,7 @@ module Axlsx # # # - def to_xml_string(str='') + def to_xml_string(str = '') return if empty? str << ('') each { |brk| brk.to_xml_string(str) } diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb index 60b0e183..75877915 100644 --- a/lib/axlsx/workbook/worksheet/color_scale.rb +++ b/lib/axlsx/workbook/worksheet/color_scale.rb @@ -10,8 +10,8 @@ module Axlsx # These are the default conditional formatting value objects # that define a two tone color gradient. def default_cfvos - [{:type => :min, :val => 0, :color => 'FFFF7128'}, - {:type => :max, :val => 0, :color => 'FFFFEF9C'}] + [{ :type => :min, :val => 0, :color => 'FFFF7128' }, + { :type => :max, :val => 0, :color => 'FFFFEF9C' }] end # A builder for two tone color gradient @@ -29,9 +29,9 @@ module Axlsx # color_scale = Axlsx::ColorScale.three_tone # @see examples/example.rb conditional formatting examples. def three_tone - self.new({:type => :min, :val => 0, :color => 'FFF8696B'}, - {:type => :percent, :val => '50', :color => 'FFFFEB84'}, - {:type => :max, :val => 0, :color => 'FF63BE7B'}) + self.new({ :type => :min, :val => 0, :color => 'FFF8696B' }, + { :type => :percent, :val => '50', :color => 'FFFFEB84' }, + { :type => :max, :val => 0, :color => 'FF63BE7B' }) end end # A simple typed list of cfvos @@ -65,16 +65,16 @@ module Axlsx # @option [Symbol] type The type of cfvo you to add # @option [Any] val The value of the cfvo to add # @option [String] The rgb color for the cfvo - def add(options={}) + def add(options = {}) value_objects << Cfvo.new(:type => options[:type] || :min, :val => options[:val] || 0) colors << Color.new(:rgb => options[:color] || "FF000000") - {:cfvo => value_objects.last, :color => colors.last} + { :cfvo => value_objects.last, :color => colors.last } end # removes the cfvo and color pair at the index specified. # @param [Integer] index The index of the cfvo and color object to delete # @note you cannot remove the first two cfvo and color pairs - def delete_at(index=2) + def delete_at(index = 2) value_objects.delete_at index colors.delete_at index end diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index 9efdb1f0..c2c94219 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -11,7 +11,7 @@ module Axlsx # @option [String] text The text for the comment # @option [String] ref The refence (e.g. 'A3' where this comment will be anchored. # @option [Boolean] visible This controls the visiblity of the associated vml_shape. - def initialize(comments, options={}) + def initialize(comments, options = {}) raise ArgumentError, "A comment needs a parent comments object" unless comments.is_a?(Comments) @visible = true @comments = comments diff --git a/lib/axlsx/workbook/worksheet/comments.rb b/lib/axlsx/workbook/worksheet/comments.rb index 71a58c46..3ec2ba01 100644 --- a/lib/axlsx/workbook/worksheet/comments.rb +++ b/lib/axlsx/workbook/worksheet/comments.rb @@ -18,7 +18,7 @@ module Axlsx # The part name for this object # @return [String] def pn - "#{COMMENT_PN % (index+1)}" + "#{COMMENT_PN % (index + 1)}" end # Creates a new Comments object @@ -35,7 +35,7 @@ module Axlsx # @option options [String] author The name of the author for this comment # @option options [String] text The text for this comment # @option options [Stirng|Cell] ref The cell that this comment is attached to. - def add_comment(options={}) + def add_comment(options = {}) raise ArgumentError, "Comment require an author" unless options[:author] raise ArgumentError, "Comment requires text" unless options[:text] raise ArgumentError, "Comment requires ref" unless options[:ref] @@ -60,7 +60,7 @@ module Axlsx # serialize the object # @param [String] str # @return [String] - def to_xml_string(str="") + def to_xml_string(str = "") str << '' str << ('') authors.each do |author| diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb index 2ff13682..c13113a5 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb @@ -10,7 +10,7 @@ module Axlsx # Creates a new {ConditionalFormatting} object # @option options [Array] rules The rules to apply # @option options [String] sqref The range to apply the rules to - def initialize(options={}) + def initialize(options = {}) @rules = [] parse_options options end @@ -74,7 +74,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') str << ('') - str << rules.collect{ |rule| rule.to_xml_string }.join(' ') + str << rules.collect { |rule| rule.to_xml_string }.join(' ') str << '' end end diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb index de1c4032..4f84080b 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb @@ -24,7 +24,7 @@ module Axlsx # @option options [Boolean] stopIfTrue Stop evaluating rules after this rule matches # @option options [Symbol] timePeriod The time period in a date occuring... rule # @option options [String] formula The formula to match against in i.e. an equal rule. Use a [minimum, maximum] array for cellIs between/notBetween conditionals. - def initialize(options={}) + def initialize(options = {}) @color_scale = @data_bar = @icon_set = @formula = nil parse_options options end @@ -179,7 +179,7 @@ module Axlsx # @see timePeriod def timePeriod=(v); Axlsx::validate_time_period_type(v); @timePeriod = v end # @see formula - def formula=(v); [*v].each {|x| Axlsx::validate_string(x) }; @formula = [*v].map { |form| ::CGI.escapeHTML(form) } end + def formula=(v); [*v].each { |x| Axlsx::validate_string(x) }; @formula = [*v].map { |form| ::CGI.escapeHTML(form) } end # @see color_scale def color_scale=(v) diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb index c89c421d..1ff65fd5 100644 --- a/lib/axlsx/workbook/worksheet/data_bar.rb +++ b/lib/axlsx/workbook/worksheet/data_bar.rb @@ -12,8 +12,8 @@ module Axlsx class << self # This differs from ColorScale. There must be exactly two cfvos one color def default_cfvos - [{:type => :min, :val => "0"}, - {:type => :max, :val => "0"}] + [{ :type => :min, :val => "0" }, + { :type => :max, :val => "0" }] end end @@ -105,7 +105,7 @@ module Axlsx # Serialize this object to an xml string # @param [String] str # @return [String] - def to_xml_string(str="") + def to_xml_string(str = "") serialized_tag('dataBar', str) do value_objects.to_xml_string(str) self.color.to_xml_string(str) diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb index d4b86e20..741dee86 100644 --- a/lib/axlsx/workbook/worksheet/data_validation.rb +++ b/lib/axlsx/workbook/worksheet/data_validation.rb @@ -22,7 +22,7 @@ module Axlsx # @option options [Boolean] showInputMessage - A boolean value indicating whether to display the input prompt message. # @option options [String] sqref - Range over which data validation is applied, in "A1:B2" format. # @option options [Symbol] type - The type of data validation. - def initialize(options={}) + def initialize(options = {}) # defaults @formula1 = @formula2 = @error = @errorTitle = @operator = @prompt = @promptTitle = @sqref = nil @allowBlank = @showErrorMessage = true diff --git a/lib/axlsx/workbook/worksheet/date_time_converter.rb b/lib/axlsx/workbook/worksheet/date_time_converter.rb index 48d69d94..ff85c64f 100644 --- a/lib/axlsx/workbook/worksheet/date_time_converter.rb +++ b/lib/axlsx/workbook/worksheet/date_time_converter.rb @@ -22,7 +22,7 @@ module Axlsx epoch1904 = -2082844800.0 # Time.utc(1904, 1, 1).to_i seconds_per_day = 86400.0 # 60*60*24 epoch = Axlsx::Workbook::date1904 ? epoch1904 : epoch1900 - (time.utc_offset + time.to_f - epoch)/seconds_per_day + (time.utc_offset + time.to_f - epoch) / seconds_per_day end end end diff --git a/lib/axlsx/workbook/worksheet/icon_set.rb b/lib/axlsx/workbook/worksheet/icon_set.rb index 0042e757..4e7064e9 100644 --- a/lib/axlsx/workbook/worksheet/icon_set.rb +++ b/lib/axlsx/workbook/worksheet/icon_set.rb @@ -61,7 +61,7 @@ module Axlsx # Serialize this object to an xml string # @param [String] str # @return [String] - def to_xml_string(str="") + def to_xml_string(str = "") serialized_tag('iconSet', str) do @value_objects.each { |cfvo| cfvo.to_xml_string(str) } end diff --git a/lib/axlsx/workbook/worksheet/page_margins.rb b/lib/axlsx/workbook/worksheet/page_margins.rb index 2dec65e6..de0d099b 100644 --- a/lib/axlsx/workbook/worksheet/page_margins.rb +++ b/lib/axlsx/workbook/worksheet/page_margins.rb @@ -19,7 +19,7 @@ module Axlsx # @option options [Numeric] top The top margin in inches # @option options [Numeric] header The header margin in inches # @option options [Numeric] footer The footer margin in inches - def initialize(options={}) + def initialize(options = {}) # Default values taken from MS Excel for Mac 2011 @left = @right = DEFAULT_LEFT_RIGHT @top = @bottom = DEFAULT_TOP_BOTTOM diff --git a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb index 2242f2bc..819c5fa7 100644 --- a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +++ b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb @@ -35,7 +35,7 @@ module Axlsx end # serialize to xml - def to_xml_string(str='') + def to_xml_string(str = '') str << ('') end end diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb index 6281eb74..07dd6817 100644 --- a/lib/axlsx/workbook/worksheet/page_setup.rb +++ b/lib/axlsx/workbook/worksheet/page_setup.rb @@ -213,7 +213,7 @@ module Axlsx # @note This method will overwrite any value you explicitly set via the fit_to_height or fit_to_width methods. # @option options [Integer] width The number of pages to fit this worksheet on horizontally. Default 999 # @option options [Integer] height The number of pages to fit this worksheet on vertically. Default 999 - def fit_to(options={}) + def fit_to(options = {}) self.fit_to_width = options[:width] || 999 self.fit_to_height = options[:height] || 999 [@fit_to_width, @fit_to_height] diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb index 9acfa14b..f9323d3e 100644 --- a/lib/axlsx/workbook/worksheet/pane.rb +++ b/lib/axlsx/workbook/worksheet/pane.rb @@ -12,7 +12,7 @@ module Axlsx # @option options [Cell, String] top_left_cell Top Left Visible Cell # @option options [Integer] x_split Horizontal Split Position # @option options [Integer] y_split Vertical Split Position - def initialize(options={}) + def initialize(options = {}) #defaults @active_pane = @state = @top_left_cell = nil @x_split = @y_split = 0 @@ -131,7 +131,7 @@ module Axlsx if @state == 'frozen' && @top_left_cell.nil? row = @y_split || 0 column = @x_split || 0 - @top_left_cell = "#{('A'..'ZZ').to_a[column]}#{row+1}" + @top_left_cell = "#{('A'..'ZZ').to_a[column]}#{row + 1}" end end end diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb index ed51d5cf..ff131dfb 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table.rb @@ -11,12 +11,12 @@ module Axlsx # @param [Worksheet] sheet The sheet containing the table data. # @option options [Cell, String] name # @option options [TableStyle] style - def initialize(ref, range, sheet, options={}) + def initialize(ref, range, sheet, options = {}) @ref = ref self.range = range @sheet = sheet @sheet.workbook.pivot_tables << self - @name = "PivotTable#{index+1}" + @name = "PivotTable#{index + 1}" @data_sheet = nil @rows = [] @columns = [] @@ -122,7 +122,7 @@ module Axlsx @data = [] v.each do |data_field| if data_field.is_a? String - data_field = {:ref => data_field} + data_field = { :ref => data_field } end data_field.each do |key, value| if key == :num_fmt @@ -158,13 +158,13 @@ module Axlsx # The part name for this table # @return [String] def pn - "#{PIVOT_TABLE_PN % (index+1)}" + "#{PIVOT_TABLE_PN % (index + 1)}" end # The relationship part name of this pivot table # @return [String] def rels_pn - "#{PIVOT_TABLE_RELS_PN % (index+1)}" + "#{PIVOT_TABLE_RELS_PN % (index + 1)}" end # The cache_definition for this pivot table @@ -219,7 +219,7 @@ module Axlsx str << '' str << "" str << '' - data[1..-1].each_with_index do |datum_value,i| + data[1..-1].each_with_index do |datum_value, i| str << "" end str << '' @@ -244,7 +244,7 @@ module Axlsx str << "" data.each do |datum_value| # The correct name prefix in ["Sum","Average", etc...] - str << "" @@ -254,7 +254,7 @@ module Axlsx # custom pivot table style unless style_info.empty? str << '' diff --git a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb index 2c7c05e4..8813c84b 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb @@ -24,7 +24,7 @@ module Axlsx # The part name for this table # @return [String] def pn - "#{PIVOT_TABLE_CACHE_DEFINITION_PN % (index+1)}" + "#{PIVOT_TABLE_CACHE_DEFINITION_PN % (index + 1)}" end # The identifier for this cache @@ -46,17 +46,17 @@ module Axlsx def to_xml_string(str = '') str << '' str << ('') - str << '' - str << ( '') - str << '' - str << ( '') + str << '' + str << ('') + str << '' + str << ('') pivot_table.header_cells.each do |cell| - str << ( '') + str << ('') str << '' str << '' - str << '' + str << '' end - str << '' + str << '' str << '' end end diff --git a/lib/axlsx/workbook/worksheet/pivot_tables.rb b/lib/axlsx/workbook/worksheet/pivot_tables.rb index 8aaebea2..018fc6a7 100644 --- a/lib/axlsx/workbook/worksheet/pivot_tables.rb +++ b/lib/axlsx/workbook/worksheet/pivot_tables.rb @@ -15,7 +15,7 @@ module Axlsx # returns the relationships required by this collection def relationships return [] if empty? - map{ |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, "../#{pivot_table.pn}") } + map { |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, "../#{pivot_table.pn}") } end end end diff --git a/lib/axlsx/workbook/worksheet/protected_range.rb b/lib/axlsx/workbook/worksheet/protected_range.rb index 07f9a20c..e4eb83e5 100644 --- a/lib/axlsx/workbook/worksheet/protected_range.rb +++ b/lib/axlsx/workbook/worksheet/protected_range.rb @@ -9,7 +9,7 @@ module Axlsx # Initializes a new protected range object # @option [String] sqref The cell range reference to protect. This can be an absolute or a relateve range however, it only applies to the current sheet. # @option [String] name An optional name for the protected name. - def initialize(options={}) + def initialize(options = {}) parse_options options yield self if block_given? end @@ -39,7 +39,7 @@ module Axlsx # @param [String] str if this string object is provided we append # our output to that object. Use this - it helps limit the number of # objects created during serialization - def to_xml_string(str="") + def to_xml_string(str = "") serialized_tag 'protectedRange', str end end diff --git a/lib/axlsx/workbook/worksheet/rich_text.rb b/lib/axlsx/workbook/worksheet/rich_text.rb index e5156047..4b643470 100644 --- a/lib/axlsx/workbook/worksheet/rich_text.rb +++ b/lib/axlsx/workbook/worksheet/rich_text.rb @@ -5,7 +5,7 @@ module Axlsx # @param [String] text -optional The text to use in creating the first RichTextRun # @param [Object] options -optional The options to use in creating the first RichTextRun # @yield [RichText] self - def initialize(text = nil, options={}) + def initialize(text = nil, options = {}) super(RichTextRun) add_run(text, options) unless text.nil? yield self if block_given? @@ -32,7 +32,7 @@ module Axlsx # Creates and adds a RichTextRun to this collectino # @param [String] text The text to use in creating a new RichTextRun # @param [Object] options The options to use in creating the new RichTextRun - def add_run(text, options={}) + def add_run(text, options = {}) self << RichTextRun.new(text, options) end @@ -45,8 +45,8 @@ module Axlsx # renders the RichTextRuns in this collection # @param [String] str # @return [String] - def to_xml_string(str='') - each{ |run| run.to_xml_string(str) } + def to_xml_string(str = '') + each { |run| run.to_xml_string(str) } str end end diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb index 44046709..368b10ce 100644 --- a/lib/axlsx/workbook/worksheet/rich_text_run.rb +++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb @@ -11,7 +11,7 @@ module Axlsx :shadow, :condense, :extend, :u, :vertAlign, :sz, :color, :scheme].freeze - def initialize(value, options={}) + def initialize(value, options = {}) self.value = value parse_options(options) end @@ -138,7 +138,7 @@ module Axlsx # @param [String] v The 8 character representation for an rgb color #FFFFFFFF" def color=(v) - @color = v.is_a?(Color) ? v : Color.new(:rgb=>v) + @color = v.is_a?(Color) ? v : Color.new(:rgb => v) end # The inline sz property for the cell @@ -203,7 +203,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') valid = RichTextRun::INLINE_STYLES - data = Hash[Axlsx.instance_values_for(self).map{ |k, v| [k.to_sym, v] }] + data = Hash[Axlsx.instance_values_for(self).map { |k, v| [k.to_sym, v] }] data = data.select { |key, value| valid.include?(key) && !value.nil? } str << '' diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index fc044124..453e1e66 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -27,7 +27,7 @@ module Axlsx # @option options [Integer] offset - add empty columns before values # @see Row#array_to_cells # @see Cell - def initialize(worksheet, values=[], options={}) + def initialize(worksheet, values = [], options = {}) self.worksheet = worksheet super(Cell, nil, values.size + options[:offset].to_i) self.height = options.delete(:height) @@ -134,7 +134,7 @@ module Axlsx private # assigns the owning worksheet for this row - def worksheet=(v) DataTypeValidator.validate :row_worksheet, Worksheet, v; @worksheet=v; end + def worksheet=(v) DataTypeValidator.validate :row_worksheet, Worksheet, v; @worksheet = v; end # Converts values, types, and style options into cells and associates them with this row. # A new cell is created for each item in the values array. @@ -145,7 +145,7 @@ module Axlsx # @option options [Array] values # @option options [Array, Symbol] types # @option options [Array, Integer] style - def array_to_cells(values, options={}) + def array_to_cells(values, options = {}) DataTypeValidator.validate :array_to_cells, Array, values types, style, formula_values, escape_formulas, offset = options.delete(:types), options.delete(:style), options.delete(:formula_values), options.delete(:escape_formulas), options.delete(:offset) offset.to_i.times { |index| self[index] = Cell.new(self) } if offset diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb index e4cbf4f2..b05e0587 100644 --- a/lib/axlsx/workbook/worksheet/row_breaks.rb +++ b/lib/axlsx/workbook/worksheet/row_breaks.rb @@ -21,7 +21,7 @@ module Axlsx # # # - def to_xml_string(str='') + def to_xml_string(str = '') return if empty? str << ('') each { |brk| brk.to_xml_string(str) } diff --git a/lib/axlsx/workbook/worksheet/selection.rb b/lib/axlsx/workbook/worksheet/selection.rb index efa56056..82538fce 100644 --- a/lib/axlsx/workbook/worksheet/selection.rb +++ b/lib/axlsx/workbook/worksheet/selection.rb @@ -12,7 +12,7 @@ module Axlsx # @option options [Integer] active_cell_id Active Cell Index # @option options [Symbol] pane Pane # @option options [String] sqref Sequence of References - def initialize(options={}) + def initialize(options = {}) @active_cell = @active_cell_id = @pane = @sqref = nil parse_options options end diff --git a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb index b42ecb31..58f630d4 100644 --- a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb @@ -8,7 +8,7 @@ module Axlsx # creates a new SheetCalcPr # @param [Hash] options Options for this object # @option [Boolean] full_calc_on_load @see full_calc_on_load - def initialize(options={}) + def initialize(options = {}) @full_calc_on_load = true parse_options options end @@ -21,7 +21,7 @@ module Axlsx # @param [String] str the string to append this objects serialized # content to. # @return [String] - def to_xml_string(str='') + def to_xml_string(str = '') str << "" end end diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index de4c6e16..5e06ca5b 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -28,7 +28,7 @@ module Axlsx # @option [Boolean] thick_bottom 'True' if rows have a thick bottom border by default. # @option [Integer] outline_level_row Highest number of outline level for rows in this sheet. These values shall be in synch with the actual sheet outline levels. # @option [Integer] outline_level_col Highest number of outline levels for columns in this sheet. These values shall be in synch with the actual sheet outline levels. - def initialize(options={}) + def initialize(options = {}) set_defaults parse_options options end @@ -46,7 +46,7 @@ module Axlsx # serializes this object to an xml string # @param [String] str The string this objects serialization will be appended to # @return [String] - def to_xml_string(str='') + def to_xml_string(str = '') str << "" end diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb index 6f76b580..a870e4a3 100644 --- a/lib/axlsx/workbook/worksheet/sheet_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb @@ -29,7 +29,7 @@ module Axlsx # Creates a new SheetPr object # @param [Worksheet] worksheet The worksheet that owns this SheetPr object - def initialize(worksheet, options={}) + def initialize(worksheet, options = {}) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @worksheet = worksheet @outline_pr = nil diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index c921d381..3ca17737 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -23,7 +23,7 @@ module Axlsx # @option options [Boolean] pivot_tables @see SheetProtection#pivot_tables # @option options [Boolean] select_unlocked_cells @see SheetProtection#select_unlocked_cells # @option options [String] password. The password required for unlocking. @see SheetProtection#password= - def initialize(options={}) + def initialize(options = {}) @objects = @scenarios = @select_locked_cells = @select_unlocked_cells = false @sheet = @format_cells = @format_rows = @format_columns = @insert_columns = @insert_rows = @insert_hyperlinks = @delete_columns = @delete_rows = @sort = @auto_filter = @pivot_tables = true @password = nil @@ -107,7 +107,7 @@ module Axlsx char = low_15 | high_15 end - encoded_password = 0x0000 + encoded_password = 0x0000 chars.each { |c| encoded_password ^= c } encoded_password ^= count encoded_password ^= 0xCE4B diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index 17a547ea..ab66f800 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -28,7 +28,7 @@ module Axlsx # @option options [Integer] zoom_scale_normal Zoom Scale Normal View # @option options [Integer] zoom_scale_page_layout_view Zoom Scale Page Layout View # @option options [Integer] zoom_scale_sheet_layout_view Zoom Scale Page Break Preview - def initialize(options={}) + def initialize(options = {}) #defaults @color_id = @top_left_cell = @pane = nil @right_to_left = @show_formulas = @show_outline_symbols = @show_white_space = @tab_selected = @window_protection = false diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb index 5053c5fd..4f446491 100644 --- a/lib/axlsx/workbook/worksheet/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -10,13 +10,13 @@ module Axlsx # @param [Worksheet] sheet The sheet containing the table data. # @option options [Cell, String] name # @option options [TableStyle] style - def initialize(ref, sheet, options={}) + def initialize(ref, sheet, options = {}) @ref = ref @sheet = sheet @style = nil @sheet.workbook.tables << self @table_style_info = TableStyleInfo.new(options[:style_info]) if options[:style_info] - @name = "Table#{index+1}" + @name = "Table#{index + 1}" parse_options options yield self if block_given? end @@ -42,7 +42,7 @@ module Axlsx # The part name for this table # @return [String] def pn - "#{TABLE_PN % (index+1)}" + "#{TABLE_PN % (index + 1)}" end # The relationship id for this table. @@ -73,12 +73,12 @@ module Axlsx # @return [String] def to_xml_string(str = '') str << '' - str << ('') str << ('') str << ('') - header_cells.each_with_index do |cell,index| - str << ('') + header_cells.each_with_index do |cell, index| + str << ('') end str << '' table_style_info.to_xml_string(str) diff --git a/lib/axlsx/workbook/worksheet/tables.rb b/lib/axlsx/workbook/worksheet/tables.rb index bf6efe0c..69e59fe5 100644 --- a/lib/axlsx/workbook/worksheet/tables.rb +++ b/lib/axlsx/workbook/worksheet/tables.rb @@ -15,7 +15,7 @@ module Axlsx # returns the relationships required by this collection def relationships return [] if empty? - map{ |table| Relationship.new(table, TABLE_R, "../#{table.pn}") } + map { |table| Relationship.new(table, TABLE_R, "../#{table.pn}") } end # renders the tables xml diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index c3960af3..18daaeeb 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -14,7 +14,7 @@ module Axlsx # @option options [Hash] print_options A hash containing print options for this worksheet. @see PrintOptions # @option options [Hash] header_footer A hash containing header/footer options for this worksheet. @see HeaderFooter # @option options [Boolean] show_gridlines indicates if gridlines should be shown for this sheet. - def initialize(wb, options={}) + def initialize(wb, options = {}) self.workbook = wb @sheet_protection = nil initialize_page_options(options) @@ -40,7 +40,7 @@ module Axlsx # The name of the worksheet # @return [String] def name - @name ||= "Sheet" + (index+1).to_s + @name ||= "Sheet" + (index + 1).to_s end # Specifies the visible state of this sheet. Allowed states are @@ -99,13 +99,13 @@ module Axlsx # The tables in this worksheet # @return [Array] of Table def tables - @tables ||= Tables.new self + @tables ||= Tables.new self end # The pivot tables in this worksheet # @return [Array] of Table def pivot_tables - @pivot_tables ||= PivotTables.new self + @pivot_tables ||= PivotTables.new self end # A collection of column breaks added to this worksheet @@ -307,7 +307,7 @@ module Axlsx # @param [String] name def name=(name) validate_sheet_name name - @name=Axlsx::coder.encode(name) + @name = Axlsx::coder.encode(name) end # The auto filter range for the worksheet @@ -325,13 +325,13 @@ module Axlsx # The part name of this worksheet # @return [String] def pn - "#{WORKSHEET_PN % (index+1)}" + "#{WORKSHEET_PN % (index + 1)}" end # The relationship part name of this worksheet # @return [String] def rels_pn - "#{WORKSHEET_RELS_PN % (index+1)}" + "#{WORKSHEET_RELS_PN % (index + 1)}" end # The relationship id of this worksheet. @@ -408,7 +408,7 @@ module Axlsx # sign as formula (default) or as simple string. # Allowing user generated data to be interpreted as formulas can be dangerous # (see https://www.owasp.org/index.php/CSV_Injection for details). - def add_row(values=[], options={}) + def add_row(values = [], options = {}) row = Row.new(self, values, options) update_column_info row, options.delete(:widths) yield row if block_given? @@ -428,7 +428,7 @@ module Axlsx # @see ConditionalFormattingRule#initialize # @see file:examples/example_conditional_formatting.rb def add_conditional_formatting(cells, rules) - cf = ConditionalFormatting.new( :sqref => cells ) + cf = ConditionalFormatting.new(:sqref => cells) cf.add_rules rules conditional_formattings << cf conditional_formattings @@ -449,7 +449,7 @@ module Axlsx # @param [Hash] options for the hyperlink # @see WorksheetHyperlink for a list of options # @return [WorksheetHyperlink] - def add_hyperlink(options={}) + def add_hyperlink(options = {}) hyperlinks.add(options) end @@ -466,33 +466,33 @@ module Axlsx # @see Bar3DChart # @see Line3DChart # @see README for examples - def add_chart(chart_type, options={}) + def add_chart(chart_type, options = {}) chart = worksheet_drawing.add_chart(chart_type, options) yield chart if block_given? chart end # needs documentation - def add_table(ref, options={}) + def add_table(ref, options = {}) tables << Table.new(ref, self, options) yield tables.last if block_given? tables.last end - def add_pivot_table(ref, range, options={}) + def add_pivot_table(ref, range, options = {}) pivot_tables << PivotTable.new(ref, range, self, options) yield pivot_tables.last if block_given? pivot_tables.last end # Shortcut to worsksheet_comments#add_comment - def add_comment(options={}) + def add_comment(options = {}) worksheet_comments.add_comment(options) end # Adds a media item to the worksheets drawing # @option [Hash] options options passed to drawing.add_image - def add_image(options={}) + def add_image(options = {}) image = worksheet_drawing.add_image(options) yield image if block_given? image @@ -539,7 +539,7 @@ module Axlsx # @note You can also specify the style for specific columns in the call to add_row by using an array for the :styles option # @see Worksheet#add_row # @see README.md for an example - def col_style(index, style, options={}) + def col_style(index, style, options = {}) offset = options.delete(:row_offset) || 0 cells = @rows[(offset..-1)].map { |row| row[index] }.flatten.compact cells.each { |cell| cell.style = style } @@ -553,7 +553,7 @@ module Axlsx # @note You can also specify the style in the add_row call # @see Worksheet#add_row # @see README.md for an example - def row_style(index, style, options={}) + def row_style(index, style, options = {}) offset = options.delete(:col_offset) || 0 cells = cols[(offset..-1)].map { |column| column[index] }.flatten.compact cells.each { |cell| cell.style = style } @@ -583,7 +583,7 @@ module Axlsx # Set the style for cells in a specific column # @param [String|Array] cell references # @param [Hash|Array|Symbol] border options - def add_border(cell_refs, options=nil) + def add_border(cell_refs, options = nil) if options.is_a?(Hash) border_edges = options[:edges] border_style = options[:style] @@ -606,7 +606,7 @@ module Axlsx end # Returns a sheet node serialization for this sheet in the workbook. - def to_sheet_node_xml_string(str='') + def to_sheet_node_xml_string(str = '') add_autofilter_defined_name_to_workbook str << '' @@ -646,7 +646,7 @@ module Axlsx def [](cell_def) return rows[cell_def] if cell_def.is_a?(Integer) - parts = cell_def.split(':').map{ |part| name_to_cell part } + parts = cell_def.split(':').map { |part| name_to_cell part } if parts.size == 1 parts.first diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb index d8aed8e0..c40587ae 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb @@ -20,7 +20,7 @@ module Axlsx # Adds a comment # @param [Hash] options # @see Comments#add_comment - def add_comment(options={}) + def add_comment(options = {}) comments.add_comment(options) end @@ -41,7 +41,7 @@ module Axlsx # @see Relationship#Id # @return [String] def drawing_rId - comments.relationships.find{ |r| r.Type == VML_DRAWING_R }.Id + comments.relationships.find { |r| r.Type == VML_DRAWING_R }.Id end # Seraalize the object diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb index f79bc814..bda87995 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb @@ -13,7 +13,7 @@ module Axlsx # @option [String] tooltip The tip to display when the user positions the mouse cursor over this hyperlink # @option [Symbol] target This is :external by default. If you set it to anything else, the location is interpreted to be the current workbook. # @option [String|Cell] ref The location of this hyperlink in the worksheet - def initialize(worksheet, options={}) + def initialize(worksheet, options = {}) DataTypeValidator.validate "Hyperlink.worksheet", [Worksheet], worksheet @worksheet = worksheet @target = :external @@ -55,7 +55,7 @@ module Axlsx # Seralize the object # @param [String] str # @return [String] - def to_xml_string(str='') + def to_xml_string(str = '') str << '' @@ -66,7 +66,7 @@ module Axlsx # r:id should only be specified for external targets. # @return [Hash] def location_or_id - @target == :external ? { :"r:id" => relationship.Id } : { :location => Axlsx::coder.encode(location) } + @target == :external ? { :"r:id" => relationship.Id } : { :location => Axlsx::coder.encode(location) } end end end diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb index 5d5a2186..5c49fdb3 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb @@ -26,7 +26,7 @@ module Axlsx # seralize the collection of hyperlinks # @return [String] - def to_xml_string(str='') + def to_xml_string(str = '') return if empty? str << '' each { |hyperlink| hyperlink.to_xml_string(str) } diff --git a/test/benchmark.rb b/test/benchmark.rb index e9f6c22b..3c0ebc95 100644 --- a/test/benchmark.rb +++ b/test/benchmark.rb @@ -6,7 +6,7 @@ require 'benchmark' Axlsx::trust_input = true row = [] input = (32..126).to_a.pack('U*').chars.to_a -20.times { row << input.shuffle.join} +20.times { row << input.shuffle.join } times = 3000 Benchmark.bmbm(30) do |x| x.report('axlsx_noautowidth') { diff --git a/test/content_type/tc_content_type.rb b/test/content_type/tc_content_type.rb index 278cd67b..f06554c8 100644 --- a/test/content_type/tc_content_type.rb +++ b/test/content_type/tc_content_type.rb @@ -8,7 +8,7 @@ class TestContentType < Test::Unit::TestCase def test_valid_document schema = Nokogiri::XML::Schema(File.open(Axlsx::CONTENT_TYPES_XSD)) - assert(schema.validate(@doc).map{ |e| puts e.message; e.message }.empty?) + assert(schema.validate(@doc).map { |e| puts e.message; e.message }.empty?) end def test_pre_built_types @@ -22,7 +22,7 @@ class TestContentType < Test::Unit::TestCase assert_equal(node["Extension"], "#{Axlsx::XML_EX}", "xml content type invalid") node = @doc.xpath(d_path % Axlsx::RELS_CT).first - assert_equal(node["Extension"],"#{Axlsx::RELS_EX}", "relationships content type invalid") + assert_equal(node["Extension"], "#{Axlsx::RELS_EX}", "relationships content type invalid") #overrride assert_equal(@doc.xpath("//xmlns:Override").size, 4, "There should be 4 Override types") diff --git a/test/content_type/tc_default.rb b/test/content_type/tc_default.rb index 77915ea0..096a117a 100644 --- a/test/content_type/tc_default.rb +++ b/test/content_type/tc_default.rb @@ -2,11 +2,11 @@ require 'tc_helper.rb' class TestDefault < Test::Unit::TestCase def test_content_type_restriction - assert_raise(ArgumentError, "raises argument error if invlalid ContentType is") { Axlsx::Default.new :ContentType=>"asdf" } + assert_raise(ArgumentError, "raises argument error if invlalid ContentType is") { Axlsx::Default.new :ContentType => "asdf" } end def test_to_xml_string - type = Axlsx::Default.new :Extension=>"xml", :ContentType=>Axlsx::XML_CT + type = Axlsx::Default.new :Extension => "xml", :ContentType => Axlsx::XML_CT doc = Nokogiri::XML(type.to_xml_string) assert_equal(doc.xpath("Default[@ContentType='#{Axlsx::XML_CT}']").size, 1) assert_equal(doc.xpath("Default[@Extension='xml']").size, 1) diff --git a/test/content_type/tc_override.rb b/test/content_type/tc_override.rb index c21f9f27..952f40d8 100644 --- a/test/content_type/tc_override.rb +++ b/test/content_type/tc_override.rb @@ -1,11 +1,11 @@ require 'tc_helper.rb' class TestOverride < Test::Unit::TestCase def test_content_type_restriction - assert_raise(ArgumentError, "requires known content type") { Axlsx::Override.new :ContentType=>"asdf" } + assert_raise(ArgumentError, "requires known content type") { Axlsx::Override.new :ContentType => "asdf" } end def test_to_xml - type = Axlsx::Override.new :PartName=>"somechart.xml", :ContentType=>Axlsx::CHART_CT + type = Axlsx::Override.new :PartName => "somechart.xml", :ContentType => Axlsx::CHART_CT doc = Nokogiri::XML(type.to_xml_string) assert_equal(doc.xpath("Override[@ContentType='#{Axlsx::CHART_CT}']").size, 1) assert_equal(doc.xpath("Override[@PartName='somechart.xml']").size, 1) diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb index 7718a6c2..a7124be1 100644 --- a/test/doc_props/tc_app.rb +++ b/test/doc_props/tc_app.rb @@ -38,6 +38,6 @@ class TestApp < Test::Unit::TestCase schema.validate(doc).each do |error| errors << error end - assert_equal(errors.size, 0, "app.xml invalid" + errors.map{ |e| e.message }.to_s) + assert_equal(errors.size, 0, "app.xml invalid" + errors.map { |e| e.message }.to_s) end end diff --git a/test/doc_props/tc_core.rb b/test/doc_props/tc_core.rb index 6ba01b5f..b225266a 100644 --- a/test/doc_props/tc_core.rb +++ b/test/doc_props/tc_core.rb @@ -15,7 +15,7 @@ class TestCore < Test::Unit::TestCase puts error.message errors << error end - assert_equal(errors.size, 0, "core.xml Invalid" + errors.map{ |e| e.message }.to_s) + assert_equal(errors.size, 0, "core.xml Invalid" + errors.map { |e| e.message }.to_s) end def test_populates_created diff --git a/test/drawing/tc_area_series.rb b/test/drawing/tc_area_series.rb index efe48256..250c6e13 100644 --- a/test/drawing/tc_area_series.rb +++ b/test/drawing/tc_area_series.rb @@ -3,10 +3,10 @@ require 'tc_helper.rb' class TestAreaSeries < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" chart = @ws.add_chart Axlsx::AreaChart, :title => "fishery" @series = chart.add_series( - :data => [0,1,2], + :data => [0, 1, 2], :labels => ["zero", "one", "two"], :title => "bob", :color => "#FF0000", diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb index b8be916b..52a066be 100644 --- a/test/drawing/tc_axis.rb +++ b/test/drawing/tc_axis.rb @@ -17,7 +17,7 @@ class TestAxis < Test::Unit::TestCase def test_color @axis.color = "00FF00" @axis.cross_axis = Axlsx::CatAxis.new - str = '' + str = '' str << '' doc = Nokogiri::XML(@axis.to_xml_string(str)) assert(doc.xpath("//a:srgbClr[@val='00FF00']")) @@ -25,7 +25,7 @@ class TestAxis < Test::Unit::TestCase def test_cell_based_axis_title p = Axlsx::Package.new - p.workbook.add_worksheet(:name=>'foosheet') do |sheet| + p.workbook.add_worksheet(:name => 'foosheet') do |sheet| sheet.add_row ['battle victories'] sheet.add_row ['bird', 1, 2, 1] sheet.add_row ['cat', 7, 9, 10] @@ -60,11 +60,11 @@ class TestAxis < Test::Unit::TestCase assert_nothing_raised("accepts valid format code") { @axis.format_code = "00.##" } end - def create_chart_with_formatting(format_string=nil) + def create_chart_with_formatting(format_string = nil) p = Axlsx::Package.new p.workbook.add_worksheet(:name => "Formatting Test") do |sheet| sheet.add_row(['test', 20]) - sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,5], :end_at => [10, 20], :title => "Test Formatting") do |chart| + sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0, 5], :end_at => [10, 20], :title => "Test Formatting") do |chart| chart.add_series :data => sheet["B1:B1"], :labels => sheet["A1:A1"] chart.val_axis.format_code = format_string if format_string doc = Nokogiri::XML(chart.to_xml_string) @@ -99,7 +99,7 @@ class TestAxis < Test::Unit::TestCase def test_to_xml_string @axis.cross_axis = Axlsx::CatAxis.new - str = '' + str = '' str << '' doc = Nokogiri::XML(@axis.to_xml_string(str)) assert(doc.xpath('//a:noFill')) diff --git a/test/drawing/tc_bar_series.rb b/test/drawing/tc_bar_series.rb index 81b88683..39d39b96 100644 --- a/test/drawing/tc_bar_series.rb +++ b/test/drawing/tc_bar_series.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestBarSeries < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" @chart = @ws.add_chart Axlsx::Bar3DChart, :title => "fishery" @series = @chart.add_series( data: [0, 1, 2], @@ -37,8 +37,8 @@ class TestBarSeries < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML(@chart.to_xml_string) @series.colors.each_with_index do |color, index| - assert_equal(doc.xpath("//c:dPt/c:idx[@val='#{index}']").size,1) - assert_equal(doc.xpath("//c:dPt/c:spPr/a:solidFill/a:srgbClr[@val='#{@series.colors[index]}']").size,1) + assert_equal(doc.xpath("//c:dPt/c:idx[@val='#{index}']").size, 1) + assert_equal(doc.xpath("//c:dPt/c:spPr/a:solidFill/a:srgbClr[@val='#{@series.colors[index]}']").size, 1) end assert_equal(doc.xpath('//c:spPr[not(ancestor::c:dPt)]/a:solidFill/a:srgbClr').first.get_attribute('val'), '5A5A5A', 'series color has been applied') end diff --git a/test/drawing/tc_bubble_series.rb b/test/drawing/tc_bubble_series.rb index a784619f..af051d11 100644 --- a/test/drawing/tc_bubble_series.rb +++ b/test/drawing/tc_bubble_series.rb @@ -3,9 +3,9 @@ require 'tc_helper.rb' class TestBubbleSeries < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" @chart = @ws.add_chart Axlsx::BubbleChart, :title => "Bubble Chart" - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :bubbleSize=>[1,5,7], :title=>"GDP", :color => 'FF0000' + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :bubbleSize => [1, 5, 7], :title => "GDP", :color => 'FF0000' end def test_initialize @@ -14,6 +14,6 @@ class TestBubbleSeries < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML(@chart.to_xml_string) - assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size,2) + assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size, 2) end end diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb index c322b37a..4f60db17 100644 --- a/test/drawing/tc_chart.rb +++ b/test/drawing/tc_chart.rb @@ -14,7 +14,7 @@ class TestChart < Test::Unit::TestCase end def test_initialization - assert_equal(@p.workbook.charts.last,@chart, "the chart is in the workbook") + assert_equal(@p.workbook.charts.last, @chart, "the chart is in the workbook") assert_equal(@chart.title.text, "fishery", "the title option has been applied") assert((@chart.series.is_a?(Axlsx::SimpleTypedList) && @chart.series.empty?), "The series is initialized and empty") end @@ -75,7 +75,7 @@ class TestChart < Test::Unit::TestCase @chart.start_at @row.cells.first assert_equal(@chart.graphic_frame.anchor.from.col, 0) assert_equal(@chart.graphic_frame.anchor.from.row, 0) - @chart.start_at [5,6] + @chart.start_at [5, 6] assert_equal(@chart.graphic_frame.anchor.from.col, 5) assert_equal(@chart.graphic_frame.anchor.from.row, 6) end @@ -87,13 +87,13 @@ class TestChart < Test::Unit::TestCase @chart.end_at @row.cells.last assert_equal(@chart.graphic_frame.anchor.to.col, 2) assert_equal(@chart.graphic_frame.anchor.to.row, 0) - @chart.end_at [10,11] + @chart.end_at [10, 11] assert_equal(@chart.graphic_frame.anchor.to.col, 10) assert_equal(@chart.graphic_frame.anchor.to.row, 11) end def test_add_series - s = @chart.add_series :data=>[0,1,2,3], :labels => ["one", 1, "anything"], :title=>"bob" + s = @chart.add_series :data => [0, 1, 2, 3], :labels => ["one", 1, "anything"], :title => "bob" assert_equal(@chart.series.last, s, "series has been added to chart series collection") assert_equal(s.title.text, "bob", "series title has been applied") end diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb index ce71a00f..cc96299d 100644 --- a/test/drawing/tc_d_lbls.rb +++ b/test/drawing/tc_d_lbls.rb @@ -3,13 +3,13 @@ require 'tc_helper' class TestDLbls < Test::Unit::TestCase def setup @d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart) - @boolean_attributes =[:show_legend_key, - :show_val, - :show_cat_name, - :show_ser_name, - :show_percent, - :show_bubble_size, - :show_leader_lines] + @boolean_attributes = [:show_legend_key, + :show_val, + :show_cat_name, + :show_ser_name, + :show_percent, + :show_bubble_size, + :show_leader_lines] end def test_initialization @@ -22,7 +22,7 @@ class TestDLbls < Test::Unit::TestCase def test_initialization_with_optoins options_hash = Hash[*[@boolean_attributes.map { |name| [name, true] }]] - d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge( { :d_lbl_pos => :t })) + d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge({ :d_lbl_pos => :t })) @boolean_attributes.each do |attr| assert_equal(true, d_lbls.send(attr), "boolean attributes set by options") diff --git a/test/drawing/tc_drawing.rb b/test/drawing/tc_drawing.rb index 04b6ead6..c5fc98e1 100644 --- a/test/drawing/tc_drawing.rb +++ b/test/drawing/tc_drawing.rb @@ -11,19 +11,19 @@ class TestDrawing < Test::Unit::TestCase end def test_add_chart - chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1]) + chart = @ws.add_chart(Axlsx::Pie3DChart, :title => "bob", :start_at => [0, 0], :end_at => [1, 1]) assert(chart.is_a?(Axlsx::Pie3DChart), "must create a chart") assert_equal(@ws.workbook.charts.last, chart, "must be added to workbook charts collection") assert_equal(@ws.drawing.anchors.last.object.chart, chart, "an anchor has been created and holds a reference to this chart") anchor = @ws.drawing.anchors.last - assert_equal([anchor.from.row, anchor.from.col], [0,0], "options for start at are applied") - assert_equal([anchor.to.row, anchor.to.col], [1,1], "options for start at are applied") + assert_equal([anchor.from.row, anchor.from.col], [0, 0], "options for start at are applied") + assert_equal([anchor.to.row, anchor.to.col], [1, 1], "options for start at are applied") assert_equal(chart.title.text, "bob", "option for title is applied") end def test_add_image src = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" - image = @ws.add_image(:image_src => src, :start_at=>[0,0], :width=>600, :height=>400) + image = @ws.add_image(:image_src => src, :start_at => [0, 0], :width => 600, :height => 400) assert(@ws.drawing.anchors.last.is_a?(Axlsx::OneCellAnchor)) assert(image.is_a?(Axlsx::Pic)) assert_equal(600, image.width) @@ -32,15 +32,15 @@ class TestDrawing < Test::Unit::TestCase def test_add_two_cell_anchor_image src = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" - image = @ws.add_image(:image_src => src, :start_at=>[0,0], :end_at => [15,0]) + image = @ws.add_image(:image_src => src, :start_at => [0, 0], :end_at => [15, 0]) assert(@ws.drawing.anchors.last.is_a?(Axlsx::TwoCellAnchor)) assert(image.is_a?(Axlsx::Pic)) end def test_charts - chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1]) + chart = @ws.add_chart(Axlsx::Pie3DChart, :title => "bob", :start_at => [0, 0], :end_at => [1, 1]) assert_equal(@ws.drawing.charts.last, chart, "add chart is returned") - chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10]) + chart = @ws.add_chart(Axlsx::Pie3DChart, :title => "nancy", :start_at => [1, 5], :end_at => [5, 10]) assert_equal(@ws.drawing.charts.last, chart, "add chart is returned") end @@ -60,9 +60,9 @@ class TestDrawing < Test::Unit::TestCase end def test_relationships - @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1]) + @ws.add_chart(Axlsx::Pie3DChart, :title => "bob", :start_at => [0, 0], :end_at => [1, 1]) assert_equal(@ws.drawing.relationships.size, 1, "adding a chart adds a relationship") - @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10]) + @ws.add_chart(Axlsx::Pie3DChart, :title => "nancy", :start_at => [1, 5], :end_at => [5, 10]) assert_equal(@ws.drawing.relationships.size, 2, "adding a chart adds a relationship") end diff --git a/test/drawing/tc_hyperlink.rb b/test/drawing/tc_hyperlink.rb index ad8299b7..f9deb5b8 100644 --- a/test/drawing/tc_hyperlink.rb +++ b/test/drawing/tc_hyperlink.rb @@ -4,7 +4,7 @@ class TestHyperlink < Test::Unit::TestCase def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet - @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" + @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" @image = ws.add_image :image_src => @test_img, :hyperlink => "http://axlsx.blogspot.com" @hyperlink = @image.hyperlink end @@ -39,20 +39,20 @@ class TestHyperlink < Test::Unit::TestCase def test_endSnd assert_nothing_raised { @hyperlink.endSnd = "true" } - assert_raise(ArgumentError) {@hyperlink.endSnd = "bob"} + assert_raise(ArgumentError) { @hyperlink.endSnd = "bob" } assert_equal(@hyperlink.endSnd, "true") end def test_highlightClick assert_nothing_raised { @hyperlink.highlightClick = false } - assert_raise(ArgumentError) {@hyperlink.highlightClick = "bob"} - assert_equal(@hyperlink.highlightClick, false ) + assert_raise(ArgumentError) { @hyperlink.highlightClick = "bob" } + assert_equal(@hyperlink.highlightClick, false) end def test_history assert_nothing_raised { @hyperlink.history = false } - assert_raise(ArgumentError) {@hyperlink.history = "bob"} - assert_equal(@hyperlink.history, false ) + assert_raise(ArgumentError) { @hyperlink.history = "bob" } + assert_equal(@hyperlink.history, false) end def test_to_xml_string diff --git a/test/drawing/tc_line_series.rb b/test/drawing/tc_line_series.rb index 1327a48f..80643c4e 100644 --- a/test/drawing/tc_line_series.rb +++ b/test/drawing/tc_line_series.rb @@ -3,10 +3,10 @@ require 'tc_helper.rb' class TestLineSeries < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" chart = @ws.add_chart Axlsx::Line3DChart, :title => "fishery" @series = chart.add_series( - :data => [0,1,2], + :data => [0, 1, 2], :labels => ["zero", "one", "two"], :title => "bob", :color => "#FF0000", diff --git a/test/drawing/tc_marker.rb b/test/drawing/tc_marker.rb index fdc6d5a1..ccfb76fe 100644 --- a/test/drawing/tc_marker.rb +++ b/test/drawing/tc_marker.rb @@ -16,23 +16,23 @@ class TestMarker < Test::Unit::TestCase end def test_col - assert_raise(ArgumentError) { @marker.col = -1} - assert_nothing_raised {@marker.col = 10} + assert_raise(ArgumentError) { @marker.col = -1 } + assert_nothing_raised { @marker.col = 10 } end def test_colOff - assert_raise(ArgumentError) { @marker.colOff = "1"} - assert_nothing_raised {@marker.colOff = -10} + assert_raise(ArgumentError) { @marker.colOff = "1" } + assert_nothing_raised { @marker.colOff = -10 } end def test_row - assert_raise(ArgumentError) { @marker.row = -1} - assert_nothing_raised {@marker.row = 10} + assert_raise(ArgumentError) { @marker.row = -1 } + assert_nothing_raised { @marker.row = 10 } end def test_rowOff - assert_raise(ArgumentError) { @marker.rowOff = "1"} - assert_nothing_raised {@marker.rowOff = -10} + assert_raise(ArgumentError) { @marker.rowOff = "1" } + assert_nothing_raised { @marker.rowOff = -10 } end def test_coord diff --git a/test/drawing/tc_num_data.rb b/test/drawing/tc_num_data.rb index fc5fabee..7e7e12e3 100644 --- a/test/drawing/tc_num_data.rb +++ b/test/drawing/tc_num_data.rb @@ -13,8 +13,8 @@ class TestNumData < Test::Unit::TestCase end def test_format_code - assert_raise(ArgumentError) {@num_data.format_code = 7} - assert_nothing_raised {@num_data.format_code = 'foo_bar'} + assert_raise(ArgumentError) { @num_data.format_code = 7 } + assert_nothing_raised { @num_data.format_code = 'foo_bar' } end def test_to_xml_string diff --git a/test/drawing/tc_num_val.rb b/test/drawing/tc_num_val.rb index 9722b434..2123ea92 100644 --- a/test/drawing/tc_num_val.rb +++ b/test/drawing/tc_num_val.rb @@ -11,8 +11,8 @@ class TestNumVal < Test::Unit::TestCase end def test_format_code - assert_raise(ArgumentError) {@num_val.format_code = 7} - assert_nothing_raised {@num_val.format_code = 'foo_bar'} + assert_raise(ArgumentError) { @num_val.format_code = 7 } + assert_nothing_raised { @num_val.format_code = 'foo_bar' } end def test_to_xml_string diff --git a/test/drawing/tc_one_cell_anchor.rb b/test/drawing/tc_one_cell_anchor.rb index f9a04492..1b18f12e 100644 --- a/test/drawing/tc_one_cell_anchor.rb +++ b/test/drawing/tc_one_cell_anchor.rb @@ -4,7 +4,7 @@ class TestOneCellAnchor < Test::Unit::TestCase def setup @p = Axlsx::Package.new @ws = @p.workbook.add_worksheet - @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" + @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" @image = @ws.add_image :image_src => @test_img @anchor = @image.anchor end @@ -50,8 +50,8 @@ class TestOneCellAnchor < Test::Unit::TestCase end def test_options - assert_raise(ArgumentError, 'invalid start_at') { @ws.add_image :image_src=>@test_img, :start_at=>[1] } - i = @ws.add_image :image_src=>@test_img, :start_at => [1,2], :width=>100, :height=>200, :name=>"someimage", :descr=>"a neat image" + assert_raise(ArgumentError, 'invalid start_at') { @ws.add_image :image_src => @test_img, :start_at => [1] } + i = @ws.add_image :image_src => @test_img, :start_at => [1, 2], :width => 100, :height => 200, :name => "someimage", :descr => "a neat image" assert_equal("a neat image", i.descr) assert_equal("someimage", i.name) diff --git a/test/drawing/tc_pic.rb b/test/drawing/tc_pic.rb index bb81fc00..6760fa58 100644 --- a/test/drawing/tc_pic.rb +++ b/test/drawing/tc_pic.rb @@ -4,10 +4,10 @@ class TestPic < Test::Unit::TestCase def setup @p = Axlsx::Package.new ws = @p.workbook.add_worksheet - @test_img = @test_img_jpg = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" + @test_img = @test_img_jpg = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" @test_img_png = File.dirname(__FILE__) + "/../fixtures/image1.png" @test_img_gif = File.dirname(__FILE__) + "/../fixtures/image1.gif" - @test_img_fake = File.dirname(__FILE__) + "/../fixtures/image1_fake.jpg" + @test_img_fake = File.dirname(__FILE__) + "/../fixtures/image1_fake.jpg" @image = ws.add_image :image_src => @test_img, :hyperlink => 'https://github.com/randym', :tooltip => "What's up doc?", :opacity => 5 end @@ -21,11 +21,11 @@ class TestPic < Test::Unit::TestCase #swap from one cell to two cell when end_at is specified assert(@image.anchor.is_a?(Axlsx::OneCellAnchor)) start_at = @image.anchor.from - @image.end_at 10,5 + @image.end_at 10, 5 assert(@image.anchor.is_a?(Axlsx::TwoCellAnchor)) assert_equal(start_at.col, @image.anchor.from.col) assert_equal(start_at.row, @image.anchor.from.row) - assert_equal(10,@image.anchor.to.col) + assert_equal(10, @image.anchor.to.col) assert_equal(5, @image.anchor.to.row) #swap from two cell to one cell when width or height are specified diff --git a/test/drawing/tc_picture_locking.rb b/test/drawing/tc_picture_locking.rb index 7347a571..6e5de47b 100644 --- a/test/drawing/tc_picture_locking.rb +++ b/test/drawing/tc_picture_locking.rb @@ -16,54 +16,54 @@ class TestPictureLocking < Test::Unit::TestCase def test_noGrp assert_raise(ArgumentError) { @item.noGrp = -1 } assert_nothing_raised { @item.noGrp = false } - assert_equal(@item.noGrp, false ) + assert_equal(@item.noGrp, false) end def test_noRot assert_raise(ArgumentError) { @item.noRot = -1 } assert_nothing_raised { @item.noRot = false } - assert_equal(@item.noRot, false ) + assert_equal(@item.noRot, false) end def test_noChangeAspect assert_raise(ArgumentError) { @item.noChangeAspect = -1 } assert_nothing_raised { @item.noChangeAspect = false } - assert_equal(@item.noChangeAspect, false ) + assert_equal(@item.noChangeAspect, false) end def test_noMove assert_raise(ArgumentError) { @item.noMove = -1 } assert_nothing_raised { @item.noMove = false } - assert_equal(@item.noMove, false ) + assert_equal(@item.noMove, false) end def test_noResize assert_raise(ArgumentError) { @item.noResize = -1 } assert_nothing_raised { @item.noResize = false } - assert_equal(@item.noResize, false ) + assert_equal(@item.noResize, false) end def test_noEditPoints assert_raise(ArgumentError) { @item.noEditPoints = -1 } assert_nothing_raised { @item.noEditPoints = false } - assert_equal(@item.noEditPoints, false ) + assert_equal(@item.noEditPoints, false) end def test_noAdjustHandles assert_raise(ArgumentError) { @item.noAdjustHandles = -1 } assert_nothing_raised { @item.noAdjustHandles = false } - assert_equal(@item.noAdjustHandles, false ) + assert_equal(@item.noAdjustHandles, false) end def test_noChangeArrowheads assert_raise(ArgumentError) { @item.noChangeArrowheads = -1 } assert_nothing_raised { @item.noChangeArrowheads = false } - assert_equal(@item.noChangeArrowheads, false ) + assert_equal(@item.noChangeArrowheads, false) end def test_noChangeShapeType assert_raise(ArgumentError) { @item.noChangeShapeType = -1 } assert_nothing_raised { @item.noChangeShapeType = false } - assert_equal(@item.noChangeShapeType, false ) + assert_equal(@item.noChangeShapeType, false) end end diff --git a/test/drawing/tc_pie_3D_chart.rb b/test/drawing/tc_pie_3D_chart.rb index 6eb0dfe5..f536f086 100644 --- a/test/drawing/tc_pie_3D_chart.rb +++ b/test/drawing/tc_pie_3D_chart.rb @@ -20,7 +20,7 @@ class TestPie3DChart < Test::Unit::TestCase def test_to_xml schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD)) doc = Nokogiri::XML(@chart.to_xml_string) - errors = schema.validate(doc).map {|error| puts error.message; error } + errors = schema.validate(doc).map { |error| puts error.message; error } assert(errors.empty?, "error free validation") end end diff --git a/test/drawing/tc_pie_series.rb b/test/drawing/tc_pie_series.rb index 7ab81f46..ce516f83 100644 --- a/test/drawing/tc_pie_series.rb +++ b/test/drawing/tc_pie_series.rb @@ -3,9 +3,9 @@ require 'tc_helper.rb' class TestPieSeries < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" chart = @ws.add_chart Axlsx::Pie3DChart, :title => "fishery" - @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :colors => ["FF0000", "00FF00", "0000FF"] + @series = chart.add_series :data => [0, 1, 2], :labels => ["zero", "one", "two"], :title => "bob", :colors => ["FF0000", "00FF00", "0000FF"] end def test_initialize diff --git a/test/drawing/tc_scaling.rb b/test/drawing/tc_scaling.rb index 909dded5..8f92a024 100644 --- a/test/drawing/tc_scaling.rb +++ b/test/drawing/tc_scaling.rb @@ -13,22 +13,22 @@ class TestScaling < Test::Unit::TestCase end def test_logBase - assert_raise(ArgumentError) { @scaling.logBase = 1} - assert_nothing_raised {@scaling.logBase = 10} + assert_raise(ArgumentError) { @scaling.logBase = 1 } + assert_nothing_raised { @scaling.logBase = 10 } end def test_orientation - assert_raise(ArgumentError) { @scaling.orientation = "1"} - assert_nothing_raised {@scaling.orientation = :maxMin} + assert_raise(ArgumentError) { @scaling.orientation = "1" } + assert_nothing_raised { @scaling.orientation = :maxMin } end def test_max - assert_raise(ArgumentError) { @scaling.max = 1} - assert_nothing_raised {@scaling.max = 10.5} + assert_raise(ArgumentError) { @scaling.max = 1 } + assert_nothing_raised { @scaling.max = 10.5 } end def test_min - assert_raise(ArgumentError) { @scaling.min = 1} - assert_nothing_raised {@scaling.min = 10.5} + assert_raise(ArgumentError) { @scaling.min = 1 } + assert_nothing_raised { @scaling.min = 10.5 } end end diff --git a/test/drawing/tc_scatter_series.rb b/test/drawing/tc_scatter_series.rb index fb30dd70..5ca126a2 100644 --- a/test/drawing/tc_scatter_series.rb +++ b/test/drawing/tc_scatter_series.rb @@ -3,9 +3,9 @@ require 'tc_helper.rb' class TestScatterSeries < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Scatter Chart" - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"exponents", :color => 'FF0000', :smooth => true + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "exponents", :color => 'FF0000', :smooth => true end def test_initialize @@ -14,31 +14,31 @@ class TestScatterSeries < Test::Unit::TestCase def test_smoothed_chart_default_smoothing @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Smooth Chart", :scatter_style => :smoothMarker - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents" + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "smoothed exponents" assert(@series.smooth, "series is smooth by default on smooth charts") end def test_unsmoothed_chart_default_smoothing @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart", :scatter_style => :line - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents" + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "unsmoothed exponents" assert(!@series.smooth, "series is not smooth by default on non-smooth charts") end def test_explicit_smoothing @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart, Smooth Series", :scatter_style => :line - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents", :smooth => true + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "smoothed exponents", :smooth => true assert(@series.smooth, "series is smooth when overriding chart default") end def test_explicit_unsmoothing @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Smooth Chart, Unsmooth Series", :scatter_style => :smoothMarker - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents", :smooth => false + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "unsmoothed exponents", :smooth => false assert(!@series.smooth, "series is not smooth when overriding chart default") end def test_ln_width @chart = @ws.add_chart Axlsx::ScatterChart, :title => "ln width", :scatter_style => :line - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"ln_width" + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "ln_width" @series.ln_width = 12700 assert_equal(@series.ln_width, 12700, 'line width assigment is allowed') end @@ -48,25 +48,25 @@ class TestScatterSeries < Test::Unit::TestCase @series.ln_width = 12700 doc = Nokogiri::XML(@chart.to_xml_string) assert_equal(12700, @series.ln_width) - assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size,4) + assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size, 4) assert_equal(doc.xpath("//a:ln[@w='#{@series.ln_width}']").length, 1) end def test_false_show_marker @chart = @ws.add_chart Axlsx::ScatterChart, :title => 'Smooth Chart', :scatter_style => :smoothMarker - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9] + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9] assert(@series.show_marker, 'markers are enabled for marker-related styles') end def test_true_show_marker @chart = @ws.add_chart Axlsx::ScatterChart, :title => 'Line chart', :scatter_style => :line - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9] + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9] assert(!@series.show_marker, 'markers are disabled for markerless scatter styles') end def test_marker_symbol @chart = @ws.add_chart Axlsx::ScatterChart, :title => 'Line chart', :scatter_style => :line - @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :marker_symbol => :diamond + @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :marker_symbol => :diamond assert_equal(@series.marker_symbol, :diamond, 'series could have own custom marker symbol') end end diff --git a/test/drawing/tc_series.rb b/test/drawing/tc_series.rb index fc4d97e3..80f4b7cb 100644 --- a/test/drawing/tc_series.rb +++ b/test/drawing/tc_series.rb @@ -3,9 +3,9 @@ require 'tc_helper.rb' class TestSeries < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" chart = @ws.add_chart Axlsx::Chart, :title => "fishery" - @series = chart.add_series :title=>"bob" + @series = chart.add_series :title => "bob" end def test_initialize diff --git a/test/drawing/tc_two_cell_anchor.rb b/test/drawing/tc_two_cell_anchor.rb index 2c0f32bd..f2067c23 100644 --- a/test/drawing/tc_two_cell_anchor.rb +++ b/test/drawing/tc_two_cell_anchor.rb @@ -21,8 +21,8 @@ class TestTwoCellAnchor < Test::Unit::TestCase end def test_options - assert_raise(ArgumentError, 'invalid start_at') { @ws.add_chart Axlsx::Chart, :start_at=>"1" } - assert_raise(ArgumentError, 'invalid end_at') { @ws.add_chart Axlsx::Chart, :start_at=>[1,2], :end_at => ["a", 4] } + assert_raise(ArgumentError, 'invalid start_at') { @ws.add_chart Axlsx::Chart, :start_at => "1" } + assert_raise(ArgumentError, 'invalid end_at') { @ws.add_chart Axlsx::Chart, :start_at => [1, 2], :end_at => ["a", 4] } # this is actually raised in the graphic frame assert_raise(ArgumentError, 'invalid Chart') { @ws.add_chart Axlsx::TwoCellAnchor } a = @ws.add_chart Axlsx::Chart, :start_at => [15, 35], :end_at => [90, 45] diff --git a/test/drawing/tc_view_3D.rb b/test/drawing/tc_view_3D.rb index 6202d851..9aceb542 100644 --- a/test/drawing/tc_view_3D.rb +++ b/test/drawing/tc_view_3D.rb @@ -19,32 +19,32 @@ class TestView3D < Test::Unit::TestCase end def test_rot_x - assert_raise(ArgumentError) {@view.rot_x = "bob"} - assert_nothing_raised {@view.rot_x = -90} + assert_raise(ArgumentError) { @view.rot_x = "bob" } + assert_nothing_raised { @view.rot_x = -90 } end def test_rot_y - assert_raise(ArgumentError) {@view.rot_y = "bob"} - assert_nothing_raised {@view.rot_y = 90} + assert_raise(ArgumentError) { @view.rot_y = "bob" } + assert_nothing_raised { @view.rot_y = 90 } end def test_h_percent - assert_raise(ArgumentError) {@view.h_percent = "bob"} - assert_nothing_raised {@view.h_percent = "500%"} + assert_raise(ArgumentError) { @view.h_percent = "bob" } + assert_nothing_raised { @view.h_percent = "500%" } end def test_depth_percent - assert_raise(ArgumentError) {@view.depth_percent = "bob"} - assert_nothing_raised {@view.depth_percent = "20%"} + assert_raise(ArgumentError) { @view.depth_percent = "bob" } + assert_nothing_raised { @view.depth_percent = "20%" } end def test_rAngAx - assert_raise(ArgumentError) {@view.rAngAx = "bob"} - assert_nothing_raised {@view.rAngAx = true} + assert_raise(ArgumentError) { @view.rAngAx = "bob" } + assert_nothing_raised { @view.rAngAx = true } end def test_perspective - assert_raise(ArgumentError) {@view.perspective = "bob"} - assert_nothing_raised {@view.perspective = 30} + assert_raise(ArgumentError) { @view.perspective = "bob" } + assert_nothing_raised { @view.perspective = 30 } end end diff --git a/test/drawing/tc_vml_drawing.rb b/test/drawing/tc_vml_drawing.rb index 792384e9..debba561 100644 --- a/test/drawing/tc_vml_drawing.rb +++ b/test/drawing/tc_vml_drawing.rb @@ -18,6 +18,6 @@ class TestVmlDrawing < Test::Unit::TestCase str = @vml_drawing.to_xml_string() doc = Nokogiri::XML(str) assert_equal(doc.xpath("//v:shape").size, 2) - assert(doc.xpath("//o:idmap[@o:data='#{@ws.index+1}']")) + assert(doc.xpath("//o:idmap[@o:data='#{@ws.index + 1}']")) end end diff --git a/test/profile.rb b/test/profile.rb index de00b32b..4805dad8 100644 --- a/test/profile.rb +++ b/test/profile.rb @@ -8,7 +8,7 @@ require 'ruby-prof' row = [] # Taking worst case scenario of all string data input = (32..126).to_a.pack('U*').chars.to_a -20.times { row << input.shuffle.join} +20.times { row << input.shuffle.join } profile = RubyProf.profile do p = Axlsx::Package.new diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb index afdf5d1f..1a9df27a 100644 --- a/test/rels/tc_relationship.rb +++ b/test/rels/tc_relationship.rb @@ -40,7 +40,7 @@ class TestRelationships < Test::Unit::TestCase def test_target_mode assert_raise(ArgumentError) { Axlsx::Relationship.new nil, 'type', 'target', :target_mode => "FISH" } - assert_nothing_raised { Axlsx::Relationship.new( nil, Axlsx::WORKSHEET_R, 'target', :target_mode => :External) } + assert_nothing_raised { Axlsx::Relationship.new(nil, Axlsx::WORKSHEET_R, 'target', :target_mode => :External) } end def test_ampersand_escaping_in_target diff --git a/test/stylesheet/tc_border.rb b/test/stylesheet/tc_border.rb index c2fb0d98..9e29dda4 100644 --- a/test/stylesheet/tc_border.rb +++ b/test/stylesheet/tc_border.rb @@ -18,22 +18,22 @@ class TestBorder < Test::Unit::TestCase def test_diagonalUp assert_raise(ArgumentError) { @b.diagonalUp = :red } assert_nothing_raised { @b.diagonalUp = true } - assert_equal(@b.diagonalUp, true ) + assert_equal(@b.diagonalUp, true) end def test_diagonalDown assert_raise(ArgumentError) { @b.diagonalDown = :red } assert_nothing_raised { @b.diagonalDown = true } - assert_equal(@b.diagonalDown, true ) + assert_equal(@b.diagonalDown, true) end def test_outline assert_raise(ArgumentError) { @b.outline = :red } assert_nothing_raised { @b.outline = true } - assert_equal(@b.outline, true ) + assert_equal(@b.outline, true) end def test_prs - assert_nothing_raised { @b.prs << Axlsx::BorderPr.new(:name=>:top, :style=>:thin, :color => Axlsx::Color.new(:rgb=>"FF0000FF")) } + assert_nothing_raised { @b.prs << Axlsx::BorderPr.new(:name => :top, :style => :thin, :color => Axlsx::Color.new(:rgb => "FF0000FF")) } end end diff --git a/test/stylesheet/tc_border_pr.rb b/test/stylesheet/tc_border_pr.rb index 1e1c1dcc..3b25575b 100644 --- a/test/stylesheet/tc_border_pr.rb +++ b/test/stylesheet/tc_border_pr.rb @@ -16,7 +16,7 @@ class TestBorderPr < Test::Unit::TestCase def test_color assert_raise(ArgumentError) { @bpr.color = :red } - assert_nothing_raised { @bpr.color = Axlsx::Color.new :rgb=>"FF000000" } + assert_nothing_raised { @bpr.color = Axlsx::Color.new :rgb => "FF000000" } assert(@bpr.color.is_a?(Axlsx::Color)) end diff --git a/test/stylesheet/tc_cell_alignment.rb b/test/stylesheet/tc_cell_alignment.rb index a61d764f..fe2e9fe4 100644 --- a/test/stylesheet/tc_cell_alignment.rb +++ b/test/stylesheet/tc_cell_alignment.rb @@ -15,66 +15,66 @@ class TestCellAlignment < Test::Unit::TestCase assert_equal(@item.justifyLastLine, nil) assert_equal(@item.shrinkToFit, nil) assert_equal(@item.readingOrder, nil) - options = { :horizontal => :left, :vertical => :top, :textRotation => 3, + options = { :horizontal => :left, :vertical => :top, :textRotation => 3, :wrapText => true, :indent => 2, :relativeIndent => 5, :justifyLastLine => true, :shrinkToFit => true, :readingOrder => 2 } ca = Axlsx::CellAlignment.new options options.each do |key, value| - assert_equal(ca.send(key.to_sym),value) + assert_equal(ca.send(key.to_sym), value) end end def test_horizontal assert_raise(ArgumentError) { @item.horizontal = :red } assert_nothing_raised { @item.horizontal = :left } - assert_equal(@item.horizontal, :left ) + assert_equal(@item.horizontal, :left) end def test_vertical assert_raise(ArgumentError) { @item.vertical = :red } assert_nothing_raised { @item.vertical = :top } - assert_equal(@item.vertical, :top ) + assert_equal(@item.vertical, :top) end def test_textRotation assert_raise(ArgumentError) { @item.textRotation = -1 } assert_nothing_raised { @item.textRotation = 5 } - assert_equal(@item.textRotation, 5 ) + assert_equal(@item.textRotation, 5) end def test_wrapText assert_raise(ArgumentError) { @item.wrapText = -1 } assert_nothing_raised { @item.wrapText = false } - assert_equal(@item.wrapText, false ) + assert_equal(@item.wrapText, false) end def test_indent assert_raise(ArgumentError) { @item.indent = -1 } assert_nothing_raised { @item.indent = 5 } - assert_equal(@item.indent, 5 ) + assert_equal(@item.indent, 5) end def test_relativeIndent assert_raise(ArgumentError) { @item.relativeIndent = :symbol } assert_nothing_raised { @item.relativeIndent = 5 } - assert_equal(@item.relativeIndent, 5 ) + assert_equal(@item.relativeIndent, 5) end def test_justifyLastLine assert_raise(ArgumentError) { @item.justifyLastLine = -1 } assert_nothing_raised { @item.justifyLastLine = true } - assert_equal(@item.justifyLastLine, true ) + assert_equal(@item.justifyLastLine, true) end def test_shrinkToFit assert_raise(ArgumentError) { @item.shrinkToFit = -1 } assert_nothing_raised { @item.shrinkToFit = true } - assert_equal(@item.shrinkToFit, true ) + assert_equal(@item.shrinkToFit, true) end def test_readingOrder assert_raise(ArgumentError) { @item.readingOrder = -1 } assert_nothing_raised { @item.readingOrder = 2 } - assert_equal(@item.readingOrder, 2 ) + assert_equal(@item.readingOrder, 2) end end diff --git a/test/stylesheet/tc_cell_protection.rb b/test/stylesheet/tc_cell_protection.rb index a9648745..a1fc59b2 100644 --- a/test/stylesheet/tc_cell_protection.rb +++ b/test/stylesheet/tc_cell_protection.rb @@ -16,12 +16,12 @@ class TestCellProtection < Test::Unit::TestCase def test_hidden assert_raise(ArgumentError) { @item.hidden = -1 } assert_nothing_raised { @item.hidden = false } - assert_equal(@item.hidden, false ) + assert_equal(@item.hidden, false) end def test_locked assert_raise(ArgumentError) { @item.locked = -1 } assert_nothing_raised { @item.locked = false } - assert_equal(@item.locked, false ) + assert_equal(@item.locked, false) end end diff --git a/test/stylesheet/tc_cell_style.rb b/test/stylesheet/tc_cell_style.rb index 5e71a698..18e7a1ab 100644 --- a/test/stylesheet/tc_cell_style.rb +++ b/test/stylesheet/tc_cell_style.rb @@ -20,36 +20,36 @@ class TestCellStyle < Test::Unit::TestCase def test_name assert_raise(ArgumentError) { @item.name = -1 } assert_nothing_raised { @item.name = "stylin" } - assert_equal(@item.name, "stylin" ) + assert_equal(@item.name, "stylin") end def test_xfId assert_raise(ArgumentError) { @item.xfId = -1 } assert_nothing_raised { @item.xfId = 5 } - assert_equal(@item.xfId, 5 ) + assert_equal(@item.xfId, 5) end def test_builtinId assert_raise(ArgumentError) { @item.builtinId = -1 } assert_nothing_raised { @item.builtinId = 5 } - assert_equal(@item.builtinId, 5 ) + assert_equal(@item.builtinId, 5) end def test_iLevel assert_raise(ArgumentError) { @item.iLevel = -1 } assert_nothing_raised { @item.iLevel = 5 } - assert_equal(@item.iLevel, 5 ) + assert_equal(@item.iLevel, 5) end def test_hidden assert_raise(ArgumentError) { @item.hidden = -1 } assert_nothing_raised { @item.hidden = true } - assert_equal(@item.hidden, true ) + assert_equal(@item.hidden, true) end def test_customBuiltin assert_raise(ArgumentError) { @item.customBuiltin = -1 } assert_nothing_raised { @item.customBuiltin = true } - assert_equal(@item.customBuiltin, true ) + assert_equal(@item.customBuiltin, true) end end diff --git a/test/stylesheet/tc_color.rb b/test/stylesheet/tc_color.rb index 1fff4c3b..8f87111e 100644 --- a/test/stylesheet/tc_color.rb +++ b/test/stylesheet/tc_color.rb @@ -17,13 +17,13 @@ class TestColor < Test::Unit::TestCase def test_auto assert_raise(ArgumentError) { @item.auto = -1 } assert_nothing_raised { @item.auto = true } - assert_equal(@item.auto, true ) + assert_equal(@item.auto, true) end def test_rgb assert_raise(ArgumentError) { @item.rgb = -1 } assert_nothing_raised { @item.rgb = "FF00FF00" } - assert_equal(@item.rgb, "FF00FF00" ) + assert_equal(@item.rgb, "FF00FF00") end def test_rgb_writer_doesnt_mutate_its_argument @@ -35,6 +35,6 @@ class TestColor < Test::Unit::TestCase def test_tint assert_raise(ArgumentError) { @item.tint = -1 } assert_nothing_raised { @item.tint = -1.0 } - assert_equal(@item.tint, -1.0 ) + assert_equal(@item.tint, -1.0) end end diff --git a/test/stylesheet/tc_dxf.rb b/test/stylesheet/tc_dxf.rb index ffc59dfb..9e87007d 100644 --- a/test/stylesheet/tc_dxf.rb +++ b/test/stylesheet/tc_dxf.rb @@ -37,8 +37,8 @@ class TestDxf < Test::Unit::TestCase end def test_fill - assert_raise(ArgumentError) { @item.fill = 1 } - assert_nothing_raised { @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType =>:solid, :fgColor=> Axlsx::Color.new(:rgb => "FF000000"))) } + assert_raise(ArgumentError) { @item.fill = 1 } + assert_nothing_raised { @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType => :solid, :fgColor => Axlsx::Color.new(:rgb => "FF000000"))) } assert @item.fill.is_a? Axlsx::Fill end @@ -64,7 +64,7 @@ class TestDxf < Test::Unit::TestCase def test_many_options_xml @item.border = Axlsx::Border.new @item.alignment = Axlsx::CellAlignment.new - @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType =>:solid, :fgColor=> Axlsx::Color.new(:rgb => "FF000000"))) + @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType => :solid, :fgColor => Axlsx::Color.new(:rgb => "FF000000"))) @item.font = Axlsx::Font.new @item.protection = Axlsx::CellProtection.new @item.numFmt = Axlsx::NumFmt.new diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb index fb52f846..821e8820 100644 --- a/test/stylesheet/tc_font.rb +++ b/test/stylesheet/tc_font.rb @@ -116,7 +116,7 @@ class TestFont < Test::Unit::TestCase # def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end def test_color assert_raise(ArgumentError) { @item.color = -7 } - assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb=>"00000000") } + assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb => "00000000") } assert(@item.color.is_a?(Axlsx::Color)) end diff --git a/test/stylesheet/tc_gradient_fill.rb b/test/stylesheet/tc_gradient_fill.rb index 9ff043cc..3950fcf7 100644 --- a/test/stylesheet/tc_gradient_fill.rb +++ b/test/stylesheet/tc_gradient_fill.rb @@ -55,7 +55,7 @@ class TestGradientFill < Test::Unit::TestCase end def test_stop - @item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"00000000"), 0.5) + @item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "00000000"), 0.5) assert(@item.stop.size == 1) assert(@item.stop.last.is_a?(Axlsx::GradientStop)) end diff --git a/test/stylesheet/tc_gradient_stop.rb b/test/stylesheet/tc_gradient_stop.rb index 2865f12d..6dc140e0 100644 --- a/test/stylesheet/tc_gradient_stop.rb +++ b/test/stylesheet/tc_gradient_stop.rb @@ -2,7 +2,7 @@ require 'tc_helper.rb' class TestGradientStop < Test::Unit::TestCase def setup - @item = Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"FFFF0000"), 1.0) + @item = Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "FFFF0000"), 1.0) end def teardown @@ -21,7 +21,7 @@ class TestGradientStop < Test::Unit::TestCase def test_color assert_raise(ArgumentError) { @item.color = nil } - color = Axlsx::Color.new(:rgb=>"FF0000FF") + color = Axlsx::Color.new(:rgb => "FF0000FF") @item.color = color assert_equal(@item.color.rgb, "FF0000FF") end diff --git a/test/stylesheet/tc_pattern_fill.rb b/test/stylesheet/tc_pattern_fill.rb index e22f4de6..1126e919 100644 --- a/test/stylesheet/tc_pattern_fill.rb +++ b/test/stylesheet/tc_pattern_fill.rb @@ -33,7 +33,7 @@ class TestPatternFill < Test::Unit::TestCase end def test_to_xml_string - @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb=>"00FF00") + @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb => "00FF00") doc = Nokogiri::XML(@item.to_xml_string) assert(doc.xpath('//color[@rgb="FFFF0000"]')) assert(doc.xpath('//color[@rgb="FF00FF00"]')) diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index 8bb6ff32..78e82354 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -21,10 +21,10 @@ class TestStyles < Test::Unit::TestCase def test_add_style_border_hash border_count = @styles.borders.size - @styles.add_style :border => {:style => :thin, :color => "FFFF0000"} + @styles.add_style :border => { :style => :thin, :color => "FFFF0000" } assert_equal(@styles.borders.size, border_count + 1) assert_equal(@styles.borders.last.prs.last.color.rgb, "FFFF0000") - assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"} } + assert_raise(ArgumentError) { @styles.add_style :border => { :color => "FFFF0000" } } assert_equal @styles.borders.last.prs.size, 4 end @@ -32,23 +32,23 @@ class TestStyles < Test::Unit::TestCase prev_border_count = @styles.borders.size borders_array = [ - {:style => :thin, :color => "DDDDDD"}, - {:edges => [:top], :style => :thin, :color => "000000"}, - {:edges => [:bottom], :style => :thick, :color => "FF0000"}, - {:edges => [:left], :style => :dotted, :color => "FFFF00"}, - {:edges => [:right], :style => :dashed, :color => "FFFFFF"}, - {:style => :thick, :color => "CCCCCC"} + { :style => :thin, :color => "DDDDDD" }, + { :edges => [:top], :style => :thin, :color => "000000" }, + { :edges => [:bottom], :style => :thick, :color => "FF0000" }, + { :edges => [:left], :style => :dotted, :color => "FFFF00" }, + { :edges => [:right], :style => :dashed, :color => "FFFFFF" }, + { :style => :thick, :color => "CCCCCC" } ] @styles.add_style(border: borders_array) - assert_equal(@styles.borders.size, (prev_border_count+1)) + assert_equal(@styles.borders.size, (prev_border_count + 1)) current_border = @styles.borders.last borders_array.each do |b_opts| if b_opts[:edges] - border_pr = current_border.prs.detect{|x| x.name == b_opts[:edges].first } + border_pr = current_border.prs.detect { |x| x.name == b_opts[:edges].first } assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}") end end @@ -63,39 +63,39 @@ class TestStyles < Test::Unit::TestCase def test_do_not_alter_options_in_add_style #This should test all options, but for now - just the bits that we know caused some pain - options = { :border => { :style => :thin, :color =>"FF000000" } } + options = { :border => { :style => :thin, :color => "FF000000" } } @styles.add_style options assert_equal options[:border][:style], :thin, 'thin style is stil in option' assert_equal options[:border][:color], "FF000000", 'color is stil in option' end def test_parse_num_fmt - f_code = {:format_code => "YYYY/MM"} - num_fmt = {:num_fmt => 5} + f_code = { :format_code => "YYYY/MM" } + num_fmt = { :num_fmt => 5 } assert_equal(@styles.parse_num_fmt_options, nil, 'noop if neither :format_code or :num_fmt exist') - max = @styles.numFmts.map{ |nf| nf.numFmtId }.max + max = @styles.numFmts.map { |nf| nf.numFmtId }.max @styles.parse_num_fmt_options(f_code) assert_equal(@styles.numFmts.last.numFmtId, max + 1, "new numfmts gets next available id") assert(@styles.parse_num_fmt_options(num_fmt).is_a?(Integer), "Should return the provided num_fmt if not dxf") - assert(@styles.parse_num_fmt_options(num_fmt.merge({:type => :dxf})).is_a?(Axlsx::NumFmt), "Makes a new NumFmt if dxf") + assert(@styles.parse_num_fmt_options(num_fmt.merge({ :type => :dxf })).is_a?(Axlsx::NumFmt), "Makes a new NumFmt if dxf") end def test_parse_border_options_hash_required_keys assert_raise(ArgumentError, "Require color key") { @styles.parse_border_options(:border => { :style => :thin }) } assert_raise(ArgumentError, "Require style key") { @styles.parse_border_options(:border => { :color => "FF0d0d0d" }) } - assert_nothing_raised { @styles.parse_border_options(:border => { :style => :thin, :color => "FF000000"} ) } + assert_nothing_raised { @styles.parse_border_options(:border => { :style => :thin, :color => "FF000000" }) } end def test_parse_border_basic_options - b_opts = {:border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } + b_opts = { :border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } b = @styles.parse_border_options b_opts assert(b.is_a? Integer) - assert_equal(@styles.parse_border_options(b_opts.merge({:type => :dxf})).class,Axlsx::Border) + assert_equal(@styles.parse_border_options(b_opts.merge({ :type => :dxf })).class, Axlsx::Border) assert(@styles.borders.last.diagonalUp == 1, "border options are passed in to the initializer") end def test_parse_border_options_edges - b_opts = {:border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } + b_opts = { :border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } @styles.parse_border_options b_opts b = @styles.borders.last left = b.prs.select { |bpr| bpr.name == :left }[0] @@ -106,10 +106,10 @@ class TestStyles < Test::Unit::TestCase assert_equal(bottom, nil, "unspecified bottom edge should not be created") assert(left.is_a?(Axlsx::BorderPr), "specified left edge is set") assert(right.is_a?(Axlsx::BorderPr), "specified right edge is set") - assert_equal(left.style,right.style, "edge parts have the same style") + assert_equal(left.style, right.style, "edge parts have the same style") assert_equal(left.style, :thick, "the style is THICK") - assert_equal(right.color.rgb,left.color.rgb, "edge parts are colors are the same") - assert_equal(right.color.rgb,"FFDADADA", "edge color rgb is correct") + assert_equal(right.color.rgb, left.color.rgb, "edge parts are colors are the same") + assert_equal(right.color.rgb, "FFDADADA", "edge color rgb is correct") end def test_parse_border_options_noop @@ -118,11 +118,11 @@ class TestStyles < Test::Unit::TestCase def test_parse_border_options_integer_xf assert_equal(@styles.parse_border_options(:border => 1), 1) - assert_raise(ArgumentError, "unknown border index") {@styles.parse_border_options(:border => 100) } + assert_raise(ArgumentError, "unknown border index") { @styles.parse_border_options(:border => 100) } end def test_parse_border_options_integer_dxf - b_opts = { :border => { :edges => [:left, :right], :color => "FFFFFFFF", :style=> :thick } } + b_opts = { :border => { :edges => [:left, :right], :color => "FFFFFFFF", :style => :thick } } b = @styles.parse_border_options(b_opts) b2 = @styles.parse_border_options(:border => b, :type => :dxf) assert(b2.is_a?(Axlsx::Border), "Cloned existing border object") @@ -140,7 +140,7 @@ class TestStyles < Test::Unit::TestCase original_attributes = Axlsx.instance_values_for(original) assert_equal(1, created.b) assert_equal(99, created.sz) - copied = original_attributes.reject{ |key, value| %w(b sz).include? key } + copied = original_attributes.reject { |key, value| %w(b sz).include? key } instance_vals = Axlsx.instance_values_for(created) copied.each do |key, value| assert_equal(instance_vals[key], value) @@ -162,8 +162,8 @@ class TestStyles < Test::Unit::TestCase :font_name => "woot font" } assert_equal(@styles.parse_font_options {}, nil, "noop if no font keys are set") - assert(@styles.parse_font_options(:b=>1).is_a?(Integer), "return index of font if not :dxf type") - assert_equal(@styles.parse_font_options(:b=>1, :type => :dxf).class, Axlsx::Font, "return font object if :dxf type") + assert(@styles.parse_font_options(:b => 1).is_a?(Integer), "return index of font if not :dxf type") + assert_equal(@styles.parse_font_options(:b => 1, :type => :dxf).class, Axlsx::Font, "return font object if :dxf type") f = @styles.parse_font_options(options.merge(:type => :dxf)) color = options.delete(:fg_color) @@ -192,15 +192,15 @@ class TestStyles < Test::Unit::TestCase font_count = @styles.fonts.size xf_count = @styles.cellXfs.size - @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :num_fmt=>Axlsx::NUM_FMT_PERCENT, :alignment=>{:horizontal=>:left}, :border=>Axlsx::STYLE_THIN_BORDER, :hidden=>true, :locked=>true - assert_equal(@styles.fills.size, fill_count+1) - assert_equal(@styles.fonts.size, font_count+1) - assert_equal(@styles.cellXfs.size, xf_count+1) + @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :num_fmt => Axlsx::NUM_FMT_PERCENT, :alignment => { :horizontal => :left }, :border => Axlsx::STYLE_THIN_BORDER, :hidden => true, :locked => true + assert_equal(@styles.fills.size, fill_count + 1) + assert_equal(@styles.fonts.size, font_count + 1) + assert_equal(@styles.cellXfs.size, xf_count + 1) xf = @styles.cellXfs.last - assert_equal(xf.fillId, (@styles.fills.size-1), "points to the last created fill") + assert_equal(xf.fillId, (@styles.fills.size - 1), "points to the last created fill") assert_equal(@styles.fills.last.fill_type.fgColor.rgb, "FF000000", "fill created with color") - assert_equal(xf.fontId, (@styles.fonts.size-1), "points to the last created font") + assert_equal(xf.fontId, (@styles.fonts.size - 1), "points to the last created font") assert_equal(@styles.fonts.last.sz, 13, "font sz applied") assert_equal(@styles.fonts.last.color.rgb, "FFFFFFFF", "font color applied") @@ -215,16 +215,16 @@ class TestStyles < Test::Unit::TestCase assert_equal(xf.applyProtection, true, "protection applied") assert_equal(xf.applyBorder, true, "border applied") - assert_equal(xf.applyNumberFormat,true, "number format applied") + assert_equal(xf.applyNumberFormat, true, "number format applied") assert_equal(xf.applyAlignment, true, "alignment applied") end def test_basic_add_style_dxf border_count = @styles.borders.size - @styles.add_style :border => {:style => :thin, :color => "FFFF0000"}, :type => :dxf + @styles.add_style :border => { :style => :thin, :color => "FFFF0000" }, :type => :dxf assert_equal(@styles.borders.size, border_count, "styles borders not affected") assert_equal(@styles.dxfs.last.border.prs.last.color.rgb, "FFFF0000") - assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"}, :type => :dxf } + assert_raise(ArgumentError) { @styles.add_style :border => { :color => "FFFF0000" }, :type => :dxf } assert_equal @styles.borders.last.prs.size, 4 end @@ -233,8 +233,8 @@ class TestStyles < Test::Unit::TestCase font_count = @styles.fonts.size dxf_count = @styles.dxfs.size - style = @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf - assert_equal(@styles.dxfs.size, dxf_count+1) + style = @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf + assert_equal(@styles.dxfs.size, dxf_count + 1) assert_equal(0, style, "returns the zero-based dxfId") dxf = @styles.dxfs.last @@ -255,9 +255,9 @@ class TestStyles < Test::Unit::TestCase def test_multiple_dxf # add a second style - style = @styles.add_style :bg_color=>"00000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf + style = @styles.add_style :bg_color => "00000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf assert_equal(0, style, "returns the first dxfId") - style = @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf + style = @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf assert_equal(1, style, "returns the second dxfId") end @@ -302,7 +302,7 @@ class TestStyles < Test::Unit::TestCase current_border = @styles.borders.last - border_pr = current_border.prs.detect{|x| x.name == edge } + border_pr = current_border.prs.detect { |x| x.name == edge } assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}") end end diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index fc23cc5f..c214f8e2 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -64,7 +64,7 @@ class TestAxlsx < Test::Unit::TestCase def test_name_to_indices setup_wide @wide_test_points.each do |key, value| - assert_equal(Axlsx.name_to_indices(key), [value,2]) + assert_equal(Axlsx.name_to_indices(key), [value, 2]) end end @@ -108,7 +108,7 @@ class TestAxlsx < Test::Unit::TestCase end class InstanceValuesSubject - def initialize(args={}) + def initialize(args = {}) args.each do |key, v| instance_variable_set("@#{key}".to_sym, v) end @@ -120,23 +120,23 @@ class TestAxlsx < Test::Unit::TestCase assert_equal({}, Axlsx.instance_values_for(empty), 'should generate with no ivars') single = InstanceValuesSubject.new(a: 2) - assert_equal({"a" => 2}, Axlsx.instance_values_for(single), 'should generate for a single ivar') + assert_equal({ "a" => 2 }, Axlsx.instance_values_for(single), 'should generate for a single ivar') double = InstanceValuesSubject.new(a: 2, b: "c") - assert_equal({"a" => 2, "b" => "c"}, Axlsx.instance_values_for(double), 'should generate for multiple ivars') + assert_equal({ "a" => 2, "b" => "c" }, Axlsx.instance_values_for(double), 'should generate for multiple ivars') inner_obj = Object.new complex = InstanceValuesSubject.new(obj: inner_obj) - assert_equal({"obj" => inner_obj}, Axlsx.instance_values_for(complex), 'should pass value of ivar directly') + assert_equal({ "obj" => inner_obj }, Axlsx.instance_values_for(complex), 'should pass value of ivar directly') nil_subject = InstanceValuesSubject.new(nil_obj: nil) - assert_equal({"nil_obj" => nil}, Axlsx.instance_values_for(nil_subject), 'should return nil ivars') + assert_equal({ "nil_obj" => nil }, Axlsx.instance_values_for(nil_subject), 'should return nil ivars') end def test_hash_deep_merge - h1 = {foo: {bar: true}} - h2 = {foo: {baz: true}} - assert_equal({foo: {baz: true}}, h1.merge(h2)) - assert_equal({foo: {bar: true, baz: true}}, Axlsx.hash_deep_merge(h1, h2)) + h1 = { foo: { bar: true } } + h2 = { foo: { baz: true } } + assert_equal({ foo: { baz: true } }, h1.merge(h2)) + assert_equal({ foo: { bar: true, baz: true } }, Axlsx.hash_deep_merge(h1, h2)) end end diff --git a/test/tc_package.rb b/test/tc_package.rb index b3ca6810..c8f35211 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -39,8 +39,8 @@ class TestPackage < Test::Unit::TestCase vs.add_selection(:bottom_right, { :active_cell => 'I57', :sqref => 'I57' }) end - ws.add_chart(Axlsx::Pie3DChart, :title => "これは?", :start_at => [0,3]) do |chart| - chart.add_series :data=>[1,2,3], :labels=>["a", "b", "c"] + ws.add_chart(Axlsx::Pie3DChart, :title => "これは?", :start_at => [0, 3]) do |chart| + chart.add_series :data => [1, 2, 3], :labels => ["a", "b", "c"] chart.d_lbls.show_val = true chart.d_lbls.d_lbl_pos = :outEnd chart.d_lbls.show_percent = true @@ -52,33 +52,33 @@ class TestPackage < Test::Unit::TestCase end ws.add_chart(Axlsx::Bar3DChart, :title => 'bar chart') do |chart| - chart.add_series :data => [1,4,5], :labels => %w(A B C) + chart.add_series :data => [1, 4, 5], :labels => %w(A B C) chart.d_lbls.show_percent = true end ws.add_chart(Axlsx::ScatterChart, :title => 'scat man') do |chart| - chart.add_series :xData => [1,2,3,4], :yData => [4,3,2,1] + chart.add_series :xData => [1, 2, 3, 4], :yData => [4, 3, 2, 1] chart.d_lbls.show_val = true end ws.add_chart(Axlsx::BubbleChart, :title => 'bubble chart') do |chart| - chart.add_series :xData => [1,2,3,4], :yData => [1,3,2,4] + chart.add_series :xData => [1, 2, 3, 4], :yData => [1, 3, 2, 4] chart.d_lbls.show_val = true end @fname = 'axlsx_test_serialization.xlsx' img = File.expand_path('../fixtures/image1.jpeg', __FILE__) - ws.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink=>"http://axlsx.blogspot.com") do |image| - image.width=720 - image.height=666 + ws.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink => "http://axlsx.blogspot.com") do |image| + image.width = 720 + image.height = 666 image.hyperlink.tooltip = "Labeled Link" image.start_at 5, 5 image.end_at 10, 10 end ws.add_image :image_src => File.expand_path('../fixtures/image1.gif', __FILE__) do |image| image.start_at 0, 20 - image.width=360 - image.height=333 + image.width = 360 + image.height = 333 end ws.add_image :image_src => File.expand_path('../fixtures/image1.png', __FILE__) do |image| image.start_at 9, 20 @@ -99,18 +99,18 @@ class TestPackage < Test::Unit::TestCase def test_core_accessor assert_equal(@package.core, Axlsx.instance_values_for(@package)["core"]) - assert_raise(NoMethodError) {@package.core = nil } + assert_raise(NoMethodError) { @package.core = nil } end def test_app_accessor assert_equal(@package.app, Axlsx.instance_values_for(@package)["app"]) - assert_raise(NoMethodError) {@package.app = nil } + assert_raise(NoMethodError) { @package.app = nil } end def test_use_shared_strings assert_equal(@package.use_shared_strings, nil) - assert_raise(ArgumentError) {@package.use_shared_strings 9} - assert_nothing_raised {@package.use_shared_strings = true} + assert_raise(ArgumentError) { @package.use_shared_strings 9 } + assert_nothing_raised { @package.use_shared_strings = true } assert_equal(@package.use_shared_strings, @package.workbook.use_shared_strings) end @@ -177,7 +177,7 @@ class TestPackage < Test::Unit::TestCase def assert_zip_file_matches_package(fname, package) zf = Zip::File.open(fname) - package.send(:parts).each{ |part| zf.get_entry(part[:entry]) } + package.send(:parts).each { |part| zf.get_entry(part[:entry]) } end def assert_created_with_rubyzip(fname, package) @@ -250,22 +250,22 @@ class TestPackage < Test::Unit::TestCase def test_parts p = @package.send(:parts) #all parts have an entry - assert_equal(p.select{ |part| part[:entry] =~ /_rels\/\.rels/ }.size, 1, "rels missing") - assert_equal(p.select{ |part| part[:entry] =~ /docProps\/core\.xml/ }.size, 1, "core missing") - assert_equal(p.select{ |part| part[:entry] =~ /docProps\/app\.xml/ }.size, 1, "app missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/_rels\/workbook\.xml\.rels/ }.size, 1, "workbook rels missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/workbook\.xml/ }.size, 1, "workbook missing") - assert_equal(p.select{ |part| part[:entry] =~ /\[Content_Types\]\.xml/ }.size, 1, "content types missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/styles\.xml/ }.size, 1, "styles missin") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/drawings\/_rels\/drawing\d\.xml\.rels/ }.size, @package.workbook.drawings.size, "one or more drawing rels missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/drawings\/drawing\d\.xml/ }.size, @package.workbook.drawings.size, "one or more drawings missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/charts\/chart\d\.xml/ }.size, @package.workbook.charts.size, "one or more charts missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/worksheets\/sheet\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/worksheets\/_rels\/sheet\d\.xml\.rels/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/comments\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotTables\/pivotTable\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotTables\/_rels\/pivotTable\d\.xml.rels/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables rels missing") - assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotCache\/pivotCacheDefinition\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing") + assert_equal(p.select { |part| part[:entry] =~ /_rels\/\.rels/ }.size, 1, "rels missing") + assert_equal(p.select { |part| part[:entry] =~ /docProps\/core\.xml/ }.size, 1, "core missing") + assert_equal(p.select { |part| part[:entry] =~ /docProps\/app\.xml/ }.size, 1, "app missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/_rels\/workbook\.xml\.rels/ }.size, 1, "workbook rels missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/workbook\.xml/ }.size, 1, "workbook missing") + assert_equal(p.select { |part| part[:entry] =~ /\[Content_Types\]\.xml/ }.size, 1, "content types missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/styles\.xml/ }.size, 1, "styles missin") + assert_equal(p.select { |part| part[:entry] =~ /xl\/drawings\/_rels\/drawing\d\.xml\.rels/ }.size, @package.workbook.drawings.size, "one or more drawing rels missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/drawings\/drawing\d\.xml/ }.size, @package.workbook.drawings.size, "one or more drawings missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/charts\/chart\d\.xml/ }.size, @package.workbook.charts.size, "one or more charts missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/worksheets\/sheet\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/worksheets\/_rels\/sheet\d\.xml\.rels/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/comments\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotTables\/pivotTable\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotTables\/_rels\/pivotTable\d\.xml.rels/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables rels missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotCache\/pivotCacheDefinition\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing") #no mystery parts assert_equal(25, p.size) @@ -280,7 +280,7 @@ class TestPackage < Test::Unit::TestCase @package.use_shared_strings = true @package.to_stream #ensure all cell_serializer paths are hit p = @package.send(:parts) - assert_equal(p.select{ |part| part[:entry] =~/xl\/sharedStrings.xml/}.size, 1, "shared strings table missing") + assert_equal(p.select { |part| part[:entry] =~ /xl\/sharedStrings.xml/ }.size, 1, "shared strings table missing") end def test_workbook_is_a_workbook @@ -305,8 +305,8 @@ class TestPackage < Test::Unit::TestCase end def test_name_to_indices - assert(Axlsx::name_to_indices('A1') == [0,0]) - assert(Axlsx::name_to_indices('A100') == [0,99], 'needs to axcept rows that contain 0') + assert(Axlsx::name_to_indices('A1') == [0, 0]) + assert(Axlsx::name_to_indices('A100') == [0, 99], 'needs to axcept rows that contain 0') end def test_to_stream diff --git a/test/util/tc_simple_typed_list.rb b/test/util/tc_simple_typed_list.rb index 88e75a1c..abcacf26 100644 --- a/test/util/tc_simple_typed_list.rb +++ b/test/util/tc_simple_typed_list.rb @@ -9,7 +9,7 @@ class TestSimpleTypedList < Test::Unit::TestCase def test_type_is_a_class_or_array_of_class assert_nothing_raised { Axlsx::SimpleTypedList.new Integer } - assert_nothing_raised { Axlsx::SimpleTypedList.new [Integer,String] } + assert_nothing_raised { Axlsx::SimpleTypedList.new [Integer, String] } assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new } assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new "1" } assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new [Integer, "Class"] } @@ -29,20 +29,20 @@ class TestSimpleTypedList < Test::Unit::TestCase end def test_concat_should_return_index - assert( @list.size == 0 ) - assert( @list << 1 == 0 ) - assert( @list << 2 == 1 ) + assert(@list.size == 0) + assert(@list << 1 == 0) + assert(@list << 2 == 1) @list.delete_at 0 - assert( @list << 3 == 1 ) - assert( @list.index(2) == 0 ) + assert(@list << 3 == 1) + assert(@list.index(2) == 0) end def test_push_should_return_index - assert( @list.push(1) == 0 ) - assert( @list.push(2) == 1 ) + assert(@list.push(1) == 0) + assert(@list.push(2) == 1) @list.delete_at 0 - assert( @list.push(3) == 1 ) - assert( @list.index(2) == 0 ) + assert(@list.push(3) == 1) + assert(@list.index(2) == 0) end def test_locking @@ -72,6 +72,6 @@ class TestSimpleTypedList < Test::Unit::TestCase def test_equality @list.push 1 @list.push 2 - assert_equal(@list.to_ary, [1,2]) + assert_equal(@list.to_ary, [1, 2]) end end diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb index 26fb2a89..c0e2e356 100644 --- a/test/util/tc_validators.rb +++ b/test/util/tc_validators.rb @@ -10,17 +10,17 @@ class TestValidators < Test::Unit::TestCase #unsigned_int assert_nothing_raised { Axlsx.validate_unsigned_int 1 } assert_nothing_raised { Axlsx.validate_unsigned_int(+1) } - assert_raise(ArgumentError) { Axlsx.validate_unsigned_int(-1)} + assert_raise(ArgumentError) { Axlsx.validate_unsigned_int(-1) } assert_raise(ArgumentError) { Axlsx.validate_unsigned_int('1') } #int assert_nothing_raised { Axlsx.validate_int(1) } assert_nothing_raised { Axlsx.validate_int(-1) } - assert_raise(ArgumentError) { Axlsx.validate_int('a')} + assert_raise(ArgumentError) { Axlsx.validate_int('a') } assert_raise(ArgumentError) { Axlsx.validate_int(Array) } #boolean (as 0 or 1, :true, :false, true, false, or "true," "false") - [0,1,:true, :false, true, false, "true", "false"].each do |v| + [0, 1, :true, :false, true, false, "true", "false"].each do |v| assert_nothing_raised { Axlsx.validate_boolean 0 } end assert_raise(ArgumentError) { Axlsx.validate_boolean 2 } diff --git a/test/workbook/tc_shared_strings_table.rb b/test/workbook/tc_shared_strings_table.rb index 7e8fb38e..cb7557c6 100644 --- a/test/workbook/tc_shared_strings_table.rb +++ b/test/workbook/tc_shared_strings_table.rb @@ -2,7 +2,7 @@ require 'tc_helper.rb' class TestSharedStringsTable < Test::Unit::TestCase def setup - @p = Axlsx::Package.new :use_shared_strings=>true + @p = Axlsx::Package.new :use_shared_strings => true ws = @p.workbook.add_worksheet ws.add_row ['a', 1, 'b'] @@ -39,11 +39,11 @@ class TestSharedStringsTable < Test::Unit::TestCase puts error.message errors << error end - assert_equal(errors.size, 0, "sharedStirngs.xml Invalid" + errors.map{ |e| e.message }.to_s) + assert_equal(errors.size, 0, "sharedStirngs.xml Invalid" + errors.map { |e| e.message }.to_s) end def test_remove_control_characters_in_xml_serialization - nasties = "hello\x10\x00\x1C\x1Eworld" + nasties = "hello\x10\x00\x1C\x1Eworld" @p.workbook.worksheets[0].add_row [nasties] # test that the nasty string was added to the shared strings diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb index b678a183..c5a72e48 100644 --- a/test/workbook/tc_workbook.rb +++ b/test/workbook/tc_workbook.rb @@ -28,26 +28,26 @@ class TestWorkbook < Test::Unit::TestCase def test_no_autowidth assert_equal(@wb.use_autowidth, true) - assert_raise(ArgumentError) {@wb.use_autowidth = 0.1} - assert_nothing_raised {@wb.use_autowidth = false} + assert_raise(ArgumentError) { @wb.use_autowidth = 0.1 } + assert_nothing_raised { @wb.use_autowidth = false } assert_equal(@wb.use_autowidth, false) end def test_is_reversed assert_equal(@wb.is_reversed, nil) - assert_raise(ArgumentError) {@wb.is_reversed = 0.1} - assert_nothing_raised {@wb.is_reversed = true } + assert_raise(ArgumentError) { @wb.is_reversed = 0.1 } + assert_nothing_raised { @wb.is_reversed = true } assert_equal(@wb.use_autowidth, true) end def test_sheet_by_name_retrieval - @wb.add_worksheet(:name=>'foo') - @wb.add_worksheet(:name=>'bar') + @wb.add_worksheet(:name => 'foo') + @wb.add_worksheet(:name => 'bar') assert_equal('foo', @wb.sheet_by_name('foo').name) end def test_worksheet_empty_name - assert_raise(ArgumentError) {@wb.add_worksheet(:name=>'')} + assert_raise(ArgumentError) { @wb.add_worksheet(:name => '') } end def test_date1904 @@ -70,13 +70,13 @@ class TestWorkbook < Test::Unit::TestCase def test_shared_strings assert_equal(@wb.use_shared_strings, nil) - assert_raise(ArgumentError) {@wb.use_shared_strings = 'bpb'} - assert_nothing_raised {@wb.use_shared_strings = :true} + assert_raise(ArgumentError) { @wb.use_shared_strings = 'bpb' } + assert_nothing_raised { @wb.use_shared_strings = :true } end def test_add_worksheet assert(@wb.worksheets.empty?, "worbook has no worksheets by default") - ws = @wb.add_worksheet(:name=>"bob") + ws = @wb.add_worksheet(:name => "bob") assert_equal(@wb.worksheets.size, 1, "add_worksheet adds a worksheet!") assert_equal(@wb.worksheets.first, ws, "the worksheet returned is the worksheet added") assert_equal(ws.name, "bob", "name option gets passed to worksheet") @@ -118,10 +118,10 @@ class TestWorkbook < Test::Unit::TestCase end def test_range_requires_valid_sheet - ws = @wb.add_worksheet :name=>'fish' - ws.add_row [1,2,3] - ws.add_row [4,5,6] - assert_raise(ArgumentError, "no sheet name part") { @wb["A1:C2"]} + ws = @wb.add_worksheet :name => 'fish' + ws.add_row [1, 2, 3] + ws.add_row [4, 5, 6] + assert_raise(ArgumentError, "no sheet name part") { @wb["A1:C2"] } assert_equal @wb['fish!A1:C2'].size, 6 end diff --git a/test/workbook/tc_workbook_view.rb b/test/workbook/tc_workbook_view.rb index 8280d8d5..6fb300a8 100644 --- a/test/workbook/tc_workbook_view.rb +++ b/test/workbook/tc_workbook_view.rb @@ -17,14 +17,14 @@ class TestWorkbookView < Test::Unit::TestCase def test_boolean_attribute_validation %w(minimized show_horizontal_scroll show_vertical_scroll show_sheet_tabs auto_filter_date_grouping).each do |attr| assert_raise(ArgumentError, 'only booleanish allowed in boolean attributes') { @book_view.send("#{attr}=", "banana") } - assert_nothing_raised { @book_view.send("#{attr}=", false )} + assert_nothing_raised { @book_view.send("#{attr}=", false) } end end def test_integer_attribute_validation %w(tab_ratio first_sheet active_tab x_window y_window window_width window_height).each do |attr| assert_raise(ArgumentError, 'only integer allowed in integer attributes') { @book_view.send("#{attr}=", "b") } - assert_nothing_raised { @book_view.send("#{attr}=", 7 )} + assert_nothing_raised { @book_view.send("#{attr}=", 7) } end end diff --git a/test/workbook/worksheet/auto_filter/tc_auto_filter.rb b/test/workbook/worksheet/auto_filter/tc_auto_filter.rb index 60089d22..eb561554 100644 --- a/test/workbook/worksheet/auto_filter/tc_auto_filter.rb +++ b/test/workbook/worksheet/auto_filter/tc_auto_filter.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestAutoFilter < Test::Unit::TestCase def setup ws = Axlsx::Package.new.workbook.add_worksheet - 3.times { |index| ws.add_row [1*index,2*index,3*index] } + 3.times { |index| ws.add_row [1 * index, 2 * index, 3 * index] } @auto_filter = ws.auto_filter @auto_filter.range = 'A1:C3' @auto_filter.add_column 0, :filters, :filter_items => [1] diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb index d1c30446..8e853772 100644 --- a/test/workbook/worksheet/auto_filter/tc_filters.rb +++ b/test/workbook/worksheet/auto_filter/tc_filters.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestFilters < Test::Unit::TestCase def setup @filters = Axlsx::Filters.new(:filter_items => [1, 'a'], - :date_group_items =>[{ :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 }], + :date_group_items => [{ :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 }], :blank => true) end diff --git a/test/workbook/worksheet/tc_border_creator.rb b/test/workbook/worksheet/tc_border_creator.rb index eb27fe98..c9f3df8f 100644 --- a/test/workbook/worksheet/tc_border_creator.rb +++ b/test/workbook/worksheet/tc_border_creator.rb @@ -8,7 +8,7 @@ class TestBorderCreator < Test::Unit::TestCase end def test_initialize - @ws.add_row [1,2,3] + @ws.add_row [1, 2, 3] bc = Axlsx::BorderCreator.new(worksheet: @ws, cells: @ws["A1:B1"]) assert_equal bc.instance_variable_get(:@edges), Axlsx::Border::EDGES @@ -22,7 +22,7 @@ class TestBorderCreator < Test::Unit::TestCase end def test_initialize_edges - @ws.add_row [1,2,3] + @ws.add_row [1, 2, 3] bc = Axlsx::BorderCreator.new(worksheet: @ws, cells: @ws["A1:B1"], edges: nil) assert_equal bc.instance_variable_get(:@edges), Axlsx::Border::EDGES @@ -48,7 +48,7 @@ class TestBorderCreator < Test::Unit::TestCase def test_draw 5.times do - @ws.add_row [1,2,3,4,5] + @ws.add_row [1, 2, 3, 4, 5] end bc = Axlsx::BorderCreator.new(worksheet: @ws, cells: @ws["A1:C3"], edges: ["top", :left], style: :thick, color: "ffffff") diff --git a/test/workbook/worksheet/tc_break.rb b/test/workbook/worksheet/tc_break.rb index 884d9e01..2c67fed7 100644 --- a/test/workbook/worksheet/tc_break.rb +++ b/test/workbook/worksheet/tc_break.rb @@ -8,7 +8,7 @@ class TestBreak < Test::Unit::TestCase def test_id assert_equal(1, @break.id) assert_raises ArgumentError do - Axlsx::Break.new(:hoge, {:id => -1}) + Axlsx::Break.new(:hoge, { :id => -1 }) end end diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb index af3699ad..a4aab11c 100644 --- a/test/workbook/worksheet/tc_cell.rb +++ b/test/workbook/worksheet/tc_cell.rb @@ -4,10 +4,10 @@ class TestCell < Test::Unit::TestCase def setup p = Axlsx::Package.new p.use_shared_strings = true - @ws = p.workbook.add_worksheet :name=>"hmmm" - p.workbook.styles.add_style :sz=>20 + @ws = p.workbook.add_worksheet :name => "hmmm" + p.workbook.styles.add_style :sz => 20 @row = @ws.add_row - @c = @row.add_cell 1, :type=>:float, :style=>1, :escape_formulas=>true + @c = @row.add_cell 1, :type => :float, :style => 1, :escape_formulas => true data = (0..26).map { |index| index } @ws.add_row data @cAA = @ws["AA2"] @@ -47,8 +47,8 @@ class TestCell < Test::Unit::TestCase end def test_r_abs - assert_equal(@c.r_abs,"$A$1", "calculate absolute cell reference") - assert_equal(@cAA.r_abs,"$AA$2", "needs to accept multi-digit columns") + assert_equal(@c.r_abs, "$A$1", "calculate absolute cell reference") + assert_equal(@cAA.r_abs, "$AA$2", "needs to accept multi-digit columns") end def test_name @@ -58,7 +58,7 @@ class TestCell < Test::Unit::TestCase end def test_autowidth - style = @c.row.worksheet.workbook.styles.add_style({:alignment => {:horizontal => :center, :vertical => :center, :wrap_text => true}} ) + style = @c.row.worksheet.workbook.styles.add_style({ :alignment => { :horizontal => :center, :vertical => :center, :wrap_text => true } }) @c.style = style assert_in_delta(6.6, @c.autowidth, 0.01) end @@ -90,8 +90,8 @@ class TestCell < Test::Unit::TestCase end def test_style - assert_raise(ArgumentError, "must reject invalid style indexes") { @c.style=@c.row.worksheet.workbook.styles.cellXfs.size } - assert_nothing_raised("must allow valid style index changes") {@c.style=1} + assert_raise(ArgumentError, "must reject invalid style indexes") { @c.style = @c.row.worksheet.workbook.styles.cellXfs.size } + assert_nothing_raised("must allow valid style index changes") { @c.style = 1 } assert_equal(@c.style, 1) end @@ -99,7 +99,7 @@ class TestCell < Test::Unit::TestCase assert_raise(ArgumentError, "type must be :string, :integer, :float, :date, :time, :boolean") { @c.type = :array } assert_nothing_raised("type can be changed") { @c.type = :string } assert_equal(@c.value, "1.0", "changing type casts the value") - assert_equal(:float, @row.add_cell(1.0/10**7).type, 'properly identify exponential floats as float type') + assert_equal(:float, @row.add_cell(1.0 / 10**7).type, 'properly identify exponential floats as float type') assert_equal(@row.add_cell(Time.now).type, :time, 'time should be time') assert_equal(@row.add_cell(Date.today).type, :date, 'date should be date') assert_equal(@row.add_cell(true).type, :boolean, 'boolean should be boolean') @@ -133,7 +133,7 @@ class TestCell < Test::Unit::TestCase assert_equal(@c.send(:cell_type_from_value, -1), :integer) assert_equal(@c.send(:cell_type_from_value, true), :boolean) assert_equal(@c.send(:cell_type_from_value, false), :boolean) - assert_equal(@c.send(:cell_type_from_value, 1.0/10**6), :float) + assert_equal(@c.send(:cell_type_from_value, 1.0 / 10**6), :float) assert_equal(@c.send(:cell_type_from_value, Axlsx::RichText.new), :richtext) assert_equal(:iso_8601, @c.send(:cell_type_from_value, '2008-08-30T01:45:36.123+09:00')) end @@ -255,7 +255,7 @@ class TestCell < Test::Unit::TestCase assert_raise(ArgumentError) { @c.u = -1.1 } assert_nothing_raised { @c.u = :single } assert_equal(@c.u, :single) - doc = Nokogiri::XML(@c.to_xml_string(1,1)) + doc = Nokogiri::XML(@c.to_xml_string(1, 1)) assert(doc.xpath('//u[@val="single"]')) end @@ -339,13 +339,13 @@ class TestCell < Test::Unit::TestCase end def test_to_xml_string - c_xml = Nokogiri::XML(@c.to_xml_string(1,1)) + c_xml = Nokogiri::XML(@c.to_xml_string(1, 1)) assert_equal(c_xml.xpath("/c[@s=1]").size, 1) end def test_to_xml_string_nil @c.value = nil - c_xml = Nokogiri::XML(@c.to_xml_string(1,1)) + c_xml = Nokogiri::XML(@c.to_xml_string(1, 1)) assert_equal(c_xml.xpath("/c[@s=1]").size, 1) end @@ -357,7 +357,7 @@ class TestCell < Test::Unit::TestCase @c.value = "a" @c.font_name = 'arial' @c.color = 'FF0000' - c_xml = Nokogiri::XML(@c.to_xml_string(1,1)) + c_xml = Nokogiri::XML(@c.to_xml_string(1, 1)) assert(c_xml.xpath("//b").any?) end diff --git a/test/workbook/worksheet/tc_col.rb b/test/workbook/worksheet/tc_col.rb index 2f31d7a2..80b228d0 100644 --- a/test/workbook/worksheet/tc_col.rb +++ b/test/workbook/worksheet/tc_col.rb @@ -6,10 +6,10 @@ class TestCol < Test::Unit::TestCase end def test_initialize - options = { :width => 12, :collapsed => true, :hidden => true, :outline_level => 1, :phonetic => true, :style => 1} + options = { :width => 12, :collapsed => true, :hidden => true, :outline_level => 1, :phonetic => true, :style => 1 } col = Axlsx::Col.new 0, 0, options - options.each{ |key, value| assert_equal(col.send(key.to_sym), value) } + options.each { |key, value| assert_equal(col.send(key.to_sym), value) } end def test_min_max_required diff --git a/test/workbook/worksheet/tc_color_scale.rb b/test/workbook/worksheet/tc_color_scale.rb index 7f9e5def..073cd71f 100644 --- a/test/workbook/worksheet/tc_color_scale.rb +++ b/test/workbook/worksheet/tc_color_scale.rb @@ -21,7 +21,7 @@ class TestColorScale < Test::Unit::TestCase first = Axlsx::ColorScale.default_cfvos.first second = Axlsx::ColorScale.default_cfvos.last assert_equal 'FFFF7128', first[:color] - assert_equal :min,first[:type] + assert_equal :min, first[:type] assert_equal 0, first[:val] assert_equal 'FFFFEF9C', second[:color] @@ -30,7 +30,7 @@ class TestColorScale < Test::Unit::TestCase end def test_partial_default_cfvo_override - first_def = {:type => :percent, :val => "10.0", :color => 'FF00FF00'} + first_def = { :type => :percent, :val => "10.0", :color => 'FF00FF00' } color_scale = Axlsx::ColorScale.new(first_def) assert_equal color_scale.value_objects.first.val, first_def[:val] assert_equal color_scale.value_objects.first.type, first_def[:type] @@ -39,15 +39,15 @@ class TestColorScale < Test::Unit::TestCase def test_add @color_scale.add :type => :max, :val => 5, :color => "FFDEDEDE" - assert_equal(@color_scale.value_objects.size,3) - assert_equal(@color_scale.colors.size,3) + assert_equal(@color_scale.value_objects.size, 3) + assert_equal(@color_scale.colors.size, 3) end def test_delete_at @color_scale.add :type => :max, :val => 5, :color => "FFDEDEDE" - assert_nothing_raised {@color_scale.delete_at 2} - assert_equal(@color_scale.value_objects.size,2) - assert_equal(@color_scale.colors.size,2) + assert_nothing_raised { @color_scale.delete_at 2 } + assert_equal(@color_scale.value_objects.size, 2) + assert_equal(@color_scale.colors.size, 2) end def test_to_xml_string diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb index 44a637e6..cbd93f01 100644 --- a/test/workbook/worksheet/tc_comment.rb +++ b/test/workbook/worksheet/tc_comment.rb @@ -47,7 +47,7 @@ class TestComment < Test::Unit::TestCase assert_equal(pos[0], @c1.vml_shape.left_column) assert(@c1.vml_shape.top_row == pos[1]) assert_equal(pos[0] + 2, @c1.vml_shape.right_column) - assert(@c1.vml_shape.bottom_row == pos[1]+4) + assert(@c1.vml_shape.bottom_row == pos[1] + 4) end def test_to_xml_string diff --git a/test/workbook/worksheet/tc_comments.rb b/test/workbook/worksheet/tc_comments.rb index 6b07b465..276dd3b0 100644 --- a/test/workbook/worksheet/tc_comments.rb +++ b/test/workbook/worksheet/tc_comments.rb @@ -19,7 +19,7 @@ class TestComments < Test::Unit::TestCase assert_raise(ArgumentError) { @ws.comments.add_comment() } assert_raise(ArgumentError) { @ws.comments.add_comment(:text => 'Yes We Can', :ref => 'A1') } assert_raise(ArgumentError) { @ws.comments.add_comment(:author => 'bob', :ref => 'A1') } - assert_raise(ArgumentError) { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can')} + assert_raise(ArgumentError) { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can') } assert_nothing_raised { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can', :ref => 'A1') } assert_equal(@ws.comments.size, 3) end @@ -33,7 +33,7 @@ class TestComments < Test::Unit::TestCase end def test_pn - assert_equal(@ws.comments.pn, Axlsx::COMMENT_PN % (@ws.index+1).to_s) + assert_equal(@ws.comments.pn, Axlsx::COMMENT_PN % (@ws.index + 1).to_s) end def test_index diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index cc885255..dcbb3ca6 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -3,14 +3,14 @@ require 'tc_helper.rb' class TestConditionalFormatting < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" - @cfs = @ws.add_conditional_formatting( "A1:A1", [{ :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :greaterThan, :formula => "0.5" }]) + @ws = p.workbook.add_worksheet :name => "hmmm" + @cfs = @ws.add_conditional_formatting("A1:A1", [{ :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :greaterThan, :formula => "0.5" }]) @cf = @cfs.first @cfr = @cf.rules.first end def test_initialize_with_options - optioned = Axlsx::ConditionalFormatting.new( :sqref => "AA1:AB100", :rules => [1, 2] ) + optioned = Axlsx::ConditionalFormatting.new(:sqref => "AA1:AB100", :rules => [1, 2]) assert_equal("AA1:AB100", optioned.sqref) assert_equal([1, 2], optioned.rules) end @@ -25,17 +25,17 @@ class TestConditionalFormatting < Test::Unit::TestCase data_bar = Axlsx::DataBar.new :color => "FFFF0000" icon_set = Axlsx::IconSet.new :iconSet => "5Rating" - cfr = Axlsx::ConditionalFormattingRule.new( { :type => :containsText, :text => "TRUE", + cfr = Axlsx::ConditionalFormattingRule.new({ :type => :containsText, :text => "TRUE", :dxfId => 0, :priority => 1, :formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))', :color_scale => color_scale, :data_bar => data_bar, - :icon_set => icon_set}) + :icon_set => icon_set }) assert(cfr.data_bar.is_a?(Axlsx::DataBar)) assert(cfr.icon_set.is_a?(Axlsx::IconSet)) assert(cfr.color_scale.is_a?(Axlsx::ColorScale)) - cfs = @ws.add_conditional_formatting( "B2:B2", [cfr]) + cfs = @ws.add_conditional_formatting("B2:B2", [cfr]) doc = Nokogiri::XML.parse(cfs.last.to_xml_string) assert_equal(1, doc.xpath(".//conditionalFormatting[@sqref='B2:B2']//cfRule[@type='containsText'][@dxfId=0][@priority=1]").size) assert doc.xpath(".//conditionalFormatting//cfRule[@type='containsText'][@dxfId=0][@priority=1]//formula='NOT(ISERROR(SEARCH(\"FALSE\",AB1)))'") @@ -68,12 +68,12 @@ class TestConditionalFormatting < Test::Unit::TestCase data_bar = Axlsx::DataBar.new :color => "FFFF0000" icon_set = Axlsx::IconSet.new :iconSet => "5Rating" - cfs = @ws.add_conditional_formatting( "B2:B2", [{ :type => :containsText, :text => "TRUE", + cfs = @ws.add_conditional_formatting("B2:B2", [{ :type => :containsText, :text => "TRUE", :dxfId => 0, :priority => 1, :formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))', :color_scale => color_scale, :data_bar => data_bar, - :icon_set => icon_set}]) + :icon_set => icon_set }]) doc = Nokogiri::XML.parse(cfs.last.to_xml_string) assert_equal(1, doc.xpath(".//conditionalFormatting[@sqref='B2:B2']//cfRule[@type='containsText'][@dxfId=0][@priority=1]").size) assert doc.xpath(".//conditionalFormatting//cfRule[@type='containsText'][@dxfId=0][@priority=1]//formula='NOT(ISERROR(SEARCH(\"FALSE\",AB1)))'") @@ -102,11 +102,11 @@ class TestConditionalFormatting < Test::Unit::TestCase end def test_many_options - cf = Axlsx::ConditionalFormatting.new( :sqref => "B3:B4" ) - cf.add_rule({:type => :cellIs, :aboveAverage => false, :bottom => false, :dxfId => 0, + cf = Axlsx::ConditionalFormatting.new(:sqref => "B3:B4") + cf.add_rule({ :type => :cellIs, :aboveAverage => false, :bottom => false, :dxfId => 0, :equalAverage => false, :priority => 2, :operator => :lessThan, :text => "", :percent => false, :rank => 0, :stdDev => 1, :stopIfTrue => true, :timePeriod => :today, - :formula => "0.0"}) + :formula => "0.0" }) doc = Nokogiri::XML.parse(cf.to_xml_string) assert_equal(1, doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage=0][@bottom=0][@dxfId=0][@equalAverage=0][@priority=2][@operator='lessThan'][@text=''][@percent=0][@rank=0][@stdDev=1][@stopIfTrue=1][@timePeriod='today']").size) assert doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage=0][@bottom=0][@dxfId=0][@equalAverage=0][@priority=2][@operator='lessThan'][@text=''][@percent=0][@rank=0][@stdDev=1][@stopIfTrue=1][@timePeriod='today']//formula=0.0") @@ -126,7 +126,7 @@ class TestConditionalFormatting < Test::Unit::TestCase end def test_multiple_formulas - @ws.add_conditional_formatting "B3:B3", { :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :between, :formula => ["1 <> 2","5"] } + @ws.add_conditional_formatting "B3:B3", { :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :between, :formula => ["1 <> 2", "5"] } doc = Nokogiri::XML.parse(@ws.to_xml_string) assert doc.xpath("//xmlns:worksheet/xmlns:conditionalFormatting//xmlns:cfRule[@type='cellIs'][@dxfId=0][@priority=1][@operator='between']//xmlns:formula='1 <> 2'") assert doc.xpath("//xmlns:worksheet/xmlns:conditionalFormatting//xmlns:cfRule[@type='cellIs'][@dxfId=0][@priority=1][@operator='between']//xmlns:formula='5'") diff --git a/test/workbook/worksheet/tc_data_bar.rb b/test/workbook/worksheet/tc_data_bar.rb index 65995dd2..aa39c48b 100644 --- a/test/workbook/worksheet/tc_data_bar.rb +++ b/test/workbook/worksheet/tc_data_bar.rb @@ -12,26 +12,26 @@ class TestDataBar < Test::Unit::TestCase end def test_override_default_cfvos - data_bar = Axlsx::DataBar.new({:color => 'FF00FF00'}, {:type => :min, :val => "20"}) + data_bar = Axlsx::DataBar.new({ :color => 'FF00FF00' }, { :type => :min, :val => "20" }) assert_equal("20", data_bar.value_objects.first.val) assert_equal("0", data_bar.value_objects.last.val) end def test_minLength assert_raise(ArgumentError) { @data_bar.minLength = :invalid_type } - assert_nothing_raised { @data_bar.minLength = 0} + assert_nothing_raised { @data_bar.minLength = 0 } assert_equal(@data_bar.minLength, 0) end def test_maxLength assert_raise(ArgumentError) { @data_bar.maxLength = :invalid_type } - assert_nothing_raised { @data_bar.maxLength = 0} + assert_nothing_raised { @data_bar.maxLength = 0 } assert_equal(@data_bar.maxLength, 0) end def test_showValue assert_raise(ArgumentError) { @data_bar.showValue = :invalid_type } - assert_nothing_raised { @data_bar.showValue = false} + assert_nothing_raised { @data_bar.showValue = false } assert_equal(@data_bar.showValue, false) end diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 0d9a2eb0..59fd34f6 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -12,7 +12,7 @@ class TestDataValidation < Test::Unit::TestCase @error_style_option = { :errorStyle => :warning } @string_options = { :formula1 => 'foo', :formula2 => 'foo', :error => 'foo', :errorTitle => 'foo', :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' } - @symbol_options = { :errorStyle => :warning, :operator => :lessThan, :type => :whole} + @symbol_options = { :errorStyle => :warning, :operator => :lessThan, :type => :whole } @options = @boolean_options.merge(@nil_options).merge(@type_option).merge(@error_style_option) @@ -163,11 +163,11 @@ class TestDataValidation < Test::Unit::TestCase def test_whole_decimal_data_time_textLength_to_xml p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"data_validation" + @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values between 5 and 10'}) + :prompt => 'Only values between 5 and 10' }) doc = Nokogiri::XML.parse(@ws.to_xml_string) @@ -192,11 +192,11 @@ class TestDataValidation < Test::Unit::TestCase def test_list_to_xml p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"data_validation" + @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :list, :formula1 => 'A1:A5', :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values from list', :hideDropDown => true}) + :prompt => 'Only values from list', :hideDropDown => true }) doc = Nokogiri::XML.parse(@ws.to_xml_string) @@ -216,11 +216,11 @@ class TestDataValidation < Test::Unit::TestCase def test_custom_to_xml p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"data_validation" + @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :custom, :formula1 => '=5/2', :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values corresponding formula', :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values corresponding formula'}) + :prompt => 'Only values corresponding formula' }) doc = Nokogiri::XML.parse(@ws.to_xml_string) @@ -239,15 +239,15 @@ class TestDataValidation < Test::Unit::TestCase def test_multiple_datavalidations_to_xml p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"data_validation" + @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values between 5 and 10'}) + :prompt => 'Only values between 5 and 10' }) @ws.add_data_validation("B1", { :type => :list, :formula1 => 'A1:A5', :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values from list', :hideDropDown => true}) + :prompt => 'Only values from list', :hideDropDown => true }) doc = Nokogiri::XML.parse(@ws.to_xml_string) diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index 393a9d1a..cb139d45 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -114,8 +114,8 @@ class TestDateTimeConverter < Test::Unit::TestCase local = Time.parse "2012-01-01 09:00:00 +0900" assert_equal local, utc - assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f/86400, Axlsx::DateTimeConverter::time_to_serial(utc) + assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f / 86400, Axlsx::DateTimeConverter::time_to_serial(utc) Axlsx::Workbook.date1904 = true - assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f/86400, Axlsx::DateTimeConverter::time_to_serial(utc) + assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f / 86400, Axlsx::DateTimeConverter::time_to_serial(utc) end end diff --git a/test/workbook/worksheet/tc_icon_set.rb b/test/workbook/worksheet/tc_icon_set.rb index 483de228..3a4079bf 100644 --- a/test/workbook/worksheet/tc_icon_set.rb +++ b/test/workbook/worksheet/tc_icon_set.rb @@ -14,25 +14,25 @@ class TestIconSet < Test::Unit::TestCase def test_icon_set assert_raise(ArgumentError) { @icon_set.iconSet = "invalid_value" } - assert_nothing_raised { @icon_set.iconSet = "5Rating"} + assert_nothing_raised { @icon_set.iconSet = "5Rating" } assert_equal(@icon_set.iconSet, "5Rating") end def test_percent assert_raise(ArgumentError) { @icon_set.percent = :invalid_type } - assert_nothing_raised { @icon_set.percent = false} + assert_nothing_raised { @icon_set.percent = false } assert_equal(@icon_set.percent, false) end def test_showValue assert_raise(ArgumentError) { @icon_set.showValue = :invalid_type } - assert_nothing_raised { @icon_set.showValue = false} + assert_nothing_raised { @icon_set.showValue = false } assert_equal(@icon_set.showValue, false) end def test_reverse assert_raise(ArgumentError) { @icon_set.reverse = :invalid_type } - assert_nothing_raised { @icon_set.reverse = false} + assert_nothing_raised { @icon_set.reverse = false } assert_equal(@icon_set.reverse, false) end diff --git a/test/workbook/worksheet/tc_page_margins.rb b/test/workbook/worksheet/tc_page_margins.rb index c1f2a626..ba532e7f 100644 --- a/test/workbook/worksheet/tc_page_margins.rb +++ b/test/workbook/worksheet/tc_page_margins.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestPageMargins < Test::Unit::TestCase def setup p = Axlsx::Package.new - ws = p.workbook.add_worksheet :name=>"hmmm" + ws = p.workbook.add_worksheet :name => "hmmm" @pm = ws.page_margins end diff --git a/test/workbook/worksheet/tc_page_setup.rb b/test/workbook/worksheet/tc_page_setup.rb index c7cec18b..b7a36600 100644 --- a/test/workbook/worksheet/tc_page_setup.rb +++ b/test/workbook/worksheet/tc_page_setup.rb @@ -132,9 +132,9 @@ class TestPageSetup < Test::Unit::TestCase fits = @ps.fit_to(:width => 1) assert_equal([1, 999], fits) fits = @ps.fit_to :height => 1 - assert_equal(fits, [999,1]) + assert_equal(fits, [999, 1]) fits = @ps.fit_to :height => 7, :width => 2 assert_equal(fits, [2, 7]) - assert_raise(ArgumentError) { puts @ps.fit_to(:width => true)} + assert_raise(ArgumentError) { puts @ps.fit_to(:width => true) } end end diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb index 85aa14cd..83f8fce6 100644 --- a/test/workbook/worksheet/tc_pivot_table.rb +++ b/test/workbook/worksheet/tc_pivot_table.rb @@ -16,7 +16,7 @@ class TestPivotTable < Test::Unit::TestCase p = Axlsx::Package.new @ws = p.workbook.add_worksheet - @ws << ["Year","Month","Region", "Type", "Sales"] + @ws << ["Year", "Month", "Region", "Type", "Sales"] @ws << [2012, "Nov", "East", "Soda", "12345"] end @@ -54,21 +54,21 @@ class TestPivotTable < Test::Unit::TestCase end assert_equal(['Year', 'Month'], pivot_table.rows) assert_equal(['Type'], pivot_table.columns) - assert_equal([{:ref=>"Sales"}], pivot_table.data) + assert_equal([{ :ref => "Sales" }], pivot_table.data) assert_equal(['Region'], pivot_table.pages) shared_test_pivot_table_xml_validity(pivot_table) end def test_add_pivot_table_with_options_on_data_field pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5') do |pt| - pt.data = [{:ref=>"Sales", :subtotal => 'average'}] + pt.data = [{ :ref => "Sales", :subtotal => 'average' }] end - assert_equal([{:ref=>"Sales", :subtotal => 'average'}], pivot_table.data) + assert_equal([{ :ref => "Sales", :subtotal => 'average' }], pivot_table.data) end def test_add_pivot_table_with_style_info - style_info_data = { :name=>"PivotStyleMedium9", :showRowHeaders=>"1", :showLastColumn=>"0"} - pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', {:style_info=>style_info_data}) do |pt| + style_info_data = { :name => "PivotStyleMedium9", :showRowHeaders => "1", :showLastColumn => "0" } + pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', { :style_info => style_info_data }) do |pt| pt.rows = ['Year', 'Month'] pt.columns = ['Type'] pt.data = ['Sales'] @@ -79,33 +79,33 @@ class TestPivotTable < Test::Unit::TestCase end def test_add_pivot_table_with_row_without_subtotals - pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5', {:no_subtotals_on_headers=>['Year']}) do |pt| + pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5', { :no_subtotals_on_headers => ['Year'] }) do |pt| pt.data = ['Sales'] - pt.rows = ['Year','Month'] + pt.rows = ['Year', 'Month'] end assert_equal(['Year'], pivot_table.no_subtotals_on_headers) end def test_add_pivot_table_with_months_sorted - pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', {:sort_on_headers=>['Month']}) do |pt| + pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', { :sort_on_headers => ['Month'] }) do |pt| pt.data = ['Sales'] - pt.rows = ['Year','Month'] + pt.rows = ['Year', 'Month'] end - assert_equal({'Month' => :ascending}, pivot_table.sort_on_headers) + assert_equal({ 'Month' => :ascending }, pivot_table.sort_on_headers) - pivot_table.sort_on_headers = {'Month' => :descending} - assert_equal({'Month' => :descending}, pivot_table.sort_on_headers) + pivot_table.sort_on_headers = { 'Month' => :descending } + assert_equal({ 'Month' => :descending }, pivot_table.sort_on_headers) shared_test_pivot_table_xml_validity(pivot_table) end def test_header_indices pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') - assert_equal(0, pivot_table.header_index_of('Year' )) - assert_equal(1, pivot_table.header_index_of('Month' )) - assert_equal(2, pivot_table.header_index_of('Region' )) - assert_equal(3, pivot_table.header_index_of('Type' )) - assert_equal(4, pivot_table.header_index_of('Sales' )) + assert_equal(0, pivot_table.header_index_of('Year')) + assert_equal(1, pivot_table.header_index_of('Month')) + assert_equal(2, pivot_table.header_index_of('Region')) + assert_equal(3, pivot_table.header_index_of('Type')) + assert_equal(4, pivot_table.header_index_of('Sales')) assert_equal(nil, pivot_table.header_index_of('Missing')) assert_equal(%w(A1 B1 C1 D1 E1), pivot_table.header_cell_refs) end @@ -129,7 +129,7 @@ class TestPivotTable < Test::Unit::TestCase end def test_to_xml_string - pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', {:no_subtotals_on_headers=>['Year']}) do |pt| + pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', { :no_subtotals_on_headers => ['Year'] }) do |pt| pt.rows = ['Year', 'Month'] pt.columns = ['Type'] pt.data = ['Sales'] @@ -140,14 +140,14 @@ class TestPivotTable < Test::Unit::TestCase def test_to_xml_string_with_options_on_data_field pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt| - pt.data = [{:ref=>"Sales", :subtotal => 'average'}] + pt.data = [{ :ref => "Sales", :subtotal => 'average' }] end shared_test_pivot_table_xml_validity(pivot_table) end def test_add_pivot_table_with_format_options_on_data_field pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt| - pt.data = [{:ref=>"Sales", :subtotal => 'sum', num_fmt: 4}] + pt.data = [{ :ref => "Sales", :subtotal => 'sum', num_fmt: 4 }] end doc = Nokogiri::XML(pivot_table.to_xml_string) assert_equal('4', doc.at_css('dataFields dataField')['numFmtId'], 'adding format options to pivot_table') @@ -159,9 +159,9 @@ class TestPivotTable < Test::Unit::TestCase pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt| pt.rows = ["Date", "Name"] pt.data = [ - {ref: "Gross amount", num_fmt: 2}, - {ref: "Net amount", num_fmt: 2}, - {ref: "Margin", num_fmt: 2} + { ref: "Gross amount", num_fmt: 2 }, + { ref: "Net amount", num_fmt: 2 }, + { ref: "Margin", num_fmt: 2 } ] end @@ -177,8 +177,8 @@ class TestPivotTable < Test::Unit::TestCase assert_equal('-2', doc.at_css('colFields field')['x']) assert_equal('3', doc.at_css('colItems')['count']) - assert_equal( 3, doc.at_css('colItems').children.size) - assert_nil( doc.at_css('colItems i')['x']) + assert_equal(3, doc.at_css('colItems').children.size) + assert_nil(doc.at_css('colItems i')['x']) assert_equal('1', doc.at_css('colItems i[i=1] x')['v']) assert_equal('2', doc.at_css('colItems i[i=2] x')['v']) end @@ -189,7 +189,7 @@ class TestPivotTable < Test::Unit::TestCase pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt| pt.rows = ["Date", "Name"] pt.data = [ - {ref: "Gross amount", num_fmt: 2} + { ref: "Gross amount", num_fmt: 2 } ] end diff --git a/test/workbook/worksheet/tc_pivot_table_cache_definition.rb b/test/workbook/worksheet/tc_pivot_table_cache_definition.rb index 37d7e485..2127c4b3 100644 --- a/test/workbook/worksheet/tc_pivot_table_cache_definition.rb +++ b/test/workbook/worksheet/tc_pivot_table_cache_definition.rb @@ -5,7 +5,7 @@ class TestPivotTableCacheDefinition < Test::Unit::TestCase p = Axlsx::Package.new @ws = p.workbook.add_worksheet 5.times do - @ws << ["aa","aa","aa","aa"] + @ws << ["aa", "aa", "aa", "aa"] end @pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5') @cache_definition = @pivot_table.cache_definition diff --git a/test/workbook/worksheet/tc_protected_range.rb b/test/workbook/worksheet/tc_protected_range.rb index 52d07d77..6d609097 100644 --- a/test/workbook/worksheet/tc_protected_range.rb +++ b/test/workbook/worksheet/tc_protected_range.rb @@ -2,11 +2,11 @@ require 'tc_helper.rb' class TestProtectedRange < Test::Unit::TestCase def setup @p = Axlsx::Package.new - @ws = @p.workbook.add_worksheet { |sheet| sheet.add_row [1,2,3,4,5,6,7,8,9] } + @ws = @p.workbook.add_worksheet { |sheet| sheet.add_row [1, 2, 3, 4, 5, 6, 7, 8, 9] } end def test_initialize_options - assert_nothing_raised {Axlsx::ProtectedRange.new(:sqref => 'A1:B1', :name => "only bob")} + assert_nothing_raised { Axlsx::ProtectedRange.new(:sqref => 'A1:B1', :name => "only bob") } end def test_range diff --git a/test/workbook/worksheet/tc_rich_text.rb b/test/workbook/worksheet/tc_rich_text.rb index 1bd3ec76..34117b1b 100644 --- a/test/workbook/worksheet/tc_rich_text.rb +++ b/test/workbook/worksheet/tc_rich_text.rb @@ -8,7 +8,7 @@ class RichText < Test::Unit::TestCase @rt = Axlsx::RichText.new b = true (0..26).each do |r| - @rt.add_run "run #{r}, ", :b => (b=!b), :i => !b + @rt.add_run "run #{r}, ", :b => (b = !b), :i => !b end @row = @ws.add_row [@rt] @c = @row.first @@ -22,7 +22,7 @@ class RichText < Test::Unit::TestCase assert_equal(rt_direct.runs.length, 1) assert_equal(rt_indirect.runs.length, 1) row = @ws.add_row [rt_direct, rt_indirect] - assert_equal(row[0].to_xml_string(0,0), row[1].to_xml_string(0,0)) + assert_equal(row[0].to_xml_string(0, 0), row[1].to_xml_string(0, 0)) end def test_textruns @@ -39,6 +39,6 @@ class RichText < Test::Unit::TestCase row_rt = @ws.add_row [rt] row_imp = @ws.add_row ['a'] row_imp[0].b = true - assert_equal(row_rt[0].to_xml_string(0,0), row_imp[0].to_xml_string(0,0)) + assert_equal(row_rt[0].to_xml_string(0, 0), row_imp[0].to_xml_string(0, 0)) end end diff --git a/test/workbook/worksheet/tc_rich_text_run.rb b/test/workbook/worksheet/tc_rich_text_run.rb index 39919a31..d21329a9 100644 --- a/test/workbook/worksheet/tc_rich_text_run.rb +++ b/test/workbook/worksheet/tc_rich_text_run.rb @@ -106,7 +106,7 @@ class RichTextRun < Test::Unit::TestCase assert_raise(ArgumentError) { @c.u = -1.1 } assert_nothing_raised { @c.u = :single } assert_equal(@c.u, :single) - doc = Nokogiri::XML(@c.to_xml_string(1,1)) + doc = Nokogiri::XML(@c.to_xml_string(1, 1)) assert(doc.xpath('//u[@val="single"]')) end @@ -141,7 +141,7 @@ class RichTextRun < Test::Unit::TestCase end def test_multiline_autowidth - wrap = @p.workbook.styles.add_style({:alignment => {:wrap_text => true}}) + wrap = @p.workbook.styles.add_style({ :alignment => { :wrap_text => true } }) awtr = Axlsx::RichTextRun.new('I\'m bold' + "\n", :b => true) rt = Axlsx::RichText.new rt.runs << awtr diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb index 900e751e..29c4415b 100644 --- a/test/workbook/worksheet/tc_row.rb +++ b/test/workbook/worksheet/tc_row.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestRow < Test::Unit::TestCase def setup p = Axlsx::Package.new - @ws = p.workbook.add_worksheet :name=>"hmmm" + @ws = p.workbook.add_worksheet :name => "hmmm" @row = @ws.add_row end @@ -15,19 +15,19 @@ class TestRow < Test::Unit::TestCase end def test_initialize_with_fixed_height - row = @ws.add_row([1,2,3,4,5], :height=>40) + row = @ws.add_row([1, 2, 3, 4, 5], :height => 40) assert_equal(40, row.height) assert(row.custom_height) end def test_style - r = @ws.add_row([1,2,3,4,5]) - r.style=1 - r.cells.each { |c| assert_equal(c.style,1) } + r = @ws.add_row([1, 2, 3, 4, 5]) + r.style = 1 + r.cells.each { |c| assert_equal(c.style, 1) } end def test_color - r = @ws.add_row([1,2,3,4,5]) + r = @ws.add_row([1, 2, 3, 4, 5]) r.color = "FF00FF00" r.cells.each { |c| assert_equal(c.color.rgb, "FF00FF00") } end @@ -48,12 +48,12 @@ class TestRow < Test::Unit::TestCase end def test_array_to_cells - r = @ws.add_row [1,2,3], :style=>1, :types=>[:integer, :string, :float] + r = @ws.add_row [1, 2, 3], :style => 1, :types => [:integer, :string, :float] assert_equal(r.cells.size, 3) r.cells.each do |c| assert_equal(c.style, 1) end - r = @ws.add_row [1,2,3], :style=>[1] + r = @ws.add_row [1, 2, 3], :style => [1] assert_equal(r.cells.first.style, 1, "only apply style to cells with at the same index of of the style array") assert_equal(r.cells.last.style, 0, "only apply style to cells with at the same index of of the style array") end @@ -135,7 +135,7 @@ class TestRow < Test::Unit::TestCase def test_offsets offset = 3 - values = [1,2,3,4,5] + values = [1, 2, 3, 4, 5] r = @ws.add_row(values, offset: offset, style: 1) r.cells.each_with_index do |c, index| assert_equal(c.style, index < offset ? 0 : 1) @@ -145,11 +145,11 @@ class TestRow < Test::Unit::TestCase def test_offsets_with_styles offset = 3 - values = [1,2,3,4,5] - styles = (1..5).map{ @ws.workbook.styles.add_style } + values = [1, 2, 3, 4, 5] + styles = (1..5).map { @ws.workbook.styles.add_style } r = @ws.add_row(values, offset: offset, style: styles) r.cells.each_with_index do |c, index| - assert_equal(c.style, index < offset ? 0 : styles[index-offset]) + assert_equal(c.style, index < offset ? 0 : styles[index - offset]) assert_equal(c.value, index < offset ? nil : values[index - offset]) end end diff --git a/test/workbook/worksheet/tc_sheet_format_pr.rb b/test/workbook/worksheet/tc_sheet_format_pr.rb index ef4eb0d8..48643bc6 100644 --- a/test/workbook/worksheet/tc_sheet_format_pr.rb +++ b/test/workbook/worksheet/tc_sheet_format_pr.rb @@ -45,31 +45,31 @@ class TestSheetFormatPr < Test::Unit::TestCase def test_default_row_height assert_raise(ArgumentError) { @sheet_format_pr.default_row_height = :foo } - assert_nothing_raised { @sheet_format_pr.default_row_height= 1.0 } + assert_nothing_raised { @sheet_format_pr.default_row_height = 1.0 } end def test_default_col_width - assert_raise(ArgumentError) { @sheet_format_pr.default_col_width= :foo } + assert_raise(ArgumentError) { @sheet_format_pr.default_col_width = :foo } assert_nothing_raised { @sheet_format_pr.default_col_width = 1.0 } end def test_custom_height - assert_raise(ArgumentError) { @sheet_format_pr.custom_height= :foo } + assert_raise(ArgumentError) { @sheet_format_pr.custom_height = :foo } assert_nothing_raised { @sheet_format_pr.custom_height = true } end def test_zero_height - assert_raise(ArgumentError) { @sheet_format_pr.zero_height= :foo } + assert_raise(ArgumentError) { @sheet_format_pr.zero_height = :foo } assert_nothing_raised { @sheet_format_pr.zero_height = true } end def test_thick_top - assert_raise(ArgumentError) { @sheet_format_pr.thick_top= :foo } + assert_raise(ArgumentError) { @sheet_format_pr.thick_top = :foo } assert_nothing_raised { @sheet_format_pr.thick_top = true } end def test_thick_bottom - assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom= :foo } + assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom = :foo } assert_nothing_raised { @sheet_format_pr.thick_bottom = true } end diff --git a/test/workbook/worksheet/tc_sheet_pr.rb b/test/workbook/worksheet/tc_sheet_pr.rb index f6ffcfdb..70ce0428 100644 --- a/test/workbook/worksheet/tc_sheet_pr.rb +++ b/test/workbook/worksheet/tc_sheet_pr.rb @@ -20,7 +20,7 @@ class TestSheetPr < Test::Unit::TestCase def test_initialization @options.each do |key, value| - if key==:tab_color + if key == :tab_color stored_value = @sheet_pr.send(key) assert_equal Axlsx::Color, stored_value.class assert_equal value, stored_value.rgb diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb index 26297bc4..8d5452cc 100644 --- a/test/workbook/worksheet/tc_sheet_protection.rb +++ b/test/workbook/worksheet/tc_sheet_protection.rb @@ -55,7 +55,7 @@ class TestSheetProtection < Test::Unit::TestCase @sp.password = 'fish' # -> CA3F doc = Nokogiri::XML(@sp.to_xml_string) @options.each do |key, value| - assert(doc.xpath("//sheetProtection[@#{key.to_s.gsub(/_(.)/){ $1.upcase }}='#{value}']")) + assert(doc.xpath("//sheetProtection[@#{key.to_s.gsub(/_(.)/) { $1.upcase }}='#{value}']")) end end end diff --git a/test/workbook/worksheet/tc_table.rb b/test/workbook/worksheet/tc_table.rb index 1a90f0bc..7a2e5987 100644 --- a/test/workbook/worksheet/tc_table.rb +++ b/test/workbook/worksheet/tc_table.rb @@ -5,7 +5,7 @@ class TestTable < Test::Unit::TestCase p = Axlsx::Package.new @ws = p.workbook.add_worksheet 40.times do - @ws << ["aa","aa","aa","aa","aa","aa"] + @ws << ["aa", "aa", "aa", "aa", "aa", "aa"] end end diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb index 19beaaba..2067959c 100644 --- a/test/workbook/worksheet/tc_table_style_info.rb +++ b/test/workbook/worksheet/tc_table_style_info.rb @@ -7,7 +7,7 @@ class TestTableStyleInfo < Test::Unit::TestCase 40.times do @ws.add_row %w(aa bb cc dd ee ff gg hh ii jj kk) end - @table = @ws.add_table(Axlsx::cell_range([@ws.rows.first.cells.first,@ws.rows.last.cells.last], false), :name => 'foo') + @table = @ws.add_table(Axlsx::cell_range([@ws.rows.first.cells.first, @ws.rows.last.cells.last], false), :name => 'foo') @options = { :show_first_column => 1, :show_last_column => 1, :show_row_stripes => 1, diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 8475f5aa..bae9f904 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -29,7 +29,7 @@ class TestWorksheet < Test::Unit::TestCase end def test_name_unique - assert_raise(ArgumentError, "worksheet name must be unique") { n = @ws.name; @ws.workbook.add_worksheet(:name=> n) } + assert_raise(ArgumentError, "worksheet name must be unique") { n = @ws.name; @ws.workbook.add_worksheet(:name => n) } end def test_name_unique_only_checks_other_worksheet_names @@ -107,15 +107,15 @@ class TestWorksheet < Test::Unit::TestCase def test_no_autowidth @ws.workbook.use_autowidth = false - @ws.add_row [1,2,3,4] + @ws.add_row [1, 2, 3, 4] assert_equal(@ws.column_info[0].width, nil) end def test_initialization_options - page_margins = {:left => 2, :right => 2, :bottom => 2, :top => 2, :header => 2, :footer => 2} - page_setup = {:fit_to_height => 1, :fit_to_width => 1, :orientation => :landscape, :paper_width => "210mm", :paper_height => "297mm", :scale => 80} - print_options = {:grid_lines => true, :headings => true, :horizontal_centered => true, :vertical_centered => true} - header_footer = {:different_first => false, :different_odd_even => false, :odd_header => 'Header'} + page_margins = { :left => 2, :right => 2, :bottom => 2, :top => 2, :header => 2, :footer => 2 } + page_setup = { :fit_to_height => 1, :fit_to_width => 1, :orientation => :landscape, :paper_width => "210mm", :paper_height => "297mm", :scale => 80 } + print_options = { :grid_lines => true, :headings => true, :horizontal_centered => true, :vertical_centered => true } + header_footer = { :different_first => false, :different_odd_even => false, :odd_header => 'Header' } optioned = @ws.workbook.add_worksheet(:name => 'bob', :page_margins => page_margins, :page_setup => page_setup, :print_options => print_options, :header_footer => header_footer) page_margins.keys.each do |key| assert_equal(page_margins[key], optioned.page_margins.send(key)) @@ -175,8 +175,8 @@ class TestWorksheet < Test::Unit::TestCase range = @ws["A1:C2"] first_row = @ws[0] last_row = @ws[1] - assert_equal(@ws.rows[0],first_row) - assert_equal(@ws.rows[1],last_row) + assert_equal(@ws.rows[0], first_row) + assert_equal(@ws.rows[1], last_row) assert_equal(range.size, 6) assert_equal(range.first, @ws.rows.first.cells.first) assert_equal(range.last, @ws.rows.last.cells.last) @@ -184,7 +184,7 @@ class TestWorksheet < Test::Unit::TestCase def test_add_row assert(@ws.rows.empty?, "sheet has no rows by default") - r = @ws.add_row([1,2,3]) + r = @ws.add_row([1, 2, 3]) assert_equal(@ws.rows.size, 1, "add_row adds a row") assert_equal(@ws.rows.first, r, "the row returned is the row added") end @@ -227,11 +227,11 @@ class TestWorksheet < Test::Unit::TestCase end def test_col_style - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3,4] - @ws.col_style( (1..2), 1, :row_offset=>1) + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3, 4] + @ws.col_style((1..2), 1, :row_offset => 1) @ws.rows[(1..-1)].each do |r| assert_equal(r.cells[1].style, 1) assert_equal(r.cells[2].style, 1) @@ -241,41 +241,41 @@ class TestWorksheet < Test::Unit::TestCase end def test_col_style_with_empty_column - @ws.add_row [1,2,3,4] + @ws.add_row [1, 2, 3, 4] @ws.add_row [1] - @ws.add_row [1,2,3,4] - assert_nothing_raised {@ws.col_style(1, 1)} + @ws.add_row [1, 2, 3, 4] + assert_nothing_raised { @ws.col_style(1, 1) } end def test_cols - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3] - @ws.add_row [1,2,3,4] + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3] + @ws.add_row [1, 2, 3, 4] c = @ws.cols[1] assert_equal(c.size, 4) assert_equal(c[0].value, 2) end def test_cols_with_block - @ws.add_row [1,2,3] + @ws.add_row [1, 2, 3] @ws.add_row [1] - cols = @ws.cols {|row, column| :foo } + cols = @ws.cols { |row, column| :foo } assert_equal(:foo, cols[1][1]) end def test_row_style - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3,4] - @ws.add_row [1,2,3,4] - @ws.row_style 1, 1, :col_offset=>1 + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3, 4] + @ws.add_row [1, 2, 3, 4] + @ws.row_style 1, 1, :col_offset => 1 @ws.rows[1].cells[(1..-1)].each do |c| assert_equal(c.style, 1) end assert_equal(@ws.rows[1].cells[0].style, 0) assert_equal(@ws.rows[2].cells[1].style, 0) - @ws.row_style( 1..2, 1, :col_offset => 2) + @ws.row_style(1..2, 1, :col_offset => 2) @ws.rows[(1..2)].each do |r| r.cells[(2..-1)].each do |c| assert_equal(c.style, 1) @@ -290,7 +290,7 @@ class TestWorksheet < Test::Unit::TestCase # end def test_to_xml_string_dimensions - @ws.add_row [1,2,3] + @ws.add_row [1, 2, 3] doc = Nokogiri::XML(@ws.to_xml_string) assert_equal(doc.xpath('//xmlns:worksheet/xmlns:dimension[@ref="A1:C1"]').size, 1) end @@ -414,7 +414,7 @@ class TestWorksheet < Test::Unit::TestCase def test_to_xml_string schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD)) doc = Nokogiri::XML(@ws.to_xml_string) - assert(schema.validate(doc).map{ |e| puts e.message; e }.empty?, "error free validation") + assert(schema.validate(doc).map { |e| puts e.message; e }.empty?, "error free validation") end def test_styles @@ -424,7 +424,7 @@ class TestWorksheet < Test::Unit::TestCase def test_to_xml_string_with_illegal_chars old = Axlsx::trust_input Axlsx::trust_input = false - nasties = "\v\u2028\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u001f" + nasties = "\v\u2028\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u001f" @ws.add_row [nasties] assert_equal(0, @ws.rows.last.cells.last.value.index("\v")) assert_equal(nil, @ws.to_xml_string.index("\v")) @@ -455,7 +455,7 @@ class TestWorksheet < Test::Unit::TestCase end def test_relationships - @ws.add_row [1,2,3] + @ws.add_row [1, 2, 3] assert(@ws.relationships.empty?, "No Drawing relationship until you add a chart") @ws.add_chart Axlsx::Pie3DChart assert_equal(@ws.relationships.size, 1, "adding a chart creates the relationship") @@ -529,14 +529,14 @@ class TestWorksheet < Test::Unit::TestCase def test_protect_range_with_cells @ws.add_row [1, 2, 3] - assert_nothing_raised {@ws.protect_range(@ws.rows.first.cells) } + assert_nothing_raised { @ws.protect_range(@ws.rows.first.cells) } assert_equal('A1:C1', @ws.send(:protected_ranges).last.sqref) end def test_merge_cells - @ws.add_row [1,2,3] - @ws.add_row [4,5,6] - @ws.add_row [7,8,9] + @ws.add_row [1, 2, 3] + @ws.add_row [4, 5, 6] + @ws.add_row [7, 8, 9] @ws.merge_cells "A1:A2" @ws.merge_cells "B2:C3" @ws.merge_cells @ws.rows.last.cells[(0..1)] @@ -554,12 +554,12 @@ class TestWorksheet < Test::Unit::TestCase def test_auto_filter assert(@ws.auto_filter.range.nil?) - assert(@wb.defined_names.none?{|defined_name| defined_name.name=='_xlnm._FilterDatabase'}) + assert(@wb.defined_names.none? { |defined_name| defined_name.name == '_xlnm._FilterDatabase' }) assert_raise(ArgumentError) { @ws.auto_filter = 123 } @ws.auto_filter.range = "A1:D9" assert_equal(@ws.auto_filter.range, "A1:D9") @ws.to_xml_string - assert(@wb.defined_names.any?{|defined_name| defined_name.name=='_xlnm._FilterDatabase'}) + assert(@wb.defined_names.any? { |defined_name| defined_name.name == '_xlnm._FilterDatabase' }) end def test_auto_filter_assign @@ -567,7 +567,7 @@ class TestWorksheet < Test::Unit::TestCase assert(@ws.auto_filter.range.nil?) assert(other_ws.auto_filter.range.nil?) - assert(@wb.defined_names.none?{|defined_name| defined_name.name=='_xlnm._FilterDatabase'}) + assert(@wb.defined_names.none? { |defined_name| defined_name.name == '_xlnm._FilterDatabase' }) assert_raise(ArgumentError) { @ws.auto_filter = 123 } @ws.auto_filter = "A1:D9" @@ -579,7 +579,7 @@ class TestWorksheet < Test::Unit::TestCase @ws.to_xml_string other_ws.to_xml_string - filter_database = @wb.defined_names.select{|defined_name| defined_name.name=='_xlnm._FilterDatabase'} + filter_database = @wb.defined_names.select { |defined_name| defined_name.name == '_xlnm._FilterDatabase' } assert_equal(2, filter_database.size) assert_equal(@ws.index, filter_database[0].local_sheet_id) assert_equal(other_ws.index, filter_database[1].local_sheet_id) @@ -593,7 +593,7 @@ class TestWorksheet < Test::Unit::TestCase end def test_outline_level_rows - 3.times { @ws.add_row [1,2,3] } + 3.times { @ws.add_row [1, 2, 3] } @ws.outline_level_rows 0, 2 assert_equal(1, @ws.rows[0].outline_level) assert_equal(true, @ws.rows[2].hidden) @@ -601,7 +601,7 @@ class TestWorksheet < Test::Unit::TestCase end def test_outline_level_columns - 3.times { @ws.add_row [1,2,3] } + 3.times { @ws.add_row [1, 2, 3] } @ws.outline_level_columns 0, 2 assert_equal(1, @ws.column_info[0].outline_level) assert_equal(true, @ws.column_info[2].hidden) @@ -717,16 +717,16 @@ class TestWorksheet < Test::Unit::TestCase wb.add_worksheet do |sheet| 20.times.each do - sheet.add_row [1,2,3,4,5] + sheet.add_row [1, 2, 3, 4, 5] end sheet.add_border "B2:D5" - sheet.add_border ["C3:C4", "D3:D4", "A2"], {color: "FF00000"} + sheet.add_border ["C3:C4", "D3:D4", "A2"], { color: "FF00000" } sheet.add_border "B10:E10", [:top, :bottom, :left, :right] sheet.add_border "B12:E12", :all sheet.add_border "B14:E14", Axlsx::Border::EDGES - sheet.add_border "B16:E16", {edges: :all, style: :thick} - sheet.add_border "B18:E18", {edges: [:top], style: :thick, color: "FFFFF00"} + sheet.add_border "B16:E16", { edges: :all, style: :thick } + sheet.add_border "B18:E18", { edges: [:top], style: :thick, color: "FFFFF00" } end wb.apply_styles @@ -786,7 +786,7 @@ class TestWorksheet < Test::Unit::TestCase sz: 11, family: 1 } - assert_equal b2_cell_style, wb.styles.style_index.values.find{|x| x == b2_cell_style} + assert_equal b2_cell_style, wb.styles.style_index.values.find { |x| x == b2_cell_style } d3_cell_style = { border: { @@ -799,7 +799,7 @@ class TestWorksheet < Test::Unit::TestCase sz: 11, family: 1 } - assert_equal d3_cell_style, wb.styles.style_index.values.find{|x| x == d3_cell_style} + assert_equal d3_cell_style, wb.styles.style_index.values.find { |x| x == d3_cell_style } end def test_mixed_borders_1 @@ -872,7 +872,7 @@ class TestWorksheet < Test::Unit::TestCase wb.styles.fonts[0].sz = 12 wb.add_worksheet do |sheet| - sheet.add_row [1,2,3] + sheet.add_row [1, 2, 3] sheet.add_style "A1:C1", { color: "FFFFFF" } end -- cgit v1.2.3 From 48f392fb7752f14153126e9d154b4f9e2eef8fa7 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 8 Apr 2023 11:55:52 +0200 Subject: Fix Layout/EmptyLineAfterGuardClause offenses ``` rubocop --only Layout/EmptyLineAfterGuardClause -a ``` --- .rubocop_todo.yml | 5 ----- lib/axlsx/drawing/axes.rb | 1 + lib/axlsx/drawing/d_lbls.rb | 5 +++++ lib/axlsx/drawing/pic.rb | 4 ++++ lib/axlsx/drawing/view_3D.rb | 1 + lib/axlsx/drawing/vml_drawing.rb | 1 + lib/axlsx/package.rb | 3 +++ lib/axlsx/stylesheet/color.rb | 1 + lib/axlsx/stylesheet/styles.rb | 4 ++++ lib/axlsx/util/serialized_attributes.rb | 1 + lib/axlsx/util/simple_typed_list.rb | 7 +++++++ lib/axlsx/util/validators.rb | 1 + lib/axlsx/workbook/defined_name.rb | 1 + lib/axlsx/workbook/defined_names.rb | 1 + lib/axlsx/workbook/workbook.rb | 1 + lib/axlsx/workbook/workbook_views.rb | 1 + lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb | 4 ++++ lib/axlsx/workbook/worksheet/auto_filter/filters.rb | 3 +++ lib/axlsx/workbook/worksheet/cell.rb | 3 +++ lib/axlsx/workbook/worksheet/cell_serializer.rb | 1 + lib/axlsx/workbook/worksheet/cfvo.rb | 1 + lib/axlsx/workbook/worksheet/col.rb | 1 + lib/axlsx/workbook/worksheet/col_breaks.rb | 1 + lib/axlsx/workbook/worksheet/cols.rb | 2 ++ lib/axlsx/workbook/worksheet/comment.rb | 1 + lib/axlsx/workbook/worksheet/comments.rb | 2 ++ lib/axlsx/workbook/worksheet/conditional_formattings.rb | 2 ++ lib/axlsx/workbook/worksheet/data_validations.rb | 2 ++ lib/axlsx/workbook/worksheet/dimension.rb | 3 +++ lib/axlsx/workbook/worksheet/merged_cells.rb | 2 ++ lib/axlsx/workbook/worksheet/page_margins.rb | 1 + lib/axlsx/workbook/worksheet/pivot_tables.rb | 2 ++ lib/axlsx/workbook/worksheet/protected_ranges.rb | 2 ++ lib/axlsx/workbook/worksheet/rich_text_run.rb | 3 +++ lib/axlsx/workbook/worksheet/row_breaks.rb | 1 + lib/axlsx/workbook/worksheet/sheet_data.rb | 1 + lib/axlsx/workbook/worksheet/sheet_pr.rb | 1 + lib/axlsx/workbook/worksheet/sheet_protection.rb | 1 + lib/axlsx/workbook/worksheet/tables.rb | 3 +++ lib/axlsx/workbook/worksheet/worksheet.rb | 5 +++++ lib/axlsx/workbook/worksheet/worksheet_comments.rb | 3 +++ lib/axlsx/workbook/worksheet/worksheet_drawing.rb | 3 +++ lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb | 1 + lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb | 2 ++ 44 files changed, 90 insertions(+), 5 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 08ae966d..f0d4799e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -36,11 +36,6 @@ Layout/ArgumentAlignment: - 'lib/axlsx/workbook/worksheet/sheet_view.rb' - 'lib/axlsx/workbook/worksheet/table_style_info.rb' -# Offense count: 90 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLineAfterGuardClause: - Enabled: false - # Offense count: 58 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb index 0e4403ab..314f28c3 100644 --- a/lib/axlsx/drawing/axes.rb +++ b/lib/axlsx/drawing/axes.rb @@ -8,6 +8,7 @@ module Axlsx # must come first (we assume a Ruby 1.9+ Hash or an OrderedHash). def initialize(options = {}) raise(ArgumentError, "CatAxis must come first") if options.keys.include?(:cat_axis) && options.keys.first != :cat_axis + options.each do |name, axis_class| add_axis(name, axis_class) end diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index d997d9a9..213008e6 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -10,6 +10,7 @@ module Axlsx # creates a new DLbls object def initialize(chart_type, options = {}) raise ArgumentError, 'chart_type must inherit from Chart' unless [Chart, LineChart].include?(chart_type.superclass) + @chart_type = chart_type initialize_defaults parse_options options @@ -49,6 +50,7 @@ module Axlsx # @return [Symbol] def d_lbl_pos return unless [Pie3DChart, LineChart].include? @chart_type + @d_lbl_pos ||= :bestFit end @@ -60,6 +62,7 @@ module Axlsx # @param [Symbol] label_position the postion you want to use. def d_lbl_pos=(label_position) return unless [Pie3DChart, LineChart].include? @chart_type + Axlsx::RestrictionValidator.validate 'DLbls#d_lbl_pos', [:bestFit, :b, :ctr, :inBase, :inEnd, :l, :outEnd, :r, :t], label_position @d_lbl_pos = label_position end @@ -72,6 +75,7 @@ module Axlsx instance_vals = Axlsx.instance_values_for(self) %w(d_lbl_pos show_legend_key show_val show_cat_name show_ser_name show_percent show_bubble_size show_leader_lines).each do |key| next unless instance_vals.keys.include?(key) && instance_vals[key] != nil + str << "" end str << '' @@ -80,6 +84,7 @@ module Axlsx # nills out d_lbl_pos and show_leader_lines as these attributes, while valid in the spec actually chrash excel for any chart type other than pie charts. def validate_attributes_for_chart_type return if [Pie3DChart, LineChart].include? @chart_type + @d_lbl_pos = nil @show_leader_lines = nil end diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 7d9cb532..64e5a877 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -73,6 +73,7 @@ module Axlsx Axlsx::validate_string(v) RestrictionValidator.validate 'Pic.image_src', ALLOWED_MIME_TYPES, MimeTypeUtils.get_mime_type(v) raise ArgumentError, "File does not exist" unless File.exist?(v) + @image_src = v end @@ -116,6 +117,7 @@ module Axlsx # @see OneCellAnchor.width def width return unless @anchor.is_a?(OneCellAnchor) + @anchor.width end @@ -187,6 +189,7 @@ module Axlsx # Changes the anchor to a one cell anchor. def use_one_cell_anchor return if @anchor.is_a?(OneCellAnchor) + new_anchor = OneCellAnchor.new(@anchor.drawing, :start_at => [@anchor.from.col, @anchor.from.row]) swap_anchor(new_anchor) end @@ -194,6 +197,7 @@ module Axlsx #changes the anchor type to a two cell anchor def use_two_cell_anchor return if @anchor.is_a?(TwoCellAnchor) + new_anchor = TwoCellAnchor.new(@anchor.drawing, :start_at => [@anchor.from.col, @anchor.from.row]) swap_anchor(new_anchor) end diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 1adf9e28..23bd4952 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -108,6 +108,7 @@ module Axlsx def element_for_attribute(name, namespace = '') val = Axlsx.instance_values_for(self)[name] return "" if val == nil + "<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val] end end diff --git a/lib/axlsx/drawing/vml_drawing.rb b/lib/axlsx/drawing/vml_drawing.rb index e314b736..4e9c5b0d 100644 --- a/lib/axlsx/drawing/vml_drawing.rb +++ b/lib/axlsx/drawing/vml_drawing.rb @@ -5,6 +5,7 @@ module Axlsx # @param [Comments] comments the comments object this drawing is associated with def initialize(comments) raise ArgumentError, "you must provide a comments object" unless comments.is_a?(Comments) + @comments = comments end diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index f249073c..a0a77949 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -105,6 +105,7 @@ module Axlsx confirm_valid, zip_command = parse_serialize_options(options, secondary_options) return false unless !confirm_valid || self.validate.empty? + zip_provider = if zip_command ZipCommand.new(zip_command) else @@ -128,6 +129,7 @@ module Axlsx end return false unless !confirm_valid || self.validate.empty? + Relationship.initialize_ids_cache zip = write_parts(Zip::OutputStream.new(StringIO.new.binmode, true)) stream = zip.close_buffer @@ -383,6 +385,7 @@ module Axlsx if invalid_keys.any? raise ArgumentError.new("Invalid keyword arguments: #{invalid_keys}") end + [options.fetch(:confirm_valid, false), options.fetch(:zip_command, nil)] else warn "[DEPRECATION] Axlsx::Package#serialize with confirm_valid as a boolean is deprecated. " + diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index 28afaf11..4f358a78 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -54,6 +54,7 @@ module Axlsx v = v * 3 if v.size == 2 v = v.rjust(8, 'FF') raise ArgumentError, "Invalid color rgb value: #{v}." unless v.match(/[0-9A-F]{8}/) + @rgb = v end diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index e55e2c95..2a210776 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -292,6 +292,7 @@ module Axlsx # @return [CellProtection] def parse_protection_options(options = {}) return if (options.keys & [:hidden, :locked]).empty? + CellProtection.new(options) end @@ -302,6 +303,7 @@ module Axlsx # @see CellAlignment def parse_alignment_options(options = {}) return unless options[:alignment] + CellAlignment.new options[:alignment] end @@ -322,6 +324,7 @@ module Axlsx # @return [Font|Integer] def parse_font_options(options = {}) return if (options.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty? + Axlsx.instance_values_for(fonts.first).each do |key, value| # Thanks for that 1.8.7 - cant do a simple merge... options[key.to_sym] = value unless options.keys.include?(key.to_sym) @@ -338,6 +341,7 @@ module Axlsx # @return [Fill|Integer] def parse_fill_options(options = {}) return unless options[:bg_color] + color = Color.new(:rgb => options[:bg_color]) dxf = options[:type] == :dxf color_key = dxf ? :bgColor : :fgColor diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index 9d46de75..eeac6e74 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -77,6 +77,7 @@ module Axlsx attrs.each do |attribute_name| value = values[attribute_name.to_s] next if value.nil? + value = yield value if block_given? element_name = Axlsx.camel(attribute_name, false) str << "<#{element_name}>#{value}" diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 36651f1f..51b8a8d5 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -12,6 +12,7 @@ module Axlsx @allowed_types = type else raise ArgumentError, "Type must be a Class object or array of Class objects" unless type.is_a? Class + @allowed_types = [type] end @serialize_as = serialize_as unless serialize_as.nil? @@ -37,6 +38,7 @@ module Axlsx # any non populated cell in the matrix will be a nil value def transpose return @list.clone if @list.size == 0 + row_count = @list.size max_column_count = @list.map { |row| row.cells.size }.max result = Array.new(max_column_count) { Array.new(row_count) } @@ -105,6 +107,7 @@ module Axlsx def delete(v) return unless include? v raise ArgumentError, "Item is protected and cannot be deleted" if protected? index(v) + @list.delete v end @@ -114,6 +117,7 @@ module Axlsx def delete_at(index) @list[index] raise ArgumentError, "Item is protected and cannot be deleted" if protected? index + @list.delete_at index end @@ -125,6 +129,7 @@ module Axlsx def []=(index, v) DataTypeValidator.validate :SimpleTypedList_insert, @allowed_types, v raise ArgumentError, "Item is protected and cannot be changed" if protected? index + @list[index] = v v end @@ -137,6 +142,7 @@ module Axlsx def insert(index, v) DataTypeValidator.validate :SimpleTypedList_insert, @allowed_types, v raise ArgumentError, "Item is protected and cannot be changed" if protected? index + @list.insert(index, v) v end @@ -145,6 +151,7 @@ module Axlsx # @param [Integer] index def protected? index return false unless locked_at.is_a? Integer + index < locked_at end diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 266709b0..99099f60 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -9,6 +9,7 @@ module Axlsx # @return [Boolean] true if validation succeeds. def self.validate(name, choices, v) raise ArgumentError, (ERR_RESTRICTION % [v.to_s, name, choices.inspect]) unless choices.include?(v) + true end end diff --git a/lib/axlsx/workbook/defined_name.rb b/lib/axlsx/workbook/defined_name.rb index 4b819d4c..6fe1f6e9 100644 --- a/lib/axlsx/workbook/defined_name.rb +++ b/lib/axlsx/workbook/defined_name.rb @@ -120,6 +120,7 @@ module Axlsx def to_xml_string(str = '') raise ArgumentError, 'you must specify the name for this defined name. Please read the documentation for Axlsx::DefinedName for more details' unless name + str << ('' << @formula << '') diff --git a/lib/axlsx/workbook/defined_names.rb b/lib/axlsx/workbook/defined_names.rb index 30f80fcb..017c6d96 100644 --- a/lib/axlsx/workbook/defined_names.rb +++ b/lib/axlsx/workbook/defined_names.rb @@ -11,6 +11,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return if empty? + str << '' each { |defined_name| defined_name.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index fde5d259..73388718 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -383,6 +383,7 @@ require 'axlsx/workbook/worksheet/selection.rb' sheet_name = cell_def.split('!')[0] if cell_def.match('!') worksheet = self.worksheets.select { |s| s.name == sheet_name }.first raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet) + worksheet[cell_def.gsub(/.+!/, "")] end diff --git a/lib/axlsx/workbook/workbook_views.rb b/lib/axlsx/workbook/workbook_views.rb index 025d083b..41010d0d 100644 --- a/lib/axlsx/workbook/workbook_views.rb +++ b/lib/axlsx/workbook/workbook_views.rb @@ -11,6 +11,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return if empty? + str << "" each { |view| view.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb index ac630f69..9e753759 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb @@ -8,6 +8,7 @@ module Axlsx # @param [Worksheet] worksheet def initialize(worksheet) raise ArgumentError, 'you must provide a worksheet' unless worksheet.is_a?(Worksheet) + @worksheet = worksheet end @@ -24,6 +25,7 @@ module Axlsx # @return [String] def defined_name return unless range + Axlsx.cell_range(range.split(':').collect { |name| worksheet.name_to_cell(name) }) end @@ -57,6 +59,7 @@ module Axlsx columns.each do |column| rows.each do |row| next if row.hidden + column.apply(row, column_offset) end end @@ -66,6 +69,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return unless range + str << "" columns.each { |filter_column| filter_column.to_xml_string(str) } str << "" diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index da43a471..48f78038 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -41,6 +41,7 @@ module Axlsx # TODO implement this for date filters as well! def apply(cell) return false unless cell + filter_items.each do |filter| return false if cell.value == filter.val end @@ -97,6 +98,7 @@ module Axlsx def date_group_items=(options) options.each do |date_group| raise ArgumentError, "date_group_items should be an array of hashes specifying the options for each date_group_item" unless date_group.is_a?(Hash) + date_group_items << DateGroupItem.new(date_group) end end @@ -144,6 +146,7 @@ include Axlsx::SerializedAttributes def initialize(options = {}) raise ArgumentError, "You must specify a year for date time grouping" unless options[:year] raise ArgumentError, "You must specify a date_time_grouping when creating a DateGroupItem for auto filter" unless options[:date_time_grouping] + parse_options options end diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index a9685dac..cc668208 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -351,6 +351,7 @@ module Axlsx Axlsx::validate_unsigned_int(v) count = styles.cellXfs.size raise ArgumentError, "Invalid cellXfs id" unless v < count + @style = v end @@ -465,6 +466,7 @@ module Axlsx # Utility method for setting inline style attributes def set_run_style(validator, attr, value) return unless INLINE_STYLES.include?(attr.to_sym) + Axlsx.send(validator, value) unless validator.nil? self.instance_variable_set :"@#{attr.to_s}", value @is_text_run = true @@ -512,6 +514,7 @@ module Axlsx # @see Axlsx#date1904 def cast_value(v) return v if v.is_a?(RichText) || v.nil? + case type when :date self.style = STYLE_DATE if self.style == 0 diff --git a/lib/axlsx/workbook/worksheet/cell_serializer.rb b/lib/axlsx/workbook/worksheet/cell_serializer.rb index 15113fcd..94a1f93a 100644 --- a/lib/axlsx/workbook/worksheet/cell_serializer.rb +++ b/lib/axlsx/workbook/worksheet/cell_serializer.rb @@ -10,6 +10,7 @@ module Axlsx def to_xml_string(row_index, column_index, cell, str = '') str << ('' if cell.value.nil? + method = cell.type self.send(method, cell, str) str << '' diff --git a/lib/axlsx/workbook/worksheet/cfvo.rb b/lib/axlsx/workbook/worksheet/cfvo.rb index 773745f4..faa5d88a 100644 --- a/lib/axlsx/workbook/worksheet/cfvo.rb +++ b/lib/axlsx/workbook/worksheet/cfvo.rb @@ -46,6 +46,7 @@ module Axlsx # @see val def val=(v) raise ArgumentError, "#{v.inspect} must respond to to_s" unless v.respond_to?(:to_s) + @val = v.to_s end diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index 0b39024f..da3a9364 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -87,6 +87,7 @@ module Axlsx def outline_level=(v) Axlsx.validate_unsigned_numeric(v) raise ArgumentError, 'outlineLevel must be between 0 and 7' unless 0 <= v && v <= 7 + @outline_level = v end alias :outlineLevel= :outline_level= diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb index 763e4268..78ccc565 100644 --- a/lib/axlsx/workbook/worksheet/col_breaks.rb +++ b/lib/axlsx/workbook/worksheet/col_breaks.rb @@ -25,6 +25,7 @@ module Axlsx # def to_xml_string(str = '') return if empty? + str << ('') each { |brk| brk.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/worksheet/cols.rb b/lib/axlsx/workbook/worksheet/cols.rb index 7d93e603..5b808b54 100644 --- a/lib/axlsx/workbook/worksheet/cols.rb +++ b/lib/axlsx/workbook/worksheet/cols.rb @@ -4,6 +4,7 @@ module Axlsx class Cols < SimpleTypedList def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + super Col @worksheet = worksheet end @@ -13,6 +14,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return if empty? + str << '' each { |item| item.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index c2c94219..80ea8c4b 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -13,6 +13,7 @@ module Axlsx # @option [Boolean] visible This controls the visiblity of the associated vml_shape. def initialize(comments, options = {}) raise ArgumentError, "A comment needs a parent comments object" unless comments.is_a?(Comments) + @visible = true @comments = comments parse_options options diff --git a/lib/axlsx/workbook/worksheet/comments.rb b/lib/axlsx/workbook/worksheet/comments.rb index 3ec2ba01..452b198f 100644 --- a/lib/axlsx/workbook/worksheet/comments.rb +++ b/lib/axlsx/workbook/worksheet/comments.rb @@ -25,6 +25,7 @@ module Axlsx # @param [Worksheet] worksheet The sheet that these comments belong to. def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + super(Comment) @worksheet = worksheet @vml_drawing = VmlDrawing.new(self) @@ -39,6 +40,7 @@ module Axlsx raise ArgumentError, "Comment require an author" unless options[:author] raise ArgumentError, "Comment requires text" unless options[:text] raise ArgumentError, "Comment requires ref" unless options[:ref] + self << Comment.new(self, options) yield last if block_given? last diff --git a/lib/axlsx/workbook/worksheet/conditional_formattings.rb b/lib/axlsx/workbook/worksheet/conditional_formattings.rb index ad2e9c97..8b510ab9 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formattings.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formattings.rb @@ -4,6 +4,7 @@ module Axlsx # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + super ConditionalFormatting @worksheet = worksheet end @@ -15,6 +16,7 @@ module Axlsx # serialize the conditional formattings def to_xml_string(str = "") return if empty? + each { |item| item.to_xml_string(str) } end end diff --git a/lib/axlsx/workbook/worksheet/data_validations.rb b/lib/axlsx/workbook/worksheet/data_validations.rb index 46cebe29..9c07da42 100644 --- a/lib/axlsx/workbook/worksheet/data_validations.rb +++ b/lib/axlsx/workbook/worksheet/data_validations.rb @@ -4,6 +4,7 @@ module Axlsx # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + super DataValidation @worksheet = worksheet end @@ -15,6 +16,7 @@ module Axlsx # serialize the conditional formattings def to_xml_string(str = "") return if empty? + str << "" each { |item| item.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/worksheet/dimension.rb b/lib/axlsx/workbook/worksheet/dimension.rb index eaf0d038..013097c8 100644 --- a/lib/axlsx/workbook/worksheet/dimension.rb +++ b/lib/axlsx/workbook/worksheet/dimension.rb @@ -20,6 +20,7 @@ module Axlsx # to. def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + @worksheet = worksheet end @@ -35,6 +36,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return if worksheet.rows.empty? + str << "" % sqref end @@ -56,6 +58,7 @@ module Axlsx # @return [String] def dimension_reference(cell, default) return default unless cell.respond_to?(:r) + cell.r end end diff --git a/lib/axlsx/workbook/worksheet/merged_cells.rb b/lib/axlsx/workbook/worksheet/merged_cells.rb index 60d95003..f54fd252 100644 --- a/lib/axlsx/workbook/worksheet/merged_cells.rb +++ b/lib/axlsx/workbook/worksheet/merged_cells.rb @@ -5,6 +5,7 @@ module Axlsx # @param [Worksheet] worksheet def initialize(worksheet) raise ArgumentError, 'you must provide a worksheet' unless worksheet.is_a?(Worksheet) + super String end @@ -27,6 +28,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return if empty? + str << "" each { |merged_cell| str << "" } str << '' diff --git a/lib/axlsx/workbook/worksheet/page_margins.rb b/lib/axlsx/workbook/worksheet/page_margins.rb index de0d099b..a0967817 100644 --- a/lib/axlsx/workbook/worksheet/page_margins.rb +++ b/lib/axlsx/workbook/worksheet/page_margins.rb @@ -67,6 +67,7 @@ module Axlsx def set(margins) margins.select do |k, v| next unless [:left, :right, :top, :bottom, :header, :footer].include? k + send("#{k}=", v) end end diff --git a/lib/axlsx/workbook/worksheet/pivot_tables.rb b/lib/axlsx/workbook/worksheet/pivot_tables.rb index 018fc6a7..c27162c3 100644 --- a/lib/axlsx/workbook/worksheet/pivot_tables.rb +++ b/lib/axlsx/workbook/worksheet/pivot_tables.rb @@ -4,6 +4,7 @@ module Axlsx # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + super PivotTable @worksheet = worksheet end @@ -15,6 +16,7 @@ module Axlsx # returns the relationships required by this collection def relationships return [] if empty? + map { |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, "../#{pivot_table.pn}") } end end diff --git a/lib/axlsx/workbook/worksheet/protected_ranges.rb b/lib/axlsx/workbook/worksheet/protected_ranges.rb index d16dbbd6..aa627315 100644 --- a/lib/axlsx/workbook/worksheet/protected_ranges.rb +++ b/lib/axlsx/workbook/worksheet/protected_ranges.rb @@ -6,6 +6,7 @@ module Axlsx def initialize(worksheet) raise ArgumentError, 'You must provide a worksheet' unless worksheet.is_a?(Worksheet) + super ProtectedRange @worksheet = worksheet end @@ -27,6 +28,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return if empty? + str << '' each { |range| range.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb index 368b10ce..78639575 100644 --- a/lib/axlsx/workbook/worksheet/rich_text_run.rb +++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb @@ -175,6 +175,7 @@ module Axlsx # @return [Array] def autowidth(widtharray) return if value.nil? + if styles.cellXfs[style].alignment && styles.cellXfs[style].alignment.wrap_text first = true value.to_s.split(/\r?\n/, -1).each do |line| @@ -194,6 +195,7 @@ module Axlsx # Utility method for setting inline style attributes def set_run_style(validator, attr, value) return unless INLINE_STYLES.include?(attr.to_sym) + Axlsx.send(validator, value) unless validator.nil? self.instance_variable_set :"@#{attr.to_s}", value end @@ -236,6 +238,7 @@ module Axlsx # imagemagick and loading metrics for every character. def font_size return sz if sz + font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0] (font.b || (defined?(@b) && @b)) ? (font.sz * 1.5) : font.sz end diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb index b05e0587..2da31719 100644 --- a/lib/axlsx/workbook/worksheet/row_breaks.rb +++ b/lib/axlsx/workbook/worksheet/row_breaks.rb @@ -23,6 +23,7 @@ module Axlsx # def to_xml_string(str = '') return if empty? + str << ('') each { |brk| brk.to_xml_string(str) } str << '' diff --git a/lib/axlsx/workbook/worksheet/sheet_data.rb b/lib/axlsx/workbook/worksheet/sheet_data.rb index f245d07c..f6a27b0e 100644 --- a/lib/axlsx/workbook/worksheet/sheet_data.rb +++ b/lib/axlsx/workbook/worksheet/sheet_data.rb @@ -5,6 +5,7 @@ module Axlsx # @param [Worksheet] worksheet The worksheet that owns this sheet data. def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + @worksheet = worksheet end diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb index a870e4a3..9d6c0b5e 100644 --- a/lib/axlsx/workbook/worksheet/sheet_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb @@ -31,6 +31,7 @@ module Axlsx # @param [Worksheet] worksheet The worksheet that owns this SheetPr object def initialize(worksheet, options = {}) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + @worksheet = worksheet @outline_pr = nil parse_options options diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index 3ca17737..68202f08 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -66,6 +66,7 @@ module Axlsx # encodes password for protection locking def password=(v) return if v == nil + @password = create_password_hash(v) end diff --git a/lib/axlsx/workbook/worksheet/tables.rb b/lib/axlsx/workbook/worksheet/tables.rb index 69e59fe5..20ba4789 100644 --- a/lib/axlsx/workbook/worksheet/tables.rb +++ b/lib/axlsx/workbook/worksheet/tables.rb @@ -4,6 +4,7 @@ module Axlsx # creates a new Tables object def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) + super Table @worksheet = worksheet end @@ -15,6 +16,7 @@ module Axlsx # returns the relationships required by this collection def relationships return [] if empty? + map { |table| Relationship.new(table, TABLE_R, "../#{table.pn}") } end @@ -23,6 +25,7 @@ module Axlsx # @return [String] def to_xml_string(str = "") return if empty? + str << "" each { |table| str << "" } str << '' diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 18daaeeb..d8451e9f 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -169,6 +169,7 @@ module Axlsx # @see #page_setup def fit_to_page? return false unless Axlsx.instance_values_for(self).keys.include?('page_setup') + page_setup.fit_to_page? end @@ -526,6 +527,7 @@ module Axlsx def column_widths(*widths) widths.each_with_index do |value, index| next if value == nil + Axlsx::validate_unsigned_numeric(value) unless value == nil find_or_create_column_info(index).width = value end @@ -733,9 +735,11 @@ module Axlsx DataTypeValidator.validate :worksheet_name, String, name # ignore first character (BOM) after encoding to utf16 because Excel does so, too. raise ArgumentError, (ERR_SHEET_NAME_EMPTY) if name.empty? + character_length = name.encode("utf-16")[1..-1].encode("utf-16").bytesize / 2 raise ArgumentError, (ERR_SHEET_NAME_TOO_LONG % name) if character_length > WORKSHEET_MAX_NAME_LENGTH raise ArgumentError, (ERR_SHEET_NAME_CHARACTER_FORBIDDEN % name) if WORKSHEET_NAME_FORBIDDEN_CHARS.any? { |char| name.include? char } + name = Axlsx::coder.encode(name) sheet_names = @workbook.worksheets.reject { |s| s == self }.map { |s| s.name } raise ArgumentError, (ERR_DUPLICATE_SHEET_NAME % name) if sheet_names.include?(name) @@ -828,6 +832,7 @@ module Axlsx def add_autofilter_defined_name_to_workbook return if !auto_filter.range + workbook.add_defined_name auto_filter.defined_name, name: '_xlnm._FilterDatabase', local_sheet_id: index, hidden: 1 end end diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb index c40587ae..29ea6fc8 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb @@ -6,6 +6,7 @@ module Axlsx # param [Worksheet] worksheet The worksheet comments in thes object belong to def initialize(worksheet) raise ArugumentError, 'You must provide a worksheet' unless worksheet.is_a?(Worksheet) + @worksheet = worksheet end @@ -28,6 +29,7 @@ module Axlsx # @return [Relationships] def relationships return [] unless has_comments? + comments.relationships end @@ -49,6 +51,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return unless has_comments? + str << "" end end diff --git a/lib/axlsx/workbook/worksheet/worksheet_drawing.rb b/lib/axlsx/workbook/worksheet/worksheet_drawing.rb index e461ffa9..c2819393 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_drawing.rb @@ -8,6 +8,7 @@ module Axlsx # @param [Worksheet] worksheet def initialize(worksheet) raise ArgumentError, 'you must provide a worksheet' unless worksheet.is_a?(Worksheet) + @worksheet = worksheet @drawing = nil end @@ -43,6 +44,7 @@ module Axlsx # @return [Relationship] def relationship return unless has_drawing? + Relationship.new(self, DRAWING_R, "../#{drawing.pn}") end @@ -50,6 +52,7 @@ module Axlsx # @param [String] str def to_xml_string(str = '') return unless has_drawing? + str << "" end end diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb index bda87995..f20d671d 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb @@ -49,6 +49,7 @@ module Axlsx # @return [Relationship] def relationship return unless @target == :external + Relationship.new(self, HYPERLINK_R, location, :target_mode => :External) end diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb index 5c49fdb3..4771efb1 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb @@ -21,6 +21,7 @@ module Axlsx # @return Array def relationships return [] if empty? + map { |hyperlink| hyperlink.relationship } end @@ -28,6 +29,7 @@ module Axlsx # @return [String] def to_xml_string(str = '') return if empty? + str << '' each { |hyperlink| hyperlink.to_xml_string(str) } str << '' -- cgit v1.2.3 From 3befab6f5713c537f6b90b51c02882273c7f7cc9 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 9 Apr 2023 16:47:12 +0200 Subject: Fix Layout/ArgumentAlignment offenses ``` rubocop --only Layout/ArgumentAlignment -a ``` --- .rubocop_todo.yml | 14 -------------- lib/axlsx/drawing/picture_locking.rb | 4 ++-- lib/axlsx/package.rb | 2 +- lib/axlsx/workbook/defined_name.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_format_pr.rb | 4 ++-- lib/axlsx/workbook/worksheet/sheet_protection.rb | 8 ++++---- lib/axlsx/workbook/worksheet/sheet_view.rb | 8 ++++---- lib/axlsx/workbook/worksheet/table_style_info.rb | 2 +- 8 files changed, 15 insertions(+), 29 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f0d4799e..0679bf1a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -22,20 +22,6 @@ Gemspec/RequireMFA: Exclude: - 'axlsx.gemspec' -# Offense count: 15 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: with_first_argument, with_fixed_indentation -Layout/ArgumentAlignment: - Exclude: - - 'lib/axlsx/drawing/picture_locking.rb' - - 'lib/axlsx/package.rb' - - 'lib/axlsx/workbook/defined_name.rb' - - 'lib/axlsx/workbook/worksheet/sheet_format_pr.rb' - - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' - - 'lib/axlsx/workbook/worksheet/sheet_view.rb' - - 'lib/axlsx/workbook/worksheet/table_style_info.rb' - # Offense count: 58 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. diff --git a/lib/axlsx/drawing/picture_locking.rb b/lib/axlsx/drawing/picture_locking.rb index 2e68a957..efd85f97 100644 --- a/lib/axlsx/drawing/picture_locking.rb +++ b/lib/axlsx/drawing/picture_locking.rb @@ -6,8 +6,8 @@ module Axlsx include Axlsx::Accessors boolean_attr_accessor :noGrp, :noSelect, :noRot, :noChangeAspect, - :noMove, :noResize, :noEditPoints, :noAdjustHandles, - :noChangeArrowheads, :noChangeShapeType + :noMove, :noResize, :noEditPoints, :noAdjustHandles, + :noChangeArrowheads, :noChangeShapeType serializable_attributes :noGrp, :noSelect, :noRot, :noChangeAspect, :noMove, :noResize, :noEditPoints, :noAdjustHandles, diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index a0a77949..ecab1c3d 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -323,7 +323,7 @@ module Axlsx workbook.worksheets.each do |sheet| c_types << Axlsx::Override.new(:PartName => "/xl/#{sheet.pn}", - :ContentType => WORKSHEET_CT) + :ContentType => WORKSHEET_CT) end exts = workbook.images.map { |image| image.extname.downcase } exts.uniq.each do |ext| diff --git a/lib/axlsx/workbook/defined_name.rb b/lib/axlsx/workbook/defined_name.rb index 6fe1f6e9..2632e8ef 100644 --- a/lib/axlsx/workbook/defined_name.rb +++ b/lib/axlsx/workbook/defined_name.rb @@ -116,7 +116,7 @@ module Axlsx boolean_attr_accessor :workbook_parameter, :publish_to_server, :xlm, :vb_proceedure, :function, :hidden serializable_attributes :short_cut_key, :status_bar, :help, :description, :custom_menu, :comment, - :workbook_parameter, :publish_to_server, :xlm, :vb_proceedure, :function, :hidden, :local_sheet_id + :workbook_parameter, :publish_to_server, :xlm, :vb_proceedure, :function, :hidden, :local_sheet_id def to_xml_string(str = '') raise ArgumentError, 'you must specify the name for this defined name. Please read the documentation for Axlsx::DefinedName for more details' unless name diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index 5e06ca5b..ad4e4fab 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -34,8 +34,8 @@ module Axlsx end serializable_attributes :base_col_width, :default_col_width, :default_row_height, - :custom_height, :zero_height, :thick_top, :thick_bottom, - :outline_level_row, :outline_level_col + :custom_height, :zero_height, :thick_top, :thick_bottom, + :outline_level_row, :outline_level_col float_attr_accessor :default_col_width, :default_row_height diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index 68202f08..b36f8875 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -31,12 +31,12 @@ module Axlsx end boolean_attr_accessor :sheet, :objects, :scenarios, :format_cells, :format_columns, :format_rows, - :insert_columns, :insert_rows, :insert_hyperlinks, :delete_columns, :delete_rows, - :select_locked_cells, :sort, :auto_filter, :pivot_tables, :select_unlocked_cells + :insert_columns, :insert_rows, :insert_hyperlinks, :delete_columns, :delete_rows, + :select_locked_cells, :sort, :auto_filter, :pivot_tables, :select_unlocked_cells serializable_attributes :sheet, :objects, :scenarios, :format_cells, :format_columns, :format_rows, - :insert_columns, :insert_rows, :insert_hyperlinks, :delete_columns, :delete_rows, - :select_locked_cells, :sort, :auto_filter, :pivot_tables, :select_unlocked_cells, :salt, :password + :insert_columns, :insert_rows, :insert_hyperlinks, :delete_columns, :delete_rows, + :select_locked_cells, :sort, :auto_filter, :pivot_tables, :select_unlocked_cells, :salt, :password # Specifies the salt which was prepended to the user-supplied password before it was hashed using the hashing algorithm # @return [String] diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index ab66f800..8c2a0cd5 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -40,12 +40,12 @@ module Axlsx end boolean_attr_accessor :default_grid_color, :right_to_left, :show_formulas, :show_grid_lines, - :show_row_col_headers, :show_ruler, :show_white_space, :show_zeros, :tab_selected, :window_protection, :show_outline_symbols + :show_row_col_headers, :show_ruler, :show_white_space, :show_zeros, :tab_selected, :window_protection, :show_outline_symbols serializable_attributes :default_grid_color, :right_to_left, :show_formulas, :show_grid_lines, - :show_row_col_headers, :show_ruler, :show_white_space, :show_zeros, :tab_selected, :window_protection, :show_outline_symbols, - :zoom_scale_sheet_layout_view, :zoom_scale_page_layout_view, :zoom_scale_normal, :workbook_view_id, - :view, :top_left_cell, :color_id, :zoom_scale + :show_row_col_headers, :show_ruler, :show_white_space, :show_zeros, :tab_selected, :window_protection, :show_outline_symbols, + :zoom_scale_sheet_layout_view, :zoom_scale_page_layout_view, :zoom_scale_normal, :workbook_view_id, + :view, :top_left_cell, :color_id, :zoom_scale # instance values that must be serialized as their own elements - e.g. not attributes. CHILD_ELEMENTS = [:pane, :selections] diff --git a/lib/axlsx/workbook/worksheet/table_style_info.rb b/lib/axlsx/workbook/worksheet/table_style_info.rb index f7b7bff4..537b2eea 100644 --- a/lib/axlsx/workbook/worksheet/table_style_info.rb +++ b/lib/axlsx/workbook/worksheet/table_style_info.rb @@ -26,7 +26,7 @@ module Axlsx # boolean attributes for this object boolean_attr_accessor :show_first_column, :show_last_column, :show_row_stripes, :show_column_stripes serializable_attributes :show_first_column, :show_last_column, :show_row_stripes, :show_column_stripes, - :name + :name # Initialize all the values to false as Excel requires them to # explicitly be disabled or all will show. -- cgit v1.2.3 From c77a48805c17d36c4503df8cf0fe75e7b620e2d4 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 9 Apr 2023 16:55:57 +0200 Subject: Fix offenses related to indentation consistency --- .rubocop_todo.yml | 13 --- lib/axlsx/content_type/abstract_content_type.rb | 2 +- lib/axlsx/drawing/axis.rb | 4 +- lib/axlsx/drawing/bar_3D_chart.rb | 2 +- lib/axlsx/drawing/bar_chart.rb | 2 +- lib/axlsx/drawing/bubble_chart.rb | 2 +- lib/axlsx/drawing/line_3D_chart.rb | 14 +-- lib/axlsx/drawing/scatter_chart.rb | 2 +- lib/axlsx/drawing/title.rb | 16 +-- lib/axlsx/drawing/view_3D.rb | 38 +++---- lib/axlsx/drawing/vml_shape.rb | 2 +- lib/axlsx/package.rb | 4 +- lib/axlsx/rels/relationships.rb | 2 +- lib/axlsx/stylesheet/gradient_fill.rb | 4 +- lib/axlsx/util/storage.rb | 22 ++-- lib/axlsx/util/validators.rb | 2 +- lib/axlsx/workbook/workbook.rb | 120 ++++++++++----------- lib/axlsx/workbook/workbook_view.rb | 6 +- .../workbook/worksheet/auto_filter/filters.rb | 2 +- lib/axlsx/workbook/worksheet/cols.rb | 8 +- lib/axlsx/workbook/worksheet/comment.rb | 2 +- .../workbook/worksheet/conditional_formatting.rb | 2 +- lib/axlsx/workbook/worksheet/data_bar.rb | 34 +++--- lib/axlsx/workbook/worksheet/page_setup.rb | 2 +- lib/axlsx/workbook/worksheet/protected_ranges.rb | 14 +-- lib/axlsx/workbook/worksheet/sheet_calc_pr.rb | 6 +- test/drawing/tc_bar_3D_chart.rb | 10 +- test/drawing/tc_bar_chart.rb | 10 +- test/drawing/tc_d_lbls.rb | 16 +-- test/drawing/tc_data_source.rb | 4 +- test/drawing/tc_drawing.rb | 4 +- test/drawing/tc_line_3d_chart.rb | 20 ++-- test/stylesheet/tc_table_style_element.rb | 2 +- test/util/tc_validators.rb | 8 +- .../worksheet/auto_filter/tc_filter_column.rb | 4 +- test/workbook/worksheet/tc_data_validation.rb | 4 +- test/workbook/worksheet/tc_outline_pr.rb | 24 ++--- test/workbook/worksheet/tc_page_set_up_pr.rb | 18 ++-- test/workbook/worksheet/tc_pane.rb | 2 +- test/workbook/worksheet/tc_protected_range.rb | 22 ++-- test/workbook/worksheet/tc_sheet_format_pr.rb | 24 ++--- test/workbook/worksheet/tc_sheet_view.rb | 4 +- test/workbook/worksheet/tc_table_style_info.rb | 4 +- test/workbook/worksheet/tc_worksheet.rb | 2 +- 44 files changed, 248 insertions(+), 261 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0679bf1a..fc019a48 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -62,19 +62,6 @@ Layout/HeredocIndentation: - 'lib/axlsx/drawing/vml_drawing.rb' - 'lib/axlsx/drawing/vml_shape.rb' -# Offense count: 48 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: normal, indented_internal_methods -Layout/IndentationConsistency: - Enabled: false - -# Offense count: 118 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Width, AllowedPatterns. -Layout/IndentationWidth: - Enabled: false - # Offense count: 218 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. diff --git a/lib/axlsx/content_type/abstract_content_type.rb b/lib/axlsx/content_type/abstract_content_type.rb index 023c9086..45bd4853 100644 --- a/lib/axlsx/content_type/abstract_content_type.rb +++ b/lib/axlsx/content_type/abstract_content_type.rb @@ -6,7 +6,7 @@ module Axlsx # Initializes an abstract content type # @see Default, Override def initialize(options = {}) - parse_options options + parse_options options end # The type of content. diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index 89915b68..9ca03fb1 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -91,8 +91,8 @@ module Axlsx # The crossing axis for this axis # @param [Axis] axis def cross_axis=(axis) - DataTypeValidator.validate "#{self.class}.cross_axis", [Axis], axis - @cross_axis = axis + DataTypeValidator.validate "#{self.class}.cross_axis", [Axis], axis + @cross_axis = axis end # The position of the axis diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index f8dca9ad..6ec95d8d 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -139,7 +139,7 @@ module Axlsx # category axes specified via axes[:val_axes] and axes[:cat_axis] # @return [Axes] def axes - @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis) + @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis) end end end diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb index 51046533..f77eb7c1 100644 --- a/lib/axlsx/drawing/bar_chart.rb +++ b/lib/axlsx/drawing/bar_chart.rb @@ -129,7 +129,7 @@ module Axlsx # category axes specified via axes[:val_axes] and axes[:cat_axis] # @return [Axes] def axes - @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis) + @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis) end end end diff --git a/lib/axlsx/drawing/bubble_chart.rb b/lib/axlsx/drawing/bubble_chart.rb index edd1a9b5..084d0477 100644 --- a/lib/axlsx/drawing/bubble_chart.rb +++ b/lib/axlsx/drawing/bubble_chart.rb @@ -24,7 +24,7 @@ module Axlsx def initialize(frame, options = {}) @vary_colors = 0 - super(frame, options) + super(frame, options) @series_type = BubbleSeries @d_lbls = nil parse_options options diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index d45a417f..85d04b06 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -52,13 +52,13 @@ module Axlsx end alias :gapDepth= :gap_depth= - # Serializes the object - # @param [String] str - # @return [String] - def to_xml_string(str = '') - super(str) do - str << ('') unless @gap_depth.nil? - end + # Serializes the object + # @param [String] str + # @return [String] + def to_xml_string(str = '') + super(str) do + str << ('') unless @gap_depth.nil? end + end end end diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb index e43647a0..b118a09a 100644 --- a/lib/axlsx/drawing/scatter_chart.rb +++ b/lib/axlsx/drawing/scatter_chart.rb @@ -31,7 +31,7 @@ module Axlsx @vary_colors = 0 @scatter_style = :lineMarker - super(frame, options) + super(frame, options) @series_type = ScatterSeries @d_lbls = nil parse_options options diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index 1a43ba80..e1b0d7f8 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -84,14 +84,14 @@ module Axlsx str << '' else str << '' - str << '' - str << '' - str << '' - str << '' - str << ('') - str << ('' << clean_value << '') - str << '' - str << '' + str << '' + str << '' + str << '' + str << '' + str << ('') + str << ('' << clean_value << '') + str << '' + str << '' str << '' end str << '' diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 23bd4952..86a2ab2f 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -61,33 +61,33 @@ module Axlsx end alias :rotX= :rot_x= - # @see h_percent - def h_percent=(v) - RegexValidator.validate "#{self.class}.h_percent", H_PERCENT_REGEX, v - @h_percent = v - end + # @see h_percent + def h_percent=(v) + RegexValidator.validate "#{self.class}.h_percent", H_PERCENT_REGEX, v + @h_percent = v + end alias :hPercent= :h_percent= - # @see rot_y - def rot_y=(v) - RangeValidator.validate "View3D.rot_y", 0, 360, v - @rot_y = v - end + # @see rot_y + def rot_y=(v) + RangeValidator.validate "View3D.rot_y", 0, 360, v + @rot_y = v + end alias :rotY= :rot_y= - # @see depth_percent - def depth_percent=(v) RegexValidator.validate "#{self.class}.depth_percent", DEPTH_PERCENT_REGEX, v; @depth_percent = v; end + # @see depth_percent + def depth_percent=(v) RegexValidator.validate "#{self.class}.depth_percent", DEPTH_PERCENT_REGEX, v; @depth_percent = v; end alias :depthPercent= :depth_percent= - # @see r_ang_ax - def r_ang_ax=(v) Axlsx::validate_boolean(v); @r_ang_ax = v; end + # @see r_ang_ax + def r_ang_ax=(v) Axlsx::validate_boolean(v); @r_ang_ax = v; end alias :rAngAx= :r_ang_ax= - # @see perspective - def perspective=(v) - RangeValidator.validate "View3D.perspective", 0, 240, v - @perspective = v - end + # @see perspective + def perspective=(v) + RangeValidator.validate "View3D.perspective", 0, 240, v + @perspective = v + end # DataTypeValidator.validate "#{self.class}.perspective", [Integer], v, lambda {|arg| arg >= 0 && arg <= 240 }; @perspective = v; end diff --git a/lib/axlsx/drawing/vml_shape.rb b/lib/axlsx/drawing/vml_shape.rb index 2ba388b3..fd335d95 100644 --- a/lib/axlsx/drawing/vml_shape.rb +++ b/lib/axlsx/drawing/vml_shape.rb @@ -36,7 +36,7 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = '') -str << < diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index ecab1c3d..fcb80cdc 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -312,8 +312,8 @@ module Axlsx workbook.comments.each do |comment| if comment.size > 0 - c_types << Axlsx::Override.new(:PartName => "/xl/#{comment.pn}", - :ContentType => COMMENT_CT) + c_types << Axlsx::Override.new(:PartName => "/xl/#{comment.pn}", + :ContentType => COMMENT_CT) end end diff --git a/lib/axlsx/rels/relationships.rb b/lib/axlsx/rels/relationships.rb index 686059fb..71c4bf1e 100644 --- a/lib/axlsx/rels/relationships.rb +++ b/lib/axlsx/rels/relationships.rb @@ -1,5 +1,5 @@ module Axlsx -require 'axlsx/rels/relationship.rb' + require 'axlsx/rels/relationship.rb' # Relationships are a collection of Relations that define how package parts are related. # @note The package automatically manages releationships. diff --git a/lib/axlsx/stylesheet/gradient_fill.rb b/lib/axlsx/stylesheet/gradient_fill.rb index dc4e562b..f90a15d6 100644 --- a/lib/axlsx/stylesheet/gradient_fill.rb +++ b/lib/axlsx/stylesheet/gradient_fill.rb @@ -66,8 +66,8 @@ module Axlsx # @see right def right=(v) - validate_format_percentage "GradientFill.right", v - @right = v + validate_format_percentage "GradientFill.right", v + @right = v end # @see top diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb index c2f0739c..4932c93c 100644 --- a/lib/axlsx/util/storage.rb +++ b/lib/axlsx/util/storage.rb @@ -15,17 +15,17 @@ module Axlsx # Creates a byte string for this storage # @return [String] def to_s - data = [@name.concat(Array.new(32 - @name.size, 0)), - @name_size, - @type, - @color, - @left, - @right, - @child, - @created, - @modified, - @sector, - @size].flatten + data = [@name.concat(Array.new(32 - @name.size, 0)), + @name_size, + @type, + @color, + @left, + @right, + @child, + @created, + @modified, + @sector, + @size].flatten data.pack(PACKING) end diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 99099f60..b6877a48 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -54,7 +54,7 @@ module Axlsx # @see validate_boolean def self.validate(name, types, v, other = false) if other.is_a?(Proc) - raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect]) unless other.call(v) + raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect]) unless other.call(v) end v_class = v.is_a?(Class) ? v : v.class Array(types).each do |t| diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index 73388718..567a0598 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -1,63 +1,63 @@ module Axlsx -require 'axlsx/workbook/worksheet/sheet_calc_pr.rb' -require 'axlsx/workbook/worksheet/auto_filter/auto_filter.rb' -require 'axlsx/workbook/worksheet/date_time_converter.rb' -require 'axlsx/workbook/worksheet/protected_range.rb' -require 'axlsx/workbook/worksheet/protected_ranges.rb' -require 'axlsx/workbook/worksheet/rich_text_run' -require 'axlsx/workbook/worksheet/rich_text' -require 'axlsx/workbook/worksheet/cell_serializer.rb' -require 'axlsx/workbook/worksheet/cell.rb' -require 'axlsx/workbook/worksheet/page_margins.rb' -require 'axlsx/workbook/worksheet/page_set_up_pr.rb' -require 'axlsx/workbook/worksheet/outline_pr.rb' -require 'axlsx/workbook/worksheet/page_setup.rb' -require 'axlsx/workbook/worksheet/header_footer.rb' -require 'axlsx/workbook/worksheet/print_options.rb' -require 'axlsx/workbook/worksheet/cfvo.rb' -require 'axlsx/workbook/worksheet/cfvos.rb' -require 'axlsx/workbook/worksheet/color_scale.rb' -require 'axlsx/workbook/worksheet/data_bar.rb' -require 'axlsx/workbook/worksheet/icon_set.rb' -require 'axlsx/workbook/worksheet/conditional_formatting.rb' -require 'axlsx/workbook/worksheet/conditional_formatting_rule.rb' -require 'axlsx/workbook/worksheet/conditional_formattings.rb' -require 'axlsx/workbook/worksheet/row.rb' -require 'axlsx/workbook/worksheet/col.rb' -require 'axlsx/workbook/worksheet/cols.rb' -require 'axlsx/workbook/worksheet/comments.rb' -require 'axlsx/workbook/worksheet/comment.rb' -require 'axlsx/workbook/worksheet/merged_cells.rb' -require 'axlsx/workbook/worksheet/sheet_protection.rb' -require 'axlsx/workbook/worksheet/sheet_pr.rb' -require 'axlsx/workbook/worksheet/dimension.rb' -require 'axlsx/workbook/worksheet/sheet_data.rb' -require 'axlsx/workbook/worksheet/worksheet_drawing.rb' -require 'axlsx/workbook/worksheet/worksheet_comments.rb' -require 'axlsx/workbook/worksheet/worksheet_hyperlink' -require 'axlsx/workbook/worksheet/worksheet_hyperlinks' -require 'axlsx/workbook/worksheet/break' -require 'axlsx/workbook/worksheet/row_breaks' -require 'axlsx/workbook/worksheet/col_breaks' -require 'axlsx/workbook/workbook_view' -require 'axlsx/workbook/workbook_views' - -require 'axlsx/workbook/worksheet/worksheet.rb' -require 'axlsx/workbook/shared_strings_table.rb' -require 'axlsx/workbook/defined_name.rb' -require 'axlsx/workbook/defined_names.rb' -require 'axlsx/workbook/worksheet/table_style_info.rb' -require 'axlsx/workbook/worksheet/table.rb' -require 'axlsx/workbook/worksheet/tables.rb' -require 'axlsx/workbook/worksheet/pivot_table_cache_definition.rb' -require 'axlsx/workbook/worksheet/pivot_table.rb' -require 'axlsx/workbook/worksheet/pivot_tables.rb' -require 'axlsx/workbook/worksheet/data_validation.rb' -require 'axlsx/workbook/worksheet/data_validations.rb' -require 'axlsx/workbook/worksheet/sheet_view.rb' -require 'axlsx/workbook/worksheet/sheet_format_pr.rb' -require 'axlsx/workbook/worksheet/pane.rb' -require 'axlsx/workbook/worksheet/selection.rb' + require 'axlsx/workbook/worksheet/sheet_calc_pr.rb' + require 'axlsx/workbook/worksheet/auto_filter/auto_filter.rb' + require 'axlsx/workbook/worksheet/date_time_converter.rb' + require 'axlsx/workbook/worksheet/protected_range.rb' + require 'axlsx/workbook/worksheet/protected_ranges.rb' + require 'axlsx/workbook/worksheet/rich_text_run' + require 'axlsx/workbook/worksheet/rich_text' + require 'axlsx/workbook/worksheet/cell_serializer.rb' + require 'axlsx/workbook/worksheet/cell.rb' + require 'axlsx/workbook/worksheet/page_margins.rb' + require 'axlsx/workbook/worksheet/page_set_up_pr.rb' + require 'axlsx/workbook/worksheet/outline_pr.rb' + require 'axlsx/workbook/worksheet/page_setup.rb' + require 'axlsx/workbook/worksheet/header_footer.rb' + require 'axlsx/workbook/worksheet/print_options.rb' + require 'axlsx/workbook/worksheet/cfvo.rb' + require 'axlsx/workbook/worksheet/cfvos.rb' + require 'axlsx/workbook/worksheet/color_scale.rb' + require 'axlsx/workbook/worksheet/data_bar.rb' + require 'axlsx/workbook/worksheet/icon_set.rb' + require 'axlsx/workbook/worksheet/conditional_formatting.rb' + require 'axlsx/workbook/worksheet/conditional_formatting_rule.rb' + require 'axlsx/workbook/worksheet/conditional_formattings.rb' + require 'axlsx/workbook/worksheet/row.rb' + require 'axlsx/workbook/worksheet/col.rb' + require 'axlsx/workbook/worksheet/cols.rb' + require 'axlsx/workbook/worksheet/comments.rb' + require 'axlsx/workbook/worksheet/comment.rb' + require 'axlsx/workbook/worksheet/merged_cells.rb' + require 'axlsx/workbook/worksheet/sheet_protection.rb' + require 'axlsx/workbook/worksheet/sheet_pr.rb' + require 'axlsx/workbook/worksheet/dimension.rb' + require 'axlsx/workbook/worksheet/sheet_data.rb' + require 'axlsx/workbook/worksheet/worksheet_drawing.rb' + require 'axlsx/workbook/worksheet/worksheet_comments.rb' + require 'axlsx/workbook/worksheet/worksheet_hyperlink' + require 'axlsx/workbook/worksheet/worksheet_hyperlinks' + require 'axlsx/workbook/worksheet/break' + require 'axlsx/workbook/worksheet/row_breaks' + require 'axlsx/workbook/worksheet/col_breaks' + require 'axlsx/workbook/workbook_view' + require 'axlsx/workbook/workbook_views' + + require 'axlsx/workbook/worksheet/worksheet.rb' + require 'axlsx/workbook/shared_strings_table.rb' + require 'axlsx/workbook/defined_name.rb' + require 'axlsx/workbook/defined_names.rb' + require 'axlsx/workbook/worksheet/table_style_info.rb' + require 'axlsx/workbook/worksheet/table.rb' + require 'axlsx/workbook/worksheet/tables.rb' + require 'axlsx/workbook/worksheet/pivot_table_cache_definition.rb' + require 'axlsx/workbook/worksheet/pivot_table.rb' + require 'axlsx/workbook/worksheet/pivot_tables.rb' + require 'axlsx/workbook/worksheet/data_validation.rb' + require 'axlsx/workbook/worksheet/data_validations.rb' + require 'axlsx/workbook/worksheet/sheet_view.rb' + require 'axlsx/workbook/worksheet/sheet_format_pr.rb' + require 'axlsx/workbook/worksheet/pane.rb' + require 'axlsx/workbook/worksheet/selection.rb' # The Workbook class is an xlsx workbook that manages worksheets, charts, drawings and styles. # The following parts of the Office Open XML spreadsheet specification are not implimented in this version. # @@ -346,7 +346,7 @@ require 'axlsx/workbook/worksheet/selection.rb' end r << Relationship.new(self, STYLES_R, STYLES_PN) if use_shared_strings - r << Relationship.new(self, SHARED_STRINGS_R, SHARED_STRINGS_PN) + r << Relationship.new(self, SHARED_STRINGS_R, SHARED_STRINGS_PN) end r end diff --git a/lib/axlsx/workbook/workbook_view.rb b/lib/axlsx/workbook/workbook_view.rb index 5b6d5bfb..27a46dcc 100644 --- a/lib/axlsx/workbook/workbook_view.rb +++ b/lib/axlsx/workbook/workbook_view.rb @@ -67,9 +67,9 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = '') - str << '' + str << '' end end end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index 48f78038..e731dab2 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -130,7 +130,7 @@ module Axlsx # types, can be correctly compared for the purposes of filtering. class DateGroupItem include Axlsx::OptionsParser -include Axlsx::SerializedAttributes + include Axlsx::SerializedAttributes # Creates a new DateGroupItem # @param [Hash] options A hash of options to use when diff --git a/lib/axlsx/workbook/worksheet/cols.rb b/lib/axlsx/workbook/worksheet/cols.rb index 5b808b54..27b1f508 100644 --- a/lib/axlsx/workbook/worksheet/cols.rb +++ b/lib/axlsx/workbook/worksheet/cols.rb @@ -13,11 +13,11 @@ module Axlsx # @param [String] str # @return [String] def to_xml_string(str = '') - return if empty? + return if empty? - str << '' - each { |item| item.to_xml_string(str) } - str << '' + str << '' + each { |item| item.to_xml_string(str) } + str << '' end end end diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index 80ea8c4b..aa35feef 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -83,7 +83,7 @@ module Axlsx vml.left_column = vml.column vml.right_column = vml.column + 2 vml.top_row = vml.row - vml.bottom_row = vml.row + 4 + vml.bottom_row = vml.row + 4 end end end diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb index c13113a5..419e6684 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb @@ -5,7 +5,7 @@ module Axlsx # @see Worksheet#add_conditional_formatting # @see ConditionalFormattingRule class ConditionalFormatting - include Axlsx::OptionsParser + include Axlsx::OptionsParser # Creates a new {ConditionalFormatting} object # @option options [Array] rules The rules to apply diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb index 1ff65fd5..c9f99dcc 100644 --- a/lib/axlsx/workbook/worksheet/data_bar.rb +++ b/lib/axlsx/workbook/worksheet/data_bar.rb @@ -80,27 +80,27 @@ module Axlsx end alias :minLength= :min_length= - # @see maxLength - def max_length=(v) - Axlsx.validate_unsigned_int(v) - @max_length = v - end + # @see maxLength + def max_length=(v) + Axlsx.validate_unsigned_int(v) + @max_length = v + end alias :maxLength= :max_length= - # @see showValue - def show_value=(v) - Axlsx.validate_boolean(v) - @show_value = v - end + # @see showValue + def show_value=(v) + Axlsx.validate_boolean(v) + @show_value = v + end alias :showValue= :show_value= - # Sets the color for the data bars. - # @param [Color|String] v The color object, or rgb string value to apply - def color=(v) - @color = v if v.is_a? Color - self.color.rgb = v if v.is_a? String - @color - end + # Sets the color for the data bars. + # @param [Color|String] v The color object, or rgb string value to apply + def color=(v) + @color = v if v.is_a? Color + self.color.rgb = v if v.is_a? String + @color + end # Serialize this object to an xml string # @param [String] str diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb index 07dd6817..6b07466e 100644 --- a/lib/axlsx/workbook/worksheet/page_setup.rb +++ b/lib/axlsx/workbook/worksheet/page_setup.rb @@ -17,7 +17,7 @@ module Axlsx # @option options [Integer] scale Print scaling (percent value, integer ranging from 10 to 400) # @option options [Integer] paper_size - the size of paper to use def initialize(options = {}) - parse_options options + parse_options options end serializable_attributes :fit_to_height, :fit_to_width, :orientation, :paper_height, :paper_width, :scale, :paper_size diff --git a/lib/axlsx/workbook/worksheet/protected_ranges.rb b/lib/axlsx/workbook/worksheet/protected_ranges.rb index aa627315..75b3aee5 100644 --- a/lib/axlsx/workbook/worksheet/protected_ranges.rb +++ b/lib/axlsx/workbook/worksheet/protected_ranges.rb @@ -14,13 +14,13 @@ module Axlsx # Adds a protected range # @param [Array|String] cells A string range reference or array of cells that will be protected def add_range(cells) - sqref = if cells.is_a?(String) - cells - elsif cells.is_a?(SimpleTypedList) || cells.is_a?(Array) - Axlsx::cell_range(cells, false) - end - self << ProtectedRange.new(:sqref => sqref, :name => "Range#{size}") - last + sqref = if cells.is_a?(String) + cells + elsif cells.is_a?(SimpleTypedList) || cells.is_a?(Array) + Axlsx::cell_range(cells, false) + end + self << ProtectedRange.new(:sqref => sqref, :name => "Range#{size}") + last end # Serializes the protected ranges diff --git a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb index 58f630d4..d692d461 100644 --- a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb @@ -2,9 +2,9 @@ module Axlsx # the SheetCalcPr object for the worksheet # This object contains calculation properties for the worksheet. class SheetCalcPr - include Axlsx::OptionsParser - include Axlsx::SerializedAttributes - include Axlsx::Accessors + include Axlsx::OptionsParser + include Axlsx::SerializedAttributes + include Axlsx::Accessors # creates a new SheetCalcPr # @param [Hash] options Options for this object # @option [Boolean] full_calc_on_load @see full_calc_on_load diff --git a/test/drawing/tc_bar_3D_chart.rb b/test/drawing/tc_bar_3D_chart.rb index f7e15dea..3c22e191 100644 --- a/test/drawing/tc_bar_3D_chart.rb +++ b/test/drawing/tc_bar_3D_chart.rb @@ -25,11 +25,11 @@ class TestBar3DChart < Test::Unit::TestCase assert(@chart.bar_dir == :col) end - def test_grouping - assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted } - assert_nothing_raised("allow valid grouping") { @chart.grouping = :standard } - assert(@chart.grouping == :standard) - end + def test_grouping + assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted } + assert_nothing_raised("allow valid grouping") { @chart.grouping = :standard } + assert(@chart.grouping == :standard) + end def test_gap_width assert_raise(ArgumentError, "require valid gap width") { @chart.gap_width = -1 } diff --git a/test/drawing/tc_bar_chart.rb b/test/drawing/tc_bar_chart.rb index 75a2970d..5106d266 100644 --- a/test/drawing/tc_bar_chart.rb +++ b/test/drawing/tc_bar_chart.rb @@ -25,11 +25,11 @@ class TestBarChart < Test::Unit::TestCase assert(@chart.bar_dir == :col) end - def test_grouping - assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted } - assert_nothing_raised("allow valid grouping") { @chart.grouping = :standard } - assert(@chart.grouping == :standard) - end + def test_grouping + assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted } + assert_nothing_raised("allow valid grouping") { @chart.grouping = :standard } + assert(@chart.grouping == :standard) + end def test_gap_width assert_raise(ArgumentError, "require valid gap width") { @chart.gap_width = -1 } diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb index cc96299d..a8647f9c 100644 --- a/test/drawing/tc_d_lbls.rb +++ b/test/drawing/tc_d_lbls.rb @@ -44,13 +44,13 @@ class TestDLbls < Test::Unit::TestCase end def test_to_xml_string - str = '' - str << '' - @d_lbls.to_xml_string(str) - str << '' - doc = Nokogiri::XML(str) - Axlsx.instance_values_for(@d_lbls).each do |name, value| - assert(doc.xpath("//c:#{Axlsx::camel(name, false)}[@val='#{value}']"), "#{name} is properly serialized") - end + str = '' + str << '' + @d_lbls.to_xml_string(str) + str << '' + doc = Nokogiri::XML(str) + Axlsx.instance_values_for(@d_lbls).each do |name, value| + assert(doc.xpath("//c:#{Axlsx::camel(name, false)}[@val='#{value}']"), "#{name} is properly serialized") + end end end diff --git a/test/drawing/tc_data_source.rb b/test/drawing/tc_data_source.rb index 2fec667f..b635d56e 100644 --- a/test/drawing/tc_data_source.rb +++ b/test/drawing/tc_data_source.rb @@ -1,6 +1,6 @@ require 'tc_helper.rb' - class TestNumDataSource < Test::Unit::TestCase +class TestNumDataSource < Test::Unit::TestCase def setup @data_source = Axlsx::NumDataSource.new :data => ["1", "2", "3"] end @@ -18,4 +18,4 @@ require 'tc_helper.rb' doc = Nokogiri::XML(str) assert_equal(doc.xpath("//c:val").size, 1) end - end +end diff --git a/test/drawing/tc_drawing.rb b/test/drawing/tc_drawing.rb index c5fc98e1..282a03da 100644 --- a/test/drawing/tc_drawing.rb +++ b/test/drawing/tc_drawing.rb @@ -31,8 +31,8 @@ class TestDrawing < Test::Unit::TestCase end def test_add_two_cell_anchor_image - src = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" - image = @ws.add_image(:image_src => src, :start_at => [0, 0], :end_at => [15, 0]) + src = File.dirname(__FILE__) + "/../fixtures/image1.jpeg" + image = @ws.add_image(:image_src => src, :start_at => [0, 0], :end_at => [15, 0]) assert(@ws.drawing.anchors.last.is_a?(Axlsx::TwoCellAnchor)) assert(image.is_a?(Axlsx::Pic)) end diff --git a/test/drawing/tc_line_3d_chart.rb b/test/drawing/tc_line_3d_chart.rb index 55398d50..c91e9216 100644 --- a/test/drawing/tc_line_3d_chart.rb +++ b/test/drawing/tc_line_3d_chart.rb @@ -19,17 +19,17 @@ class TestLine3DChart < Test::Unit::TestCase assert(@chart.serAxis.is_a?(Axlsx::SerAxis), "value access not created") end - def test_grouping - assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted } - assert_nothing_raised("allow valid grouping") { @chart.grouping = :stacked } - assert(@chart.grouping == :stacked) - end + def test_grouping + assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted } + assert_nothing_raised("allow valid grouping") { @chart.grouping = :stacked } + assert(@chart.grouping == :stacked) + end - def test_gapDepth - assert_raise(ArgumentError, "require valid gapDepth") { @chart.gapDepth = 200 } - assert_nothing_raised("allow valid gapDepth") { @chart.gapDepth = "200%" } - assert(@chart.gapDepth == "200%") - end + def test_gapDepth + assert_raise(ArgumentError, "require valid gapDepth") { @chart.gapDepth = 200 } + assert_nothing_raised("allow valid gapDepth") { @chart.gapDepth = "200%" } + assert(@chart.gapDepth == "200%") + end def test_to_xml schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD)) diff --git a/test/stylesheet/tc_table_style_element.rb b/test/stylesheet/tc_table_style_element.rb index 4af3aeb5..021d4fca 100644 --- a/test/stylesheet/tc_table_style_element.rb +++ b/test/stylesheet/tc_table_style_element.rb @@ -38,7 +38,7 @@ class TestTableStyleElement < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML(@item.to_xml_string) - @item.type = :headerRow + @item.type = :headerRow assert(doc.xpath("//tableStyleElement[@type='#{@item.type.to_s}']")) end end diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb index c0e2e356..ba3edba6 100644 --- a/test/util/tc_validators.rb +++ b/test/util/tc_validators.rb @@ -204,9 +204,9 @@ class TestValidators < Test::Unit::TestCase end def test_range_validation - # exclusive - assert_raise(ArgumentError) { Axlsx::RangeValidator.validate('foo', 1, 10, 10, false) } - # inclusive by default - assert_nothing_raised { Axlsx::RangeValidator.validate('foo', 1, 10, 10) } + # exclusive + assert_raise(ArgumentError) { Axlsx::RangeValidator.validate('foo', 1, 10, 10, false) } + # inclusive by default + assert_nothing_raised { Axlsx::RangeValidator.validate('foo', 1, 10, 10) } end end diff --git a/test/workbook/worksheet/auto_filter/tc_filter_column.rb b/test/workbook/worksheet/auto_filter/tc_filter_column.rb index 642b7b6e..88f73e0d 100644 --- a/test/workbook/worksheet/auto_filter/tc_filter_column.rb +++ b/test/workbook/worksheet/auto_filter/tc_filter_column.rb @@ -56,9 +56,9 @@ class TestFilterColumn < Test::Unit::TestCase def test_col_id= assert_raise ArgumentError do - @filter_column.col_id = :bar + @filter_column.col_id = :bar end - assert_nothing_raised { @filter_column.col_id = 7 } + assert_nothing_raised { @filter_column.col_id = 7 } end def test_to_xml_string diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 59fd34f6..f93c91fe 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -272,7 +272,7 @@ class TestDataValidation < Test::Unit::TestCase end def test_empty_attributes - v = Axlsx::DataValidation.new - assert_equal(nil, v.send(:get_valid_attributes)) + v = Axlsx::DataValidation.new + assert_equal(nil, v.send(:get_valid_attributes)) end end diff --git a/test/workbook/worksheet/tc_outline_pr.rb b/test/workbook/worksheet/tc_outline_pr.rb index a40108b1..d2906a61 100644 --- a/test/workbook/worksheet/tc_outline_pr.rb +++ b/test/workbook/worksheet/tc_outline_pr.rb @@ -1,19 +1,19 @@ require 'tc_helper.rb' class TestOutlinePr < Test::Unit::TestCase - def setup - @outline_pr = Axlsx::OutlinePr.new(:summary_below => false, :summary_right => true, :apply_styles => false) - end + def setup + @outline_pr = Axlsx::OutlinePr.new(:summary_below => false, :summary_right => true, :apply_styles => false) + end - def test_summary_below - assert_equal false, @outline_pr.summary_below - end + def test_summary_below + assert_equal false, @outline_pr.summary_below + end - def test_summary_right - assert_equal true, @outline_pr.summary_right - end + def test_summary_right + assert_equal true, @outline_pr.summary_right + end - def test_apply_styles - assert_equal false, @outline_pr.apply_styles - end + def test_apply_styles + assert_equal false, @outline_pr.apply_styles + end end diff --git a/test/workbook/worksheet/tc_page_set_up_pr.rb b/test/workbook/worksheet/tc_page_set_up_pr.rb index d04097d0..8ca4f825 100644 --- a/test/workbook/worksheet/tc_page_set_up_pr.rb +++ b/test/workbook/worksheet/tc_page_set_up_pr.rb @@ -1,15 +1,15 @@ require 'tc_helper.rb' class TestPageSetUpPr < Test::Unit::TestCase - def setup - @page_setup_pr = Axlsx::PageSetUpPr.new(:fit_to_page => true, :auto_page_breaks => true) - end + def setup + @page_setup_pr = Axlsx::PageSetUpPr.new(:fit_to_page => true, :auto_page_breaks => true) + end - def test_fit_to_page - assert_equal true, @page_setup_pr.fit_to_page - end + def test_fit_to_page + assert_equal true, @page_setup_pr.fit_to_page + end - def test_auto_page_breaks - assert_equal true, @page_setup_pr.auto_page_breaks - end + def test_auto_page_breaks + assert_equal true, @page_setup_pr.auto_page_breaks + end end diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb index d5f05933..fef1eb63 100644 --- a/test/workbook/worksheet/tc_pane.rb +++ b/test/workbook/worksheet/tc_pane.rb @@ -6,7 +6,7 @@ class TestPane < Test::Unit::TestCase #inverse defaults for booleans @nil_options = { :active_pane => :bottom_left, :state => :frozen, :top_left_cell => 'A2' } @int_0_options = { :x_split => 2, :y_split => 2 } - @options = @nil_options.merge(@int_0_options) + @options = @nil_options.merge(@int_0_options) @pane = Axlsx::Pane.new(@options) end diff --git a/test/workbook/worksheet/tc_protected_range.rb b/test/workbook/worksheet/tc_protected_range.rb index 6d609097..906c6014 100644 --- a/test/workbook/worksheet/tc_protected_range.rb +++ b/test/workbook/worksheet/tc_protected_range.rb @@ -1,16 +1,16 @@ require 'tc_helper.rb' class TestProtectedRange < Test::Unit::TestCase -def setup - @p = Axlsx::Package.new - @ws = @p.workbook.add_worksheet { |sheet| sheet.add_row [1, 2, 3, 4, 5, 6, 7, 8, 9] } -end + def setup + @p = Axlsx::Package.new + @ws = @p.workbook.add_worksheet { |sheet| sheet.add_row [1, 2, 3, 4, 5, 6, 7, 8, 9] } + end -def test_initialize_options - assert_nothing_raised { Axlsx::ProtectedRange.new(:sqref => 'A1:B1', :name => "only bob") } -end + def test_initialize_options + assert_nothing_raised { Axlsx::ProtectedRange.new(:sqref => 'A1:B1', :name => "only bob") } + end -def test_range - r = @ws.protect_range('A1:B1') - assert_equal('A1:B1', r.sqref) -end + def test_range + r = @ws.protect_range('A1:B1') + assert_equal('A1:B1', r.sqref) + end end diff --git a/test/workbook/worksheet/tc_sheet_format_pr.rb b/test/workbook/worksheet/tc_sheet_format_pr.rb index 48643bc6..1240da26 100644 --- a/test/workbook/worksheet/tc_sheet_format_pr.rb +++ b/test/workbook/worksheet/tc_sheet_format_pr.rb @@ -44,33 +44,33 @@ class TestSheetFormatPr < Test::Unit::TestCase end def test_default_row_height - assert_raise(ArgumentError) { @sheet_format_pr.default_row_height = :foo } - assert_nothing_raised { @sheet_format_pr.default_row_height = 1.0 } + assert_raise(ArgumentError) { @sheet_format_pr.default_row_height = :foo } + assert_nothing_raised { @sheet_format_pr.default_row_height = 1.0 } end def test_default_col_width - assert_raise(ArgumentError) { @sheet_format_pr.default_col_width = :foo } - assert_nothing_raised { @sheet_format_pr.default_col_width = 1.0 } + assert_raise(ArgumentError) { @sheet_format_pr.default_col_width = :foo } + assert_nothing_raised { @sheet_format_pr.default_col_width = 1.0 } end def test_custom_height - assert_raise(ArgumentError) { @sheet_format_pr.custom_height = :foo } - assert_nothing_raised { @sheet_format_pr.custom_height = true } + assert_raise(ArgumentError) { @sheet_format_pr.custom_height = :foo } + assert_nothing_raised { @sheet_format_pr.custom_height = true } end def test_zero_height - assert_raise(ArgumentError) { @sheet_format_pr.zero_height = :foo } - assert_nothing_raised { @sheet_format_pr.zero_height = true } + assert_raise(ArgumentError) { @sheet_format_pr.zero_height = :foo } + assert_nothing_raised { @sheet_format_pr.zero_height = true } end def test_thick_top - assert_raise(ArgumentError) { @sheet_format_pr.thick_top = :foo } - assert_nothing_raised { @sheet_format_pr.thick_top = true } + assert_raise(ArgumentError) { @sheet_format_pr.thick_top = :foo } + assert_nothing_raised { @sheet_format_pr.thick_top = true } end def test_thick_bottom - assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom = :foo } - assert_nothing_raised { @sheet_format_pr.thick_bottom = true } + assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom = :foo } + assert_nothing_raised { @sheet_format_pr.thick_bottom = true } end def test_to_xml_string diff --git a/test/workbook/worksheet/tc_sheet_view.rb b/test/workbook/worksheet/tc_sheet_view.rb index a09287aa..fb8367a8 100644 --- a/test/workbook/worksheet/tc_sheet_view.rb +++ b/test/workbook/worksheet/tc_sheet_view.rb @@ -205,7 +205,7 @@ class TestSheetView < Test::Unit::TestCase end def test_add_selection - @sv.add_selection(:top_left, :active_cell => "A1") - assert_equal('A1', @sv.selections[:top_left].active_cell) + @sv.add_selection(:top_left, :active_cell => "A1") + assert_equal('A1', @sv.selections[:top_left].active_cell) end end diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb index 2067959c..b56ac560 100644 --- a/test/workbook/worksheet/tc_table_style_info.rb +++ b/test/workbook/worksheet/tc_table_style_info.rb @@ -25,8 +25,8 @@ class TestTableStyleInfo < Test::Unit::TestCase def test_boolean_properties table_style = Axlsx::TableStyleInfo.new @options.keys.each do |key| - assert_nothing_raised { table_style.send("#{key.to_sym}=", true) } - assert_raises(ArgumentError) { table_style.send(key.to_sym, 'foo') } + assert_nothing_raised { table_style.send("#{key.to_sym}=", true) } + assert_raises(ArgumentError) { table_style.send(key.to_sym, 'foo') } end end diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index bae9f904..6c8e0781 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -348,7 +348,7 @@ class TestWorksheet < Test::Unit::TestCase end def test_to_xml_string_row_breaks - @ws.add_page_break("A1") + @ws.add_page_break("A1") doc = Nokogiri::XML(@ws.to_xml_string) assert_equal(doc.xpath('//xmlns:worksheet/xmlns:rowBreaks/xmlns:brk[@id="0"]').size, 1) end -- cgit v1.2.3 From 1406b47e64188765f220be86001ec1f543e0157d Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 9 Apr 2023 17:00:03 +0200 Subject: Fix Layout/ExtraSpacing offenses Configure with `AllowBeforeTrailingComments: true` --- .rubocop.yml | 3 +++ .rubocop_todo.yml | 6 ------ lib/axlsx.rb | 2 +- lib/axlsx/drawing/d_lbls.rb | 2 +- lib/axlsx/drawing/series.rb | 4 ++-- lib/axlsx/drawing/view_3D.rb | 2 +- lib/axlsx/package.rb | 2 +- lib/axlsx/stylesheet/cell_style.rb | 2 +- lib/axlsx/workbook/workbook.rb | 2 +- lib/axlsx/workbook/worksheet/auto_filter/filters.rb | 4 ++-- lib/axlsx/workbook/worksheet/comments.rb | 2 +- test/drawing/tc_axis.rb | 2 +- test/drawing/tc_bubble_chart.rb | 4 ++-- test/drawing/tc_scatter_chart.rb | 4 ++-- test/drawing/tc_view_3D.rb | 2 +- test/workbook/worksheet/tc_data_validation.rb | 2 +- test/workbook/worksheet/tc_date_time_converter.rb | 2 +- test/workbook/worksheet/tc_pivot_table.rb | 2 +- test/workbook/worksheet/tc_selection.rb | 2 +- test/workbook/worksheet/tc_worksheet.rb | 2 +- 20 files changed, 25 insertions(+), 28 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index fe5b876a..28352bd5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,3 +11,6 @@ AllCops: Layout/CommentIndentation: AllowForAlignment: true + +Layout/ExtraSpacing: + AllowBeforeTrailingComments: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index fc019a48..d03f2431 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -22,12 +22,6 @@ Gemspec/RequireMFA: Exclude: - 'axlsx.gemspec' -# Offense count: 58 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. -Layout/ExtraSpacing: - Enabled: false - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IndentationWidth. diff --git a/lib/axlsx.rb b/lib/axlsx.rb index df847a18..a12bf08a 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -88,7 +88,7 @@ module Axlsx letters_str = name[/[A-Z]+/] # capitalization?!? - v = letters_str.reverse.chars.reduce({ :base => 1, :i => 0 }) do |val, c| + v = letters_str.reverse.chars.reduce({ :base => 1, :i => 0 }) do |val, c| val[:i] += ((c.bytes.first - 64) * val[:base]) val[:base] *= 26 diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index 213008e6..3e51d021 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -63,7 +63,7 @@ module Axlsx def d_lbl_pos=(label_position) return unless [Pie3DChart, LineChart].include? @chart_type - Axlsx::RestrictionValidator.validate 'DLbls#d_lbl_pos', [:bestFit, :b, :ctr, :inBase, :inEnd, :l, :outEnd, :r, :t], label_position + Axlsx::RestrictionValidator.validate 'DLbls#d_lbl_pos', [:bestFit, :b, :ctr, :inBase, :inEnd, :l, :outEnd, :r, :t], label_position @d_lbl_pos = label_position end diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb index e5c66b59..86b85f4c 100644 --- a/lib/axlsx/drawing/series.rb +++ b/lib/axlsx/drawing/series.rb @@ -38,7 +38,7 @@ module Axlsx end # @see order - def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end + def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end # @see title def title=(v) @@ -50,7 +50,7 @@ module Axlsx private # assigns the chart for this series - def chart=(v) DataTypeValidator.validate "Series.chart", Chart, v; @chart = v; end + def chart=(v) DataTypeValidator.validate "Series.chart", Chart, v; @chart = v; end # Serializes the object # @param [String] str diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 86a2ab2f..1f701f32 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -11,7 +11,7 @@ module Axlsx # @option options [Boolean] r_ang_ax # @option options [Integer] perspective def initialize(options = {}) - @rot_x, @h_percent, @rot_y, @depth_percent, @r_ang_ax, @perspective = nil, nil, nil, nil, nil, nil + @rot_x, @h_percent, @rot_y, @depth_percent, @r_ang_ax, @perspective = nil, nil, nil, nil, nil, nil parse_options options end diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index fcb80cdc..c3805a5c 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -327,7 +327,7 @@ module Axlsx end exts = workbook.images.map { |image| image.extname.downcase } exts.uniq.each do |ext| - ct = if ['jpeg', 'jpg'].include?(ext) + ct = if ['jpeg', 'jpg'].include?(ext) JPEG_CT elsif ext == 'gif' GIF_CT diff --git a/lib/axlsx/stylesheet/cell_style.rb b/lib/axlsx/stylesheet/cell_style.rb index 1e35a1a4..20f88133 100644 --- a/lib/axlsx/stylesheet/cell_style.rb +++ b/lib/axlsx/stylesheet/cell_style.rb @@ -46,7 +46,7 @@ module Axlsx attr_reader :customBuiltin # @see name - def name=(v) Axlsx::validate_string v; @name = v end + def name=(v) Axlsx::validate_string v; @name = v end # @see xfId def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end # @see builtinId diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index 567a0598..134a3e6b 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -344,7 +344,7 @@ module Axlsx pivot_tables.each_with_index do |pivot_table, index| r << Relationship.new(pivot_table.cache_definition, PIVOT_TABLE_CACHE_DEFINITION_R, PIVOT_TABLE_CACHE_DEFINITION_PN % (index + 1)) end - r << Relationship.new(self, STYLES_R, STYLES_PN) + r << Relationship.new(self, STYLES_R, STYLES_PN) if use_shared_strings r << Relationship.new(self, SHARED_STRINGS_R, SHARED_STRINGS_PN) end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index e731dab2..554df012 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -76,7 +76,7 @@ module Axlsx # Serialize the object to xml def to_xml_string(str = '') str << "" - filter_items.each { |filter| filter.to_xml_string(str) } + filter_items.each { |filter| filter.to_xml_string(str) } date_group_items.each { |date_group_item| date_group_item.to_xml_string(str) } str << '' end @@ -144,7 +144,7 @@ module Axlsx # @option [Integer] minute @see minute # @option [Integer] second @see second def initialize(options = {}) - raise ArgumentError, "You must specify a year for date time grouping" unless options[:year] + raise ArgumentError, "You must specify a year for date time grouping" unless options[:year] raise ArgumentError, "You must specify a date_time_grouping when creating a DateGroupItem for auto filter" unless options[:date_time_grouping] parse_options options diff --git a/lib/axlsx/workbook/worksheet/comments.rb b/lib/axlsx/workbook/worksheet/comments.rb index 452b198f..f6f3071b 100644 --- a/lib/axlsx/workbook/worksheet/comments.rb +++ b/lib/axlsx/workbook/worksheet/comments.rb @@ -65,7 +65,7 @@ module Axlsx def to_xml_string(str = "") str << '' str << ('') - authors.each do |author| + authors.each do |author| str << ('' << author.to_s << '') end str << '' diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb index 52a066be..0f7108eb 100644 --- a/test/drawing/tc_axis.rb +++ b/test/drawing/tc_axis.rb @@ -57,7 +57,7 @@ class TestAxis < Test::Unit::TestCase def test_format_code assert_raise(ArgumentError, "requires valid format code") { @axis.format_code = :high } - assert_nothing_raised("accepts valid format code") { @axis.format_code = "00.##" } + assert_nothing_raised("accepts valid format code") { @axis.format_code = "00.##" } end def create_chart_with_formatting(format_string = nil) diff --git a/test/drawing/tc_bubble_chart.rb b/test/drawing/tc_bubble_chart.rb index 7a9af423..02745f92 100644 --- a/test/drawing/tc_bubble_chart.rb +++ b/test/drawing/tc_bubble_chart.rb @@ -5,10 +5,10 @@ class TestBubbleChart < Test::Unit::TestCase @p = Axlsx::Package.new @chart = nil @p.workbook.add_worksheet do |sheet| - sheet.add_row ["First", 1, 5, 7, 9] + sheet.add_row ["First", 1, 5, 7, 9] sheet.add_row ["", 1, 25, 49, 81] sheet.add_row ["", 1, 42, 60, 75] - sheet.add_row ["Second", 5, 2, 14, 9] + sheet.add_row ["Second", 5, 2, 14, 9] sheet.add_row ["", 5, 10, 15, 20] sheet.add_row ["", 5, 28, 92, 13] sheet.add_chart(Axlsx::BubbleChart, :title => "example: Bubble Chart") do |chart| diff --git a/test/drawing/tc_scatter_chart.rb b/test/drawing/tc_scatter_chart.rb index a8d713eb..359f7206 100644 --- a/test/drawing/tc_scatter_chart.rb +++ b/test/drawing/tc_scatter_chart.rb @@ -5,9 +5,9 @@ class TestScatterChart < Test::Unit::TestCase @p = Axlsx::Package.new @chart = nil @p.workbook.add_worksheet do |sheet| - sheet.add_row ["First", 1, 5, 7, 9] + sheet.add_row ["First", 1, 5, 7, 9] sheet.add_row ["", 1, 25, 49, 81] - sheet.add_row ["Second", 5, 2, 14, 9] + sheet.add_row ["Second", 5, 2, 14, 9] sheet.add_row ["", 5, 10, 15, 20] sheet.add_chart(Axlsx::ScatterChart, :title => "example 7: Scatter Chart") do |chart| chart.start_at 0, 4 diff --git a/test/drawing/tc_view_3D.rb b/test/drawing/tc_view_3D.rb index 9aceb542..43116023 100644 --- a/test/drawing/tc_view_3D.rb +++ b/test/drawing/tc_view_3D.rb @@ -2,7 +2,7 @@ require 'tc_helper.rb' class TestView3D < Test::Unit::TestCase def setup - @view = Axlsx::View3D.new + @view = Axlsx::View3D.new end def teardown diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index f93c91fe..09ce8290 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -7,7 +7,7 @@ class TestDataValidation < Test::Unit::TestCase def setup #inverse defaults @boolean_options = { :allowBlank => false, :hideDropDown => true, :showErrorMessage => false, :showInputMessage => true } - @nil_options = { :formula1 => 'foo', :formula2 => 'foo', :errorTitle => 'foo', :operator => :lessThan, :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' } + @nil_options = { :formula1 => 'foo', :formula2 => 'foo', :errorTitle => 'foo', :operator => :lessThan, :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' } @type_option = { :type => :whole } @error_style_option = { :errorStyle => :warning } diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index cb139d45..9c813486 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -114,7 +114,7 @@ class TestDateTimeConverter < Test::Unit::TestCase local = Time.parse "2012-01-01 09:00:00 +0900" assert_equal local, utc - assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f / 86400, Axlsx::DateTimeConverter::time_to_serial(utc) + assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f / 86400, Axlsx::DateTimeConverter::time_to_serial(utc) Axlsx::Workbook.date1904 = true assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f / 86400, Axlsx::DateTimeConverter::time_to_serial(utc) end diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb index 83f8fce6..a5bb8906 100644 --- a/test/workbook/worksheet/tc_pivot_table.rb +++ b/test/workbook/worksheet/tc_pivot_table.rb @@ -17,7 +17,7 @@ class TestPivotTable < Test::Unit::TestCase @ws = p.workbook.add_worksheet @ws << ["Year", "Month", "Region", "Type", "Sales"] - @ws << [2012, "Nov", "East", "Soda", "12345"] + @ws << [2012, "Nov", "East", "Soda", "12345"] end def test_initialization diff --git a/test/workbook/worksheet/tc_selection.rb b/test/workbook/worksheet/tc_selection.rb index 5f65adcd..d600aa67 100644 --- a/test/workbook/worksheet/tc_selection.rb +++ b/test/workbook/worksheet/tc_selection.rb @@ -2,7 +2,7 @@ require 'tc_helper.rb' class TestSelection < Test::Unit::TestCase def setup - @options = { :active_cell => 'A2', :active_cell_id => 1, :pane => :top_left, :sqref => 'A2' } + @options = { :active_cell => 'A2', :active_cell_id => 1, :pane => :top_left, :sqref => 'A2' } @selection = Axlsx::Selection.new(@options) end diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 6c8e0781..f6c65fe4 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -690,7 +690,7 @@ class TestWorksheet < Test::Unit::TestCase sheet.add_row ['', 'Butter', 'Dairy', 4.99] sheet.add_row ['', 'Bread', 'Baked Goods', 3.45] sheet.add_row ['', 'Broccoli', 'Produce', 2.99] - sheet.add_row ['', 'Pizza', 'Frozen Foods', 4.99] + sheet.add_row ['', 'Pizza', 'Frozen Foods', 4.99] sheet.column_widths 5, 20, 20, 20 sheet.add_style 'B2:D2', b: true -- cgit v1.2.3 From 84a2b255d6fd780f526ac3d9bf99a40f08792986 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Mon, 10 Apr 2023 11:45:57 +0200 Subject: Fix Layout/LeadingCommentSpace offenses ``` rubocop --only Layout/LeadingCommentSpace -a ``` --- .rubocop_todo.yml | 6 - lib/axlsx.rb | 6 +- lib/axlsx/drawing/bar_3D_chart.rb | 4 +- lib/axlsx/drawing/bar_chart.rb | 4 +- lib/axlsx/drawing/cat_axis.rb | 2 +- lib/axlsx/drawing/chart.rb | 2 +- lib/axlsx/drawing/d_lbls.rb | 2 +- lib/axlsx/drawing/hyperlink.rb | 4 +- lib/axlsx/drawing/num_data.rb | 2 +- lib/axlsx/drawing/num_val.rb | 2 +- lib/axlsx/drawing/pic.rb | 2 +- lib/axlsx/drawing/ser_axis.rb | 2 +- lib/axlsx/drawing/str_data.rb | 2 +- lib/axlsx/drawing/str_val.rb | 2 +- lib/axlsx/drawing/title.rb | 6 +- lib/axlsx/package.rb | 4 +- lib/axlsx/stylesheet/border_pr.rb | 4 +- lib/axlsx/stylesheet/color.rb | 2 +- lib/axlsx/stylesheet/dxf.rb | 2 +- lib/axlsx/stylesheet/styles.rb | 8 +- lib/axlsx/stylesheet/xf.rb | 2 +- lib/axlsx/util/constants.rb | 4 +- lib/axlsx/workbook/defined_name.rb | 4 +- .../workbook/worksheet/auto_filter/auto_filter.rb | 2 +- .../worksheet/auto_filter/filter_column.rb | 4 +- .../workbook/worksheet/auto_filter/filters.rb | 2 +- lib/axlsx/workbook/worksheet/cell.rb | 4 +- lib/axlsx/workbook/worksheet/cfvos.rb | 4 +- lib/axlsx/workbook/worksheet/col.rb | 2 +- lib/axlsx/workbook/worksheet/page_setup.rb | 228 ++++++++++----------- lib/axlsx/workbook/worksheet/pane.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_protection.rb | 2 +- lib/axlsx/workbook/worksheet/sheet_view.rb | 2 +- .../workbook/worksheet/worksheet_hyperlink.rb | 2 +- .../workbook/worksheet/worksheet_hyperlinks.rb | 2 +- test/content_type/tc_content_type.rb | 4 +- test/drawing/tc_pic.rb | 4 +- test/drawing/tc_pie_series.rb | 2 +- test/profile.rb | 2 +- test/stylesheet/tc_styles.rb | 2 +- test/tc_package.rb | 8 +- test/util/tc_simple_typed_list.rb | 4 +- test/util/tc_validators.rb | 48 ++--- test/workbook/tc_workbook.rb | 2 +- test/workbook/worksheet/tc_cell.rb | 2 +- test/workbook/worksheet/tc_col.rb | 2 +- .../worksheet/tc_conditional_formatting.rb | 2 +- test/workbook/worksheet/tc_data_validation.rb | 20 +- test/workbook/worksheet/tc_pane.rb | 2 +- test/workbook/worksheet/tc_sheet_protection.rb | 2 +- test/workbook/worksheet/tc_sheet_view.rb | 2 +- 51 files changed, 218 insertions(+), 224 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d03f2431..552d2f0c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -56,12 +56,6 @@ Layout/HeredocIndentation: - 'lib/axlsx/drawing/vml_drawing.rb' - 'lib/axlsx/drawing/vml_shape.rb' -# Offense count: 218 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. -Layout/LeadingCommentSpace: - Enabled: false - # Offense count: 1 Lint/AmbiguousAssignment: Exclude: diff --git a/lib/axlsx.rb b/lib/axlsx.rb index a12bf08a..2ee8a1d8 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -21,11 +21,11 @@ require 'axlsx/rels/relationships.rb' require 'axlsx/drawing/drawing.rb' require 'axlsx/workbook/workbook.rb' require 'axlsx/package.rb' -#required gems +# required gems require 'nokogiri' require 'zip' -#core dependencies +# core dependencies require 'bigdecimal' require 'set' require 'time' @@ -75,7 +75,7 @@ module Axlsx cells.sort_by(&:pos) end - #global reference html entity encoding + # global reference html entity encoding # @return [HtmlEntities] def self.coder @@coder ||= ::HTMLEntities.new diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index 6ec95d8d..89544be0 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -39,7 +39,7 @@ module Axlsx end alias :gapWidth :gap_width - #grouping for a column, line, or area chart. + # grouping for a column, line, or area chart. # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] def grouping @@ -87,7 +87,7 @@ module Axlsx end alias :barDir= :bar_dir= - #grouping for a column, line, or area chart. + # grouping for a column, line, or area chart. # must be one of [:percentStacked, :clustered, :standard, :stacked] def grouping=(v) RestrictionValidator.validate "Bar3DChart.grouping", [:percentStacked, :clustered, :standard, :stacked], v diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb index f77eb7c1..1ed38332 100644 --- a/lib/axlsx/drawing/bar_chart.rb +++ b/lib/axlsx/drawing/bar_chart.rb @@ -34,7 +34,7 @@ module Axlsx end alias :gapWidth :gap_width - #grouping for a column, line, or area chart. + # grouping for a column, line, or area chart. # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] def grouping @@ -79,7 +79,7 @@ module Axlsx end alias :barDir= :bar_dir= - #grouping for a column, line, or area chart. + # grouping for a column, line, or area chart. # must be one of [:percentStacked, :clustered, :standard, :stacked] def grouping=(v) RestrictionValidator.validate "BarChart.grouping", [:percentStacked, :clustered, :standard, :stacked], v diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index ded05ee8..75290da0 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -1,5 +1,5 @@ module Axlsx - #A CatAxis object defines a chart category axis + # A CatAxis object defines a chart category axis class CatAxis < Axis # Creates a new CatAxis object # @option options [Integer] tick_lbl_skip diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index e64163d9..e9f4441f 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -49,7 +49,7 @@ module Axlsx # @return [Series] attr_reader :series_type - #TODO data labels! + # TODO data labels! def d_lbls @d_lbls ||= DLbls.new(self.class) end diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index 3e51d021..358378c5 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -2,7 +2,7 @@ module Axlsx # There are more elements in the dLbls spec that allow for # customizations and formatting. For now, I am just implementing the # basics. - #The DLbls class manages serialization of data labels + # The DLbls class manages serialization of data labels # showLeaderLines and leaderLines are not currently implemented class DLbls include Axlsx::Accessors diff --git a/lib/axlsx/drawing/hyperlink.rb b/lib/axlsx/drawing/hyperlink.rb index 979fdd6a..4d3b343d 100644 --- a/lib/axlsx/drawing/hyperlink.rb +++ b/lib/axlsx/drawing/hyperlink.rb @@ -6,7 +6,7 @@ module Axlsx include Axlsx::SerializedAttributes include Axlsx::OptionsParser - #Creates a hyperlink object + # Creates a hyperlink object # parent must be a Pic for now, although I expect that other object support this tag and its cNvPr parent # @param [Pic] parent # @option options [String] tooltip message shown when hyperlinked object is hovered over with mouse. @@ -38,7 +38,7 @@ module Axlsx alias :invalidUrl :invalid_url alias :invalidUrl= :invalid_url= - #An action to take when the link is clicked. The specification says "This can be used to specify a slide to be navigated to or a script of code to be run." but in most cases you will not need to do anything with this. MS does reserve a few interesting strings. @see http://msdn.microsoft.com/en-us/library/ff532419%28v=office.12%29.aspx + # An action to take when the link is clicked. The specification says "This can be used to specify a slide to be navigated to or a script of code to be run." but in most cases you will not need to do anything with this. MS does reserve a few interesting strings. @see http://msdn.microsoft.com/en-us/library/ff532419%28v=office.12%29.aspx # @return [String] attr_accessor :action diff --git a/lib/axlsx/drawing/num_data.rb b/lib/axlsx/drawing/num_data.rb index 140cfb9f..7239ac5f 100644 --- a/lib/axlsx/drawing/num_data.rb +++ b/lib/axlsx/drawing/num_data.rb @@ -1,5 +1,5 @@ module Axlsx - #This class specifies data for a particular data point. It is used for both numCache and numLit object + # This class specifies data for a particular data point. It is used for both numCache and numLit object class NumData include Axlsx::OptionsParser diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb index c03a0fa1..f4b2c399 100644 --- a/lib/axlsx/drawing/num_val.rb +++ b/lib/axlsx/drawing/num_val.rb @@ -1,5 +1,5 @@ module Axlsx - #This class specifies data for a particular data point. + # This class specifies data for a particular data point. class NumVal < StrVal # A string representing the format code to apply. # For more information see see the SpreadsheetML numFmt element's (§18.8.30) formatCode attribute. diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 64e5a877..fb4d01fe 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -194,7 +194,7 @@ module Axlsx swap_anchor(new_anchor) end - #changes the anchor type to a two cell anchor + # changes the anchor type to a two cell anchor def use_two_cell_anchor return if @anchor.is_a?(TwoCellAnchor) diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb index b5844454..f49c1301 100644 --- a/lib/axlsx/drawing/ser_axis.rb +++ b/lib/axlsx/drawing/ser_axis.rb @@ -1,5 +1,5 @@ module Axlsx - #A SerAxis object defines a series axis + # A SerAxis object defines a series axis class SerAxis < Axis # The number of tick lables to skip between labels # @return [Integer] diff --git a/lib/axlsx/drawing/str_data.rb b/lib/axlsx/drawing/str_data.rb index 843c90a7..5ea8a892 100644 --- a/lib/axlsx/drawing/str_data.rb +++ b/lib/axlsx/drawing/str_data.rb @@ -1,5 +1,5 @@ module Axlsx - #This specifies the last string data used for a chart. (e.g. strLit and strCache) + # This specifies the last string data used for a chart. (e.g. strLit and strCache) # This class is extended for NumData to include the formatCode attribute required for numLit and numCache class StrData include Axlsx::OptionsParser diff --git a/lib/axlsx/drawing/str_val.rb b/lib/axlsx/drawing/str_val.rb index 4a85d256..e5c851ee 100644 --- a/lib/axlsx/drawing/str_val.rb +++ b/lib/axlsx/drawing/str_val.rb @@ -1,5 +1,5 @@ module Axlsx - #This class specifies data for a particular data point. + # This class specifies data for a particular data point. class StrVal include Axlsx::OptionsParser diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index e1b0d7f8..92294a06 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -60,9 +60,9 @@ module Axlsx end # Not implemented at this time. - #def layout=(v) DataTypeValidator.validate 'Title.layout', Layout, v; @layout = v; end - #def overlay=(v) Axlsx::validate_boolean v; @overlay=v; end - #def spPr=(v) DataTypeValidator.validate 'Title.spPr', SpPr, v; @spPr = v; end + # def layout=(v) DataTypeValidator.validate 'Title.layout', Layout, v; @layout = v; end + # def overlay=(v) Axlsx::validate_boolean v; @overlay=v; end + # def spPr=(v) DataTypeValidator.validate 'Title.spPr', SpPr, v; @spPr = v; end # Serializes the object # @param [String] str diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index c3805a5c..02ab184c 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -231,8 +231,8 @@ module Axlsx workbook.pivot_tables.each do |pivot_table| cache_definition = pivot_table.cache_definition parts << { :entry => "xl/#{pivot_table.rels_pn}", :doc => pivot_table.relationships, :schema => RELS_XSD } - parts << { :entry => "xl/#{pivot_table.pn}", :doc => pivot_table } #, :schema => SML_XSD} - parts << { :entry => "xl/#{cache_definition.pn}", :doc => cache_definition } #, :schema => SML_XSD} + parts << { :entry => "xl/#{pivot_table.pn}", :doc => pivot_table } # , :schema => SML_XSD} + parts << { :entry => "xl/#{cache_definition.pn}", :doc => cache_definition } # , :schema => SML_XSD} end workbook.comments.each do |comment| diff --git a/lib/axlsx/stylesheet/border_pr.rb b/lib/axlsx/stylesheet/border_pr.rb index 8300f4bc..3f1054f2 100644 --- a/lib/axlsx/stylesheet/border_pr.rb +++ b/lib/axlsx/stylesheet/border_pr.rb @@ -45,9 +45,9 @@ module Axlsx # @see Axlsx::Border def initialize(options = {}) parse_options(options) - #options.each do |o| + # options.each do |o| # self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" - #end + # end end # @see name diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index 4f358a78..d6d204bf 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -37,7 +37,7 @@ module Axlsx # no support for theme just yet # @return [Integer] - #attr_reader :theme + # attr_reader :theme # The tint value. # @note valid values are between -1.0 and 1.0 diff --git a/lib/axlsx/stylesheet/dxf.rb b/lib/axlsx/stylesheet/dxf.rb index a3f15581..516894df 100644 --- a/lib/axlsx/stylesheet/dxf.rb +++ b/lib/axlsx/stylesheet/dxf.rb @@ -7,7 +7,7 @@ module Axlsx # The order in which the child elements is put in the XML seems to # be important for Excel CHILD_ELEMENTS = [:font, :numFmt, :fill, :alignment, :border, :protection] - #does not support extList (ExtensionList) + # does not support extList (ExtensionList) # The cell alignment for this style # @return [CellAlignment] diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index 2a210776..ca2c7a8c 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -17,7 +17,7 @@ module Axlsx require 'axlsx/stylesheet/xf.rb' require 'axlsx/stylesheet/cell_protection.rb' - #The Styles class manages worksheet styles + # The Styles class manages worksheet styles # In addition to creating the require style objects for a valid xlsx package, this class provides the key mechanism for adding styles to your workbook, and safely applying them to the cells of your worksheet. # All portions of the stylesheet are implemented here exception colors, which specify legacy and modified pallete colors, and exLst, whic is used as a future feature data storage area. # @see Office Open XML Part 1 18.8.11 for gory details on how this stuff gets put together @@ -468,10 +468,10 @@ module Axlsx def parse_num_fmt_options(options = {}) return if (options.keys & [:format_code, :num_fmt]).empty? - #When the user provides format_code - we always need to create a new numFmt object - #When the type is :dxf we always need to create a new numFmt object + # When the user provides format_code - we always need to create a new numFmt object + # When the type is :dxf we always need to create a new numFmt object if options[:format_code] || options[:type] == :dxf - #If this is a standard xf we pull from numFmts the highest current and increment for num_fmt + # If this is a standard xf we pull from numFmts the highest current and increment for num_fmt options[:num_fmt] ||= (@numFmts.map { |num_fmt| num_fmt.numFmtId }.max + 1) if options[:type] != :dxf numFmt = NumFmt.new(:numFmtId => options[:num_fmt] || 0, :formatCode => options[:format_code].to_s) options[:type] == :dxf ? numFmt : (numFmts << numFmt; numFmt.numFmtId) diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb index e7a84a46..e58608f7 100644 --- a/lib/axlsx/stylesheet/xf.rb +++ b/lib/axlsx/stylesheet/xf.rb @@ -2,7 +2,7 @@ module Axlsx # The Xf class defines a formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style # @see Styles#add_style class Xf - #does not support extList (ExtensionList) + # does not support extList (ExtensionList) include Axlsx::SerializedAttributes include Axlsx::OptionsParser diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb index 7a49a0eb..55e2b58f 100644 --- a/lib/axlsx/util/constants.rb +++ b/lib/axlsx/util/constants.rb @@ -95,7 +95,7 @@ module Axlsx # comment relation for nil target COMMENT_R_NULL = "http://purl.oclc.org/ooxml/officeDocument/relationships/comments".freeze - #vml drawing relation namespace + # vml drawing relation namespace VML_DRAWING_R = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing' # VML Drawing content type @@ -158,7 +158,7 @@ module Axlsx # png content type PNG_CT = "image/png".freeze - #drawing content type + # drawing content type DRAWING_CT = "application/vnd.openxmlformats-officedocument.drawing+xml".freeze # xml content type extensions diff --git a/lib/axlsx/workbook/defined_name.rb b/lib/axlsx/workbook/defined_name.rb index 2632e8ef..d3b6e1ef 100644 --- a/lib/axlsx/workbook/defined_name.rb +++ b/lib/axlsx/workbook/defined_name.rb @@ -2,9 +2,9 @@ # Sheet1!$1:$1 # -# +#  # -# +#  # # # diff --git a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb index 9e753759..bf3426b6 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb @@ -2,7 +2,7 @@ require 'axlsx/workbook/worksheet/auto_filter/filter_column.rb' require 'axlsx/workbook/worksheet/auto_filter/filters.rb' module Axlsx - #This class represents an auto filter range in a worksheet + # This class represents an auto filter range in a worksheet class AutoFilter # creates a new Autofilter object # @param [Worksheet] worksheet diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb index 1fa2ff78..32a9df26 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb @@ -16,7 +16,7 @@ module Axlsx # @option [Boolean] show_button @see show_button def initialize(col_id, filter_type, options = {}) RestrictionValidator.validate 'FilterColumn.filter', FILTERS, filter_type - #Axlsx::validate_unsigned_int(col_id) + # Axlsx::validate_unsigned_int(col_id) self.col_id = col_id parse_options options @filter = Axlsx.const_get(Axlsx.camel(filter_type)).new(options) @@ -26,7 +26,7 @@ module Axlsx serializable_attributes :col_id, :hidden_button, :show_button # Allowed filters - FILTERS = [:filters] #, :top10, :custom_filters, :dynamic_filters, :color_filters, :icon_filters] + FILTERS = [:filters] # , :top10, :custom_filters, :dynamic_filters, :color_filters, :icon_filters] # Zero-based index indicating the AutoFilter column to which this filter information applies. # @return [Integer] diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index 554df012..83da2da2 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -113,7 +113,7 @@ module Axlsx @val = value end - #Filter value used in the criteria. + # Filter value used in the criteria. attr_accessor :val # Serializes the filter value object diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index cc668208..364de1e9 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -150,7 +150,7 @@ module Axlsx # @see value def value=(v) - #TODO: consider doing value based type determination first? + # TODO: consider doing value based type determination first? @value = cast_value(v) end @@ -537,7 +537,7 @@ module Axlsx when :boolean v ? 1 : 0 when :iso_8601 - #consumer is responsible for ensuring the iso_8601 format when specifying this type + # consumer is responsible for ensuring the iso_8601 format when specifying this type v else v.to_s diff --git a/lib/axlsx/workbook/worksheet/cfvos.rb b/lib/axlsx/workbook/worksheet/cfvos.rb index 44db4dfd..c5fa80f3 100644 --- a/lib/axlsx/workbook/worksheet/cfvos.rb +++ b/lib/axlsx/workbook/worksheet/cfvos.rb @@ -1,6 +1,6 @@ module Axlsx - #A collection of Cfvo objects that initializes with the required - #first two items + # A collection of Cfvo objects that initializes with the required + # first two items class Cfvos < SimpleTypedList def initialize super(Cfvo) diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index da3a9364..37c38365 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -111,7 +111,7 @@ module Axlsx # is to only set this if a calculated value is greated than the # current @width value. # TODO!!! - #Axlsx.validate_unsigned_numeric(v) unless v == nil + # Axlsx.validate_unsigned_numeric(v) unless v == nil @custom_width = @best_fit = v != nil @width = v.nil? ? v : [v, MAX_WIDTH].min end diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb index 6b07466e..c10e28ce 100644 --- a/lib/axlsx/workbook/worksheet/page_setup.rb +++ b/lib/axlsx/workbook/worksheet/page_setup.rb @@ -64,120 +64,120 @@ module Axlsx attr_reader :scale # The paper size to use in printing - #1 = Letter paper (8.5 in. by 11 in.) - #2 = Letter small paper (8.5 in. by 11 in.) - #3 = Tabloid paper (11 in. by 17 in.) - #4 = Ledger paper (17 in. by 11 in.) - #5 = Legal paper (8.5 in. by 14 in.) - #6 = Statement paper (5.5 in. by 8.5 in.) - #7 = Executive paper (7.25 in. by 10.5 in.) - #8 = A3 paper (297 mm by 420 mm) - #9 = A4 paper (210 mm by 297 mm) - #10 = A4 small paper (210 mm by 297 mm) - #11 = A5 paper (148 mm by 210 mm) - #12 = B4 paper (250 mm by 353 mm) - #13 = B5 paper (176 mm by 250 mm) - #14 = Folio paper (8.5 in. by 13 in.) - #15 = Quarto paper (215 mm by 275 mm) - #16 = Standard paper (10 in. by 14 in.) - #17 = Standard paper (11 in. by 17 in.) - #18 = Note paper (8.5 in. by 11 in.) - #19 = #9 envelope (3.875 in. by 8.875 in.) - #20 = #10 envelope (4.125 in. by 9.5 in.) - #21 = #11 envelope (4.5 in. by 10.375 in.) - #22 = #12 envelope (4.75 in. by 11 in.) - #23 = #14 envelope (5 in. by 11.5 in.) 24 = C paper (17 in. by 22 in.) - #25 = D paper (22 in. by 34 in.) - #26 = E paper (34 in. by 44 in.) - #27 = DL envelope (110 mm by 220 mm) - #28 = C5 envelope (162 mm by 229 mm) - #29 = C3 envelope (324 mm by 458 mm) - #30 = C4 envelope (229 mm by 324 mm) - #31 = C6 envelope (114 mm by 162 mm) - #32 = C65 envelope (114 mm by 229 mm) - #33 = B4 envelope (250 mm by 353 mm) - #34 = B5 envelope (176 mm by 250 mm) - #35 = B6 envelope (176 mm by 125 mm) - #36 = Italy envelope (110 mm by 230 mm) - #37 = Monarch envelope (3.875 in. by 7.5 in.). 38 = 6 3/4 envelope (3.625 in. by 6.5 in.) - #39 = US standard fanfold (14.875 in. by 11 in.) - #40 = German standard fanfold (8.5 in. by 12 in.) - #41 = German legal fanfold (8.5 in. by 13 in.) - #42 = ISO B4 (250 mm by 353 mm) - #43 = Japanese double postcard (200 mm by 148 mm) - #44 = Standard paper (9 in. by 11 in.) - #45 = Standard paper (10 in. by 11 in.) - #46 = Standard paper (15 in. by 11 in.) - #47 = Invite envelope (220 mm by 220 mm) - #50 = Letter extra paper (9.275 in. by 12 in.) - #51 = Legal extra paper (9.275 in. by 15 in.) - #52 = Tabloid extra paper (11.69 in. by 18 in.) - #53 = A4 extra paper (236 mm by 322 mm) - #54 = Letter transverse paper (8.275 in. by 11 in.) - #55 = A4 transverse paper (210 mm by 297 mm) - #56 = Letter extra transverse paper (9.275 in. by 12 in.) - #57 = SuperA/SuperA/A4 paper (227 mm by 356 mm) - #58 = SuperB/SuperB/A3 paper (305 mm by 487 mm) - #59 = Letter plus paper (8.5 in. by 12.69 in.) - #60 = A4 plus paper (210 mm by 330 mm) - #61 = A5 transverse paper (148 mm by 210 mm) - #62 = JIS B5 transverse paper (182 mm by 257 mm) - #63 = A3 extra paper (322 mm by 445 mm) - #64 = A5 extra paper (174 mm by 235 mm) - #65 = ISO B5 extra paper (201 mm by 276 mm) - #66 = A2 paper (420 mm by 594 mm) - #67 = A3 transverse paper (297 mm by 420 mm) - #68 = A3 extra transverse paper (322 mm by 445 mm) - #69 = Japanese Double Postcard (200 mm x 148 mm) - #70 = A6 (105 mm x 148 mm - #71 = Japanese Envelope Kaku #2 - #72 = Japanese Envelope Kaku #3 - #73 = Japanese Envelope Chou #3 - #74 = Japanese Envelope Chou #4 - #75 = Letter Rotated (11in x 8 1/2 11 in) - #76 = A3 Rotated (420 mm x 297 mm) - #77 = A4 Rotated (297 mm x 210 mm) - #78 = A5 Rotated (210 mm x 148 mm) - #79 = B4 (JIS) Rotated (364 mm x 257 mm) - #80 = B5 (JIS) Rotated (257 mm x 182 mm) - #81 = Japanese Postcard Rotated (148 mm x 100 mm) - #82 = Double Japanese Postcard Rotated (148 mm x 200 mm) - #83 = A6 Rotated (148 mm x 105 mm) - #84 = Japanese Envelope Kaku #2 Rotated - #85 = Japanese Envelope Kaku #3 Rotated - #86 = Japanese Envelope Chou #3 Rotated - #87 = Japanese Envelope Chou #4 Rotated - #88 = B6 (JIS) (128 mm x 182 mm) - #89 = B6 (JIS) Rotated (182 mm x 128 mm) - #90 = (12 in x 11 in) - #91 = Japanese Envelope You #4 - #92 = Japanese Envelope You #4 Rotated - #93 = PRC 16K (146 mm x 215 mm) - #94 = PRC 32K (97 mm x 151 mm) - #95 = PRC 32K(Big) (97 mm x 151 mm) - #96 = PRC Envelope #1 (102 mm x 165 mm) - #97 = PRC Envelope #2 (102 mm x 176 mm) - #98 = PRC Envelope #3 (125 mm x 176 mm) - #99 = PRC Envelope #4 (110 mm x 208 mm) - #100 = PRC Envelope #5 (110 mm x 220 mm) - #101 = PRC Envelope #6 (120 mm x 230 mm) - #102 = PRC Envelope #7 (160 mm x 230 mm) - #103 = PRC Envelope #8 (120 mm x 309 mm) - #104 = PRC Envelope #9 (229 mm x 324 mm) - #105 = PRC Envelope #10 (324 mm x 458 mm) - #106 = PRC 16K Rotated - #107 = PRC 32K Rotated - #108 = PRC 32K(Big) Rotated - #109 = PRC Envelope #1 Rotated (165 mm x 102 mm) - #110 = PRC Envelope #2 Rotated (176 mm x 102 mm) - #111 = PRC Envelope #3 Rotated (176 mm x 125 mm) - #112 = PRC Envelope #4 Rotated (208 mm x 110 mm) - #113 = PRC Envelope #5 Rotated (220 mm x 110 mm) - #114 = PRC Envelope #6 Rotated (230 mm x 120 mm) - #115 = PRC Envelope #7 Rotated (230 mm x 160 mm) - #116 = PRC Envelope #8 Rotated (309 mm x 120 mm) - #117 = PRC Envelope #9 Rotated (324 mm x 229 mm) - #118 = PRC Envelope #10 Rotated (458 mm x 324 mm) + # 1 = Letter paper (8.5 in. by 11 in.) + # 2 = Letter small paper (8.5 in. by 11 in.) + # 3 = Tabloid paper (11 in. by 17 in.) + # 4 = Ledger paper (17 in. by 11 in.) + # 5 = Legal paper (8.5 in. by 14 in.) + # 6 = Statement paper (5.5 in. by 8.5 in.) + # 7 = Executive paper (7.25 in. by 10.5 in.) + # 8 = A3 paper (297 mm by 420 mm) + # 9 = A4 paper (210 mm by 297 mm) + # 10 = A4 small paper (210 mm by 297 mm) + # 11 = A5 paper (148 mm by 210 mm) + # 12 = B4 paper (250 mm by 353 mm) + # 13 = B5 paper (176 mm by 250 mm) + # 14 = Folio paper (8.5 in. by 13 in.) + # 15 = Quarto paper (215 mm by 275 mm) + # 16 = Standard paper (10 in. by 14 in.) + # 17 = Standard paper (11 in. by 17 in.) + # 18 = Note paper (8.5 in. by 11 in.) + # 19 = #9 envelope (3.875 in. by 8.875 in.) + # 20 = #10 envelope (4.125 in. by 9.5 in.) + # 21 = #11 envelope (4.5 in. by 10.375 in.) + # 22 = #12 envelope (4.75 in. by 11 in.) + # 23 = #14 envelope (5 in. by 11.5 in.) 24 = C paper (17 in. by 22 in.) + # 25 = D paper (22 in. by 34 in.) + # 26 = E paper (34 in. by 44 in.) + # 27 = DL envelope (110 mm by 220 mm) + # 28 = C5 envelope (162 mm by 229 mm) + # 29 = C3 envelope (324 mm by 458 mm) + # 30 = C4 envelope (229 mm by 324 mm) + # 31 = C6 envelope (114 mm by 162 mm) + # 32 = C65 envelope (114 mm by 229 mm) + # 33 = B4 envelope (250 mm by 353 mm) + # 34 = B5 envelope (176 mm by 250 mm) + # 35 = B6 envelope (176 mm by 125 mm) + # 36 = Italy envelope (110 mm by 230 mm) + # 37 = Monarch envelope (3.875 in. by 7.5 in.). 38 = 6 3/4 envelope (3.625 in. by 6.5 in.) + # 39 = US standard fanfold (14.875 in. by 11 in.) + # 40 = German standard fanfold (8.5 in. by 12 in.) + # 41 = German legal fanfold (8.5 in. by 13 in.) + # 42 = ISO B4 (250 mm by 353 mm) + # 43 = Japanese double postcard (200 mm by 148 mm) + # 44 = Standard paper (9 in. by 11 in.) + # 45 = Standard paper (10 in. by 11 in.) + # 46 = Standard paper (15 in. by 11 in.) + # 47 = Invite envelope (220 mm by 220 mm) + # 50 = Letter extra paper (9.275 in. by 12 in.) + # 51 = Legal extra paper (9.275 in. by 15 in.) + # 52 = Tabloid extra paper (11.69 in. by 18 in.) + # 53 = A4 extra paper (236 mm by 322 mm) + # 54 = Letter transverse paper (8.275 in. by 11 in.) + # 55 = A4 transverse paper (210 mm by 297 mm) + # 56 = Letter extra transverse paper (9.275 in. by 12 in.) + # 57 = SuperA/SuperA/A4 paper (227 mm by 356 mm) + # 58 = SuperB/SuperB/A3 paper (305 mm by 487 mm) + # 59 = Letter plus paper (8.5 in. by 12.69 in.) + # 60 = A4 plus paper (210 mm by 330 mm) + # 61 = A5 transverse paper (148 mm by 210 mm) + # 62 = JIS B5 transverse paper (182 mm by 257 mm) + # 63 = A3 extra paper (322 mm by 445 mm) + # 64 = A5 extra paper (174 mm by 235 mm) + # 65 = ISO B5 extra paper (201 mm by 276 mm) + # 66 = A2 paper (420 mm by 594 mm) + # 67 = A3 transverse paper (297 mm by 420 mm) + # 68 = A3 extra transverse paper (322 mm by 445 mm) + # 69 = Japanese Double Postcard (200 mm x 148 mm) + # 70 = A6 (105 mm x 148 mm + # 71 = Japanese Envelope Kaku #2 + # 72 = Japanese Envelope Kaku #3 + # 73 = Japanese Envelope Chou #3 + # 74 = Japanese Envelope Chou #4 + # 75 = Letter Rotated (11in x 8 1/2 11 in) + # 76 = A3 Rotated (420 mm x 297 mm) + # 77 = A4 Rotated (297 mm x 210 mm) + # 78 = A5 Rotated (210 mm x 148 mm) + # 79 = B4 (JIS) Rotated (364 mm x 257 mm) + # 80 = B5 (JIS) Rotated (257 mm x 182 mm) + # 81 = Japanese Postcard Rotated (148 mm x 100 mm) + # 82 = Double Japanese Postcard Rotated (148 mm x 200 mm) + # 83 = A6 Rotated (148 mm x 105 mm) + # 84 = Japanese Envelope Kaku #2 Rotated + # 85 = Japanese Envelope Kaku #3 Rotated + # 86 = Japanese Envelope Chou #3 Rotated + # 87 = Japanese Envelope Chou #4 Rotated + # 88 = B6 (JIS) (128 mm x 182 mm) + # 89 = B6 (JIS) Rotated (182 mm x 128 mm) + # 90 = (12 in x 11 in) + # 91 = Japanese Envelope You #4 + # 92 = Japanese Envelope You #4 Rotated + # 93 = PRC 16K (146 mm x 215 mm) + # 94 = PRC 32K (97 mm x 151 mm) + # 95 = PRC 32K(Big) (97 mm x 151 mm) + # 96 = PRC Envelope #1 (102 mm x 165 mm) + # 97 = PRC Envelope #2 (102 mm x 176 mm) + # 98 = PRC Envelope #3 (125 mm x 176 mm) + # 99 = PRC Envelope #4 (110 mm x 208 mm) + # 100 = PRC Envelope #5 (110 mm x 220 mm) + # 101 = PRC Envelope #6 (120 mm x 230 mm) + # 102 = PRC Envelope #7 (160 mm x 230 mm) + # 103 = PRC Envelope #8 (120 mm x 309 mm) + # 104 = PRC Envelope #9 (229 mm x 324 mm) + # 105 = PRC Envelope #10 (324 mm x 458 mm) + # 106 = PRC 16K Rotated + # 107 = PRC 32K Rotated + # 108 = PRC 32K(Big) Rotated + # 109 = PRC Envelope #1 Rotated (165 mm x 102 mm) + # 110 = PRC Envelope #2 Rotated (176 mm x 102 mm) + # 111 = PRC Envelope #3 Rotated (176 mm x 125 mm) + # 112 = PRC Envelope #4 Rotated (208 mm x 110 mm) + # 113 = PRC Envelope #5 Rotated (220 mm x 110 mm) + # 114 = PRC Envelope #6 Rotated (230 mm x 120 mm) + # 115 = PRC Envelope #7 Rotated (230 mm x 160 mm) + # 116 = PRC Envelope #8 Rotated (309 mm x 120 mm) + # 117 = PRC Envelope #9 Rotated (324 mm x 229 mm) + # 118 = PRC Envelope #10 Rotated (458 mm x 324 mm) # @return [Integer] attr_reader :paper_size diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb index f9323d3e..e752ab22 100644 --- a/lib/axlsx/workbook/worksheet/pane.rb +++ b/lib/axlsx/workbook/worksheet/pane.rb @@ -13,7 +13,7 @@ module Axlsx # @option options [Integer] x_split Horizontal Split Position # @option options [Integer] y_split Vertical Split Position def initialize(options = {}) - #defaults + # defaults @active_pane = @state = @top_left_cell = nil @x_split = @y_split = 0 parse_options options diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index b36f8875..7433d5bb 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -101,7 +101,7 @@ module Axlsx chars.collect! do |char| i += 1 - char = char.unpack('c')[0] << i #ord << i + char = char.unpack('c')[0] << i # ord << i low_15 = char & 0x7fff high_15 = char & 0x7fff << 15 high_15 = high_15 >> 15 diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index 8c2a0cd5..dc41d01a 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -29,7 +29,7 @@ module Axlsx # @option options [Integer] zoom_scale_page_layout_view Zoom Scale Page Layout View # @option options [Integer] zoom_scale_sheet_layout_view Zoom Scale Page Break Preview def initialize(options = {}) - #defaults + # defaults @color_id = @top_left_cell = @pane = nil @right_to_left = @show_formulas = @show_outline_symbols = @show_white_space = @tab_selected = @window_protection = false @default_grid_color = @show_grid_lines = @show_row_col_headers = @show_ruler = @show_zeros = true diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb index f20d671d..60615f1c 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb @@ -25,7 +25,7 @@ module Axlsx serializable_attributes :display, :tooltip, :ref - #Cell location of hyperlink on worksheet. + # Cell location of hyperlink on worksheet. # @return [String] attr_reader :ref diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb index 4771efb1..44c6125a 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb @@ -1,5 +1,5 @@ module Axlsx - #A collection of hyperlink objects for a worksheet + # A collection of hyperlink objects for a worksheet class WorksheetHyperlinks < SimpleTypedList # Creates a new Hyperlinks collection # @param [Worksheet] worksheet the worksheet that owns these hyperlinks diff --git a/test/content_type/tc_content_type.rb b/test/content_type/tc_content_type.rb index f06554c8..c79352ff 100644 --- a/test/content_type/tc_content_type.rb +++ b/test/content_type/tc_content_type.rb @@ -15,7 +15,7 @@ class TestContentType < Test::Unit::TestCase o_path = "//xmlns:Override[@ContentType='%s']" d_path = "//xmlns:Default[@ContentType='%s']" - #default + # default assert_equal(@doc.xpath("//xmlns:Default").size, 2, "There should be 2 default types") node = @doc.xpath(d_path % Axlsx::XML_CT).first @@ -24,7 +24,7 @@ class TestContentType < Test::Unit::TestCase node = @doc.xpath(d_path % Axlsx::RELS_CT).first assert_equal(node["Extension"], "#{Axlsx::RELS_EX}", "relationships content type invalid") - #overrride + # overrride assert_equal(@doc.xpath("//xmlns:Override").size, 4, "There should be 4 Override types") node = @doc.xpath(o_path % Axlsx::APP_CT).first diff --git a/test/drawing/tc_pic.rb b/test/drawing/tc_pic.rb index 6760fa58..56042de5 100644 --- a/test/drawing/tc_pic.rb +++ b/test/drawing/tc_pic.rb @@ -18,7 +18,7 @@ class TestPic < Test::Unit::TestCase end def test_anchor_swapping - #swap from one cell to two cell when end_at is specified + # swap from one cell to two cell when end_at is specified assert(@image.anchor.is_a?(Axlsx::OneCellAnchor)) start_at = @image.anchor.from @image.end_at 10, 5 @@ -28,7 +28,7 @@ class TestPic < Test::Unit::TestCase assert_equal(10, @image.anchor.to.col) assert_equal(5, @image.anchor.to.row) - #swap from two cell to one cell when width or height are specified + # swap from two cell to one cell when width or height are specified @image.width = 200 assert(@image.anchor.is_a?(Axlsx::OneCellAnchor)) assert_equal(start_at.col, @image.anchor.from.col) diff --git a/test/drawing/tc_pie_series.rb b/test/drawing/tc_pie_series.rb index ce516f83..c3f5bb3a 100644 --- a/test/drawing/tc_pie_series.rb +++ b/test/drawing/tc_pie_series.rb @@ -27,5 +27,5 @@ class TestPieSeries < Test::Unit::TestCase doc = Nokogiri::XML(@series.to_xml_string) assert(doc.xpath("//srgbClr[@val='#{@series.colors[0]}']")) end - #TODO test unique serialization parts + # TODO test unique serialization parts end diff --git a/test/profile.rb b/test/profile.rb index 4805dad8..ef42c2f8 100644 --- a/test/profile.rb +++ b/test/profile.rb @@ -3,7 +3,7 @@ $:.unshift "#{File.dirname(__FILE__)}/../lib" require 'axlsx' require 'ruby-prof' -#RubyProf.measure_mode = RubyProf::MEMORY +# RubyProf.measure_mode = RubyProf::MEMORY # row = [] # Taking worst case scenario of all string data diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index 78e82354..1598a658 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -62,7 +62,7 @@ class TestStyles < Test::Unit::TestCase end def test_do_not_alter_options_in_add_style - #This should test all options, but for now - just the bits that we know caused some pain + # This should test all options, but for now - just the bits that we know caused some pain options = { :border => { :style => :thin, :color => "FF000000" } } @styles.add_style options assert_equal options[:border][:style], :thin, 'thin style is stil in option' diff --git a/test/tc_package.rb b/test/tc_package.rb index c8f35211..cc40a6e0 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -249,7 +249,7 @@ class TestPackage < Test::Unit::TestCase def test_parts p = @package.send(:parts) - #all parts have an entry + # all parts have an entry assert_equal(p.select { |part| part[:entry] =~ /_rels\/\.rels/ }.size, 1, "rels missing") assert_equal(p.select { |part| part[:entry] =~ /docProps\/core\.xml/ }.size, 1, "core missing") assert_equal(p.select { |part| part[:entry] =~ /docProps\/app\.xml/ }.size, 1, "app missing") @@ -267,10 +267,10 @@ class TestPackage < Test::Unit::TestCase assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotTables\/_rels\/pivotTable\d\.xml.rels/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables rels missing") assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotCache\/pivotCacheDefinition\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing") - #no mystery parts + # no mystery parts assert_equal(25, p.size) - #sorted for correct MIME detection + # sorted for correct MIME detection assert_equal("[Content_Types].xml", p[0][:entry], "first entry should be `[Content_Types].xml`") assert_equal("_rels/.rels", p[1][:entry], "second entry should be `_rels/.rels`") assert_match(/\Axl\//, p[2][:entry], "third entry should begin with `xl/`") @@ -278,7 +278,7 @@ class TestPackage < Test::Unit::TestCase def test_shared_strings_requires_part @package.use_shared_strings = true - @package.to_stream #ensure all cell_serializer paths are hit + @package.to_stream # ensure all cell_serializer paths are hit p = @package.send(:parts) assert_equal(p.select { |part| part[:entry] =~ /xl\/sharedStrings.xml/ }.size, 1, "shared strings table missing") end diff --git a/test/util/tc_simple_typed_list.rb b/test/util/tc_simple_typed_list.rb index abcacf26..fc1ab0a2 100644 --- a/test/util/tc_simple_typed_list.rb +++ b/test/util/tc_simple_typed_list.rb @@ -16,7 +16,7 @@ class TestSimpleTypedList < Test::Unit::TestCase end def test_indexed_based_assignment - #should not allow nil assignment + # should not allow nil assignment assert_raise(ArgumentError) { @list[0] = nil } assert_raise(ArgumentError) { @list[0] = "1" } assert_nothing_raised { @list[0] = 1 } @@ -57,7 +57,7 @@ class TestSimpleTypedList < Test::Unit::TestCase @list.push 4 assert_nothing_raised { @list.delete_at 3 } @list.unlock - #ignore garbage + # ignore garbage assert_nothing_raised { @list.delete 0 } assert_nothing_raised { @list.delete 9 } end diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb index ba3edba6..7df2e41b 100644 --- a/test/util/tc_validators.rb +++ b/test/util/tc_validators.rb @@ -7,71 +7,71 @@ class TestValidators < Test::Unit::TestCase end def test_validators - #unsigned_int + # unsigned_int assert_nothing_raised { Axlsx.validate_unsigned_int 1 } assert_nothing_raised { Axlsx.validate_unsigned_int(+1) } assert_raise(ArgumentError) { Axlsx.validate_unsigned_int(-1) } assert_raise(ArgumentError) { Axlsx.validate_unsigned_int('1') } - #int + # int assert_nothing_raised { Axlsx.validate_int(1) } assert_nothing_raised { Axlsx.validate_int(-1) } assert_raise(ArgumentError) { Axlsx.validate_int('a') } assert_raise(ArgumentError) { Axlsx.validate_int(Array) } - #boolean (as 0 or 1, :true, :false, true, false, or "true," "false") + # boolean (as 0 or 1, :true, :false, true, false, or "true," "false") [0, 1, :true, :false, true, false, "true", "false"].each do |v| assert_nothing_raised { Axlsx.validate_boolean 0 } end assert_raise(ArgumentError) { Axlsx.validate_boolean 2 } - #string + # string assert_nothing_raised { Axlsx.validate_string "1" } assert_raise(ArgumentError) { Axlsx.validate_string 2 } assert_raise(ArgumentError) { Axlsx.validate_string false } - #float + # float assert_nothing_raised { Axlsx.validate_float 1.0 } assert_raise(ArgumentError) { Axlsx.validate_float 2 } assert_raise(ArgumentError) { Axlsx.validate_float false } - #pattern_type + # pattern_type assert_nothing_raised { Axlsx.validate_pattern_type :none } assert_raise(ArgumentError) { Axlsx.validate_pattern_type "none" } assert_raise(ArgumentError) { Axlsx.validate_pattern_type "crazy_pattern" } assert_raise(ArgumentError) { Axlsx.validate_pattern_type false } - #gradient_type + # gradient_type assert_nothing_raised { Axlsx.validate_gradient_type :path } assert_raise(ArgumentError) { Axlsx.validate_gradient_type nil } assert_raise(ArgumentError) { Axlsx.validate_gradient_type "fractal" } assert_raise(ArgumentError) { Axlsx.validate_gradient_type false } - #horizontal alignment + # horizontal alignment assert_nothing_raised { Axlsx.validate_horizontal_alignment :general } assert_raise(ArgumentError) { Axlsx.validate_horizontal_alignment nil } assert_raise(ArgumentError) { Axlsx.validate_horizontal_alignment "wavy" } assert_raise(ArgumentError) { Axlsx.validate_horizontal_alignment false } - #vertical alignment + # vertical alignment assert_nothing_raised { Axlsx.validate_vertical_alignment :top } assert_raise(ArgumentError) { Axlsx.validate_vertical_alignment nil } assert_raise(ArgumentError) { Axlsx.validate_vertical_alignment "dynamic" } assert_raise(ArgumentError) { Axlsx.validate_vertical_alignment false } - #contentType + # contentType assert_nothing_raised { Axlsx.validate_content_type Axlsx::WORKBOOK_CT } assert_raise(ArgumentError) { Axlsx.validate_content_type nil } assert_raise(ArgumentError) { Axlsx.validate_content_type "http://some.url" } assert_raise(ArgumentError) { Axlsx.validate_content_type false } - #relationshipType + # relationshipType assert_nothing_raised { Axlsx.validate_relationship_type Axlsx::WORKBOOK_R } assert_raise(ArgumentError) { Axlsx.validate_relationship_type nil } assert_raise(ArgumentError) { Axlsx.validate_relationship_type "http://some.url" } assert_raise(ArgumentError) { Axlsx.validate_relationship_type false } - #number_with_unit + # number_with_unit assert_nothing_raised { Axlsx.validate_number_with_unit "210mm" } assert_nothing_raised { Axlsx.validate_number_with_unit "8.5in" } assert_nothing_raised { Axlsx.validate_number_with_unit "29.7cm" } @@ -84,7 +84,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_number_with_unit "mm" } assert_raise(ArgumentError) { Axlsx.validate_number_with_unit "-29cm" } - #scale_10_400 + # scale_10_400 assert_nothing_raised { Axlsx.validate_scale_10_400 10 } assert_nothing_raised { Axlsx.validate_scale_10_400 100 } assert_nothing_raised { Axlsx.validate_scale_10_400 400 } @@ -93,7 +93,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_scale_10_400 400.1 } assert_raise(ArgumentError) { Axlsx.validate_scale_10_400 "99" } - #scale_0_10_400 + # scale_0_10_400 assert_nothing_raised { Axlsx.validate_scale_0_10_400 0 } assert_nothing_raised { Axlsx.validate_scale_0_10_400 10 } assert_nothing_raised { Axlsx.validate_scale_0_10_400 100 } @@ -103,7 +103,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_scale_0_10_400 400.1 } assert_raise(ArgumentError) { Axlsx.validate_scale_0_10_400 "99" } - #page_orientation + # page_orientation assert_nothing_raised { Axlsx.validate_page_orientation :default } assert_nothing_raised { Axlsx.validate_page_orientation :landscape } assert_nothing_raised { Axlsx.validate_page_orientation :portrait } @@ -111,7 +111,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_page_orientation 1 } assert_raise(ArgumentError) { Axlsx.validate_page_orientation "landscape" } - #data_validation_error_style + # data_validation_error_style [:information, :stop, :warning].each do |sym| assert_nothing_raised { Axlsx.validate_data_validation_error_style sym } end @@ -119,7 +119,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 'warning' } assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 0 } - #data_validation_operator + # data_validation_operator [:lessThan, :lessThanOrEqual, :equal, :notEqual, :greaterThanOrEqual, :greaterThan, :between, :notBetween].each do |sym| assert_nothing_raised { Axlsx.validate_data_validation_operator sym } end @@ -127,7 +127,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 'lessThan' } assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 0 } - #data_validation_type + # data_validation_type [:custom, :data, :decimal, :list, :none, :textLength, :date, :time, :whole].each do |sym| assert_nothing_raised { Axlsx.validate_data_validation_type sym } end @@ -135,7 +135,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 'decimal' } assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 0 } - #sheet_view_type + # sheet_view_type [:normal, :page_break_preview, :page_layout].each do |sym| assert_nothing_raised { Axlsx.validate_sheet_view_type sym } end @@ -143,7 +143,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 'page_layout' } assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 0 } - #active_pane_type + # active_pane_type [:bottom_left, :bottom_right, :top_left, :top_right].each do |sym| assert_nothing_raised { Axlsx.validate_pane_type sym } end @@ -151,7 +151,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_pane_type 'bottom_left' } assert_raise(ArgumentError) { Axlsx.validate_pane_type 0 } - #split_state_type + # split_state_type [:frozen, :frozen_split, :split].each do |sym| assert_nothing_raised { Axlsx.validate_split_state_type sym } end @@ -159,7 +159,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_split_state_type 'frozen_split' } assert_raise(ArgumentError) { Axlsx.validate_split_state_type 0 } - #display_blanks_as + # display_blanks_as [:gap, :span, :zero].each do |sym| assert_nothing_raised { Axlsx.validate_display_blanks_as sym } end @@ -167,7 +167,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_display_blanks_as 'other_blank' } assert_raise(ArgumentError) { Axlsx.validate_display_blanks_as 0 } - #view_visibility + # view_visibility [:visible, :hidden, :very_hidden].each do |sym| assert_nothing_raised { Axlsx.validate_view_visibility sym } end @@ -175,7 +175,7 @@ class TestValidators < Test::Unit::TestCase assert_raise(ArgumentError) { Axlsx.validate_view_visibility 'other_visibility' } assert_raise(ArgumentError) { Axlsx.validate_view_visibility 0 } - #marker_symbol + # marker_symbol [:default, :circle, :dash, :diamond, :dot, :picture, :plus, :square, :star, :triangle, :x].each do |sym| assert_nothing_raised { Axlsx.validate_marker_symbol sym } end diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb index c5a72e48..c085ed91 100644 --- a/test/workbook/tc_workbook.rb +++ b/test/workbook/tc_workbook.rb @@ -90,7 +90,7 @@ class TestWorkbook < Test::Unit::TestCase end def test_relationships - #current relationship size is 1 due to style relation + # current relationship size is 1 due to style relation assert(@wb.relationships.size == 1) @wb.add_worksheet assert(@wb.relationships.size == 2) diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb index a4aab11c..f5264115 100644 --- a/test/workbook/worksheet/tc_cell.rb +++ b/test/workbook/worksheet/tc_cell.rb @@ -112,7 +112,7 @@ class TestCell < Test::Unit::TestCase end def test_col_ref - #TODO move to axlsx spec + # TODO move to axlsx spec assert_equal(Axlsx.col_ref(0), "A") end diff --git a/test/workbook/worksheet/tc_col.rb b/test/workbook/worksheet/tc_col.rb index 80b228d0..908e9931 100644 --- a/test/workbook/worksheet/tc_col.rb +++ b/test/workbook/worksheet/tc_col.rb @@ -86,6 +86,6 @@ class TestCol < Test::Unit::TestCase assert_equal(@col.style, nil) @col.style = 1 assert_equal(@col.style, 1) - #TODO check that the style specified is actually in the styles xfs collection + # TODO check that the style specified is actually in the styles xfs collection end end diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index dcbb3ca6..2c8292ee 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -187,7 +187,7 @@ class TestConditionalFormatting < Test::Unit::TestCase end def test_percent - assert_raise(ArgumentError) { @cfr.percent = "10%" } #WRONG! + assert_raise(ArgumentError) { @cfr.percent = "10%" } # WRONG! assert_nothing_raised { @cfr.percent = true } assert_equal(@cfr.percent, true) end diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 09ce8290..3dffee39 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -5,7 +5,7 @@ class TestDataValidation < Test::Unit::TestCase include CaptureWarnings def setup - #inverse defaults + # inverse defaults @boolean_options = { :allowBlank => false, :hideDropDown => true, :showErrorMessage => false, :showInputMessage => true } @nil_options = { :formula1 => 'foo', :formula2 => 'foo', :errorTitle => 'foo', :operator => :lessThan, :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' } @type_option = { :type => :whole } @@ -171,7 +171,7 @@ class TestDataValidation < Test::Unit::TestCase doc = Nokogiri::XML.parse(@ws.to_xml_string) - #test attributes + # test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='whole'] @@ -181,11 +181,11 @@ class TestDataValidation < Test::Unit::TestCase [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1] [@type='whole'][@errorStyle='information']") - #test forumula1 + # test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='5'") - #test forumula2 + # test forumula2 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula2").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula2='10'") end @@ -200,7 +200,7 @@ class TestDataValidation < Test::Unit::TestCase doc = Nokogiri::XML.parse(@ws.to_xml_string) - #test attributes + # test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'] @@ -209,7 +209,7 @@ class TestDataValidation < Test::Unit::TestCase [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'][@errorStyle='stop']") - #test forumula1 + # test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='A1:A5'") end @@ -224,7 +224,7 @@ class TestDataValidation < Test::Unit::TestCase doc = Nokogiri::XML.parse(@ws.to_xml_string) - #test attributes + # test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'][@promptTitle='Be carful!'] [@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'][@showErrorMessage=1] [@allowBlank=1][@showInputMessage=1][@type='custom'][@errorStyle='stop']").size) @@ -232,7 +232,7 @@ class TestDataValidation < Test::Unit::TestCase [@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'] [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='custom'][@errorStyle='stop']") - #test forumula1 + # test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='=5/2'") end @@ -251,7 +251,7 @@ class TestDataValidation < Test::Unit::TestCase doc = Nokogiri::XML.parse(@ws.to_xml_string) - #test attributes + # test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='whole'] @@ -261,7 +261,7 @@ class TestDataValidation < Test::Unit::TestCase [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1] [@type='whole'][@errorStyle='information']") - #test attributes + # test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='B1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'] diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb index fef1eb63..9a16866b 100644 --- a/test/workbook/worksheet/tc_pane.rb +++ b/test/workbook/worksheet/tc_pane.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestPane < Test::Unit::TestCase def setup - #inverse defaults for booleans + # inverse defaults for booleans @nil_options = { :active_pane => :bottom_left, :state => :frozen, :top_left_cell => 'A2' } @int_0_options = { :x_split => 2, :y_split => 2 } @options = @nil_options.merge(@int_0_options) diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb index 8d5452cc..b14f3e03 100644 --- a/test/workbook/worksheet/tc_sheet_protection.rb +++ b/test/workbook/worksheet/tc_sheet_protection.rb @@ -22,7 +22,7 @@ require 'tc_helper.rb' class TestSheetProtection < Test::Unit::TestCase def setup - #inverse defaults + # inverse defaults @boolean_options = { :sheet => false, :objects => true, :scenarios => true, :format_cells => false, :format_columns => false, :format_rows => false, :insert_columns => false, :insert_rows => false, :insert_hyperlinks => false, :delete_columns => false, :delete_rows => false, :select_locked_cells => true, diff --git a/test/workbook/worksheet/tc_sheet_view.rb b/test/workbook/worksheet/tc_sheet_view.rb index fb8367a8..03030d2c 100644 --- a/test/workbook/worksheet/tc_sheet_view.rb +++ b/test/workbook/worksheet/tc_sheet_view.rb @@ -3,7 +3,7 @@ require 'tc_helper.rb' class TestSheetView < Test::Unit::TestCase def setup - #inverse defaults for booleans + # inverse defaults for booleans @boolean_options = { :right_to_left => true, :show_formulas => true, :show_outline_symbols => true, :show_white_space => true, :tab_selected => true, :default_grid_color => false, :show_grid_lines => false, :show_row_col_headers => false, :show_ruler => false, :show_zeros => false, :window_protection => true } -- cgit v1.2.3 From a7532517c74ba3589279aa92042ca9da2336a5ea Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Mon, 10 Apr 2023 12:13:09 +0200 Subject: Fix some Layout/HashAlignment offenses Some offenses have been selected and fixed automatically --- .rubocop_todo.yml | 20 +++------------ test/stylesheet/tc_cell_alignment.rb | 4 +-- test/workbook/tc_workbook_view.rb | 4 +-- .../worksheet/tc_conditional_formatting.rb | 26 +++++++++---------- test/workbook/worksheet/tc_data_validation.rb | 30 +++++++++++----------- test/workbook/worksheet/tc_sheet_view.rb | 4 +-- test/workbook/worksheet/tc_table_style_info.rb | 8 +++--- 7 files changed, 41 insertions(+), 55 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 552d2f0c..192ea3ca 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-07 21:59:59 UTC using RuboCop version 1.49.0. +# on 2023-04-10 10:12:38 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -29,7 +29,7 @@ Gemspec/RequireMFA: Layout/FirstHashElementIndentation: EnforcedStyle: consistent -# Offense count: 48 +# Offense count: 12 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # SupportedHashRocketStyles: key, separator, table @@ -37,17 +37,8 @@ Layout/FirstHashElementIndentation: # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit Layout/HashAlignment: Exclude: - - 'lib/axlsx/package.rb' - - 'lib/axlsx/util/storage.rb' - 'lib/axlsx/workbook/worksheet/border_creator.rb' - - 'test/stylesheet/tc_cell_alignment.rb' - 'test/tc_axlsx.rb' - - 'test/workbook/tc_workbook_view.rb' - - 'test/workbook/worksheet/auto_filter/tc_filters.rb' - - 'test/workbook/worksheet/tc_conditional_formatting.rb' - - 'test/workbook/worksheet/tc_data_validation.rb' - - 'test/workbook/worksheet/tc_sheet_view.rb' - - 'test/workbook/worksheet/tc_table_style_info.rb' # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). @@ -56,11 +47,6 @@ Layout/HeredocIndentation: - 'lib/axlsx/drawing/vml_drawing.rb' - 'lib/axlsx/drawing/vml_shape.rb' -# Offense count: 1 -Lint/AmbiguousAssignment: - Exclude: - - 'test/workbook/worksheet/tc_rich_text.rb' - # Offense count: 2 # Configuration parameters: AllowedMethods, AllowedPatterns. Lint/AmbiguousBlockAssociation: @@ -1126,7 +1112,7 @@ Style/ZeroLengthPredicate: - 'test/tc_package.rb' - 'test/util/tc_simple_typed_list.rb' -# Offense count: 345 +# Offense count: 363 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https diff --git a/test/stylesheet/tc_cell_alignment.rb b/test/stylesheet/tc_cell_alignment.rb index fe2e9fe4..0b514bf4 100644 --- a/test/stylesheet/tc_cell_alignment.rb +++ b/test/stylesheet/tc_cell_alignment.rb @@ -16,8 +16,8 @@ class TestCellAlignment < Test::Unit::TestCase assert_equal(@item.shrinkToFit, nil) assert_equal(@item.readingOrder, nil) options = { :horizontal => :left, :vertical => :top, :textRotation => 3, - :wrapText => true, :indent => 2, :relativeIndent => 5, - :justifyLastLine => true, :shrinkToFit => true, :readingOrder => 2 } + :wrapText => true, :indent => 2, :relativeIndent => 5, + :justifyLastLine => true, :shrinkToFit => true, :readingOrder => 2 } ca = Axlsx::CellAlignment.new options options.each do |key, value| assert_equal(ca.send(key.to_sym), value) diff --git a/test/workbook/tc_workbook_view.rb b/test/workbook/tc_workbook_view.rb index 6fb300a8..8829924f 100644 --- a/test/workbook/tc_workbook_view.rb +++ b/test/workbook/tc_workbook_view.rb @@ -3,8 +3,8 @@ require 'tc_helper' class TestWorkbookView < Test::Unit::TestCase def setup @options = { visibility: :hidden, minimized: true, show_horizontal_scroll: true, show_vertical_scroll: true, - show_sheet_tabs: true, tab_ratio: 750, first_sheet: 0, active_tab: 1, x_window: 500, y_window: 400, - window_width: 800, window_height: 600, auto_filter_date_grouping: true } + show_sheet_tabs: true, tab_ratio: 750, first_sheet: 0, active_tab: 1, x_window: 500, y_window: 400, + window_width: 800, window_height: 600, auto_filter_date_grouping: true } @book_view = Axlsx::WorkbookView.new @options end diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index 2c8292ee..e6fc6324 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -26,11 +26,11 @@ class TestConditionalFormatting < Test::Unit::TestCase data_bar = Axlsx::DataBar.new :color => "FFFF0000" icon_set = Axlsx::IconSet.new :iconSet => "5Rating" cfr = Axlsx::ConditionalFormattingRule.new({ :type => :containsText, :text => "TRUE", - :dxfId => 0, :priority => 1, - :formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))', - :color_scale => color_scale, - :data_bar => data_bar, - :icon_set => icon_set }) + :dxfId => 0, :priority => 1, + :formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))', + :color_scale => color_scale, + :data_bar => data_bar, + :icon_set => icon_set }) assert(cfr.data_bar.is_a?(Axlsx::DataBar)) assert(cfr.icon_set.is_a?(Axlsx::IconSet)) @@ -69,11 +69,11 @@ class TestConditionalFormatting < Test::Unit::TestCase icon_set = Axlsx::IconSet.new :iconSet => "5Rating" cfs = @ws.add_conditional_formatting("B2:B2", [{ :type => :containsText, :text => "TRUE", - :dxfId => 0, :priority => 1, - :formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))', - :color_scale => color_scale, - :data_bar => data_bar, - :icon_set => icon_set }]) + :dxfId => 0, :priority => 1, + :formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))', + :color_scale => color_scale, + :data_bar => data_bar, + :icon_set => icon_set }]) doc = Nokogiri::XML.parse(cfs.last.to_xml_string) assert_equal(1, doc.xpath(".//conditionalFormatting[@sqref='B2:B2']//cfRule[@type='containsText'][@dxfId=0][@priority=1]").size) assert doc.xpath(".//conditionalFormatting//cfRule[@type='containsText'][@dxfId=0][@priority=1]//formula='NOT(ISERROR(SEARCH(\"FALSE\",AB1)))'") @@ -104,9 +104,9 @@ class TestConditionalFormatting < Test::Unit::TestCase def test_many_options cf = Axlsx::ConditionalFormatting.new(:sqref => "B3:B4") cf.add_rule({ :type => :cellIs, :aboveAverage => false, :bottom => false, :dxfId => 0, - :equalAverage => false, :priority => 2, :operator => :lessThan, :text => "", - :percent => false, :rank => 0, :stdDev => 1, :stopIfTrue => true, :timePeriod => :today, - :formula => "0.0" }) + :equalAverage => false, :priority => 2, :operator => :lessThan, :text => "", + :percent => false, :rank => 0, :stdDev => 1, :stopIfTrue => true, :timePeriod => :today, + :formula => "0.0" }) doc = Nokogiri::XML.parse(cf.to_xml_string) assert_equal(1, doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage=0][@bottom=0][@dxfId=0][@equalAverage=0][@priority=2][@operator='lessThan'][@text=''][@percent=0][@rank=0][@stdDev=1][@stopIfTrue=1][@timePeriod='today']").size) assert doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage=0][@bottom=0][@dxfId=0][@equalAverage=0][@priority=2][@operator='lessThan'][@text=''][@percent=0][@rank=0][@stdDev=1][@stopIfTrue=1][@timePeriod='today']//formula=0.0") diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 3dffee39..ff92b847 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -165,9 +165,9 @@ class TestDataValidation < Test::Unit::TestCase p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', - :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values between 5 and 10' }) + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', + :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', + :prompt => 'Only values between 5 and 10' }) doc = Nokogiri::XML.parse(@ws.to_xml_string) @@ -194,9 +194,9 @@ class TestDataValidation < Test::Unit::TestCase p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :list, :formula1 => 'A1:A5', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', - :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values from list', :hideDropDown => true }) + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', + :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', + :prompt => 'Only values from list', :hideDropDown => true }) doc = Nokogiri::XML.parse(@ws.to_xml_string) @@ -218,9 +218,9 @@ class TestDataValidation < Test::Unit::TestCase p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :custom, :formula1 => '=5/2', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values corresponding formula', - :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values corresponding formula' }) + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values corresponding formula', + :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', + :prompt => 'Only values corresponding formula' }) doc = Nokogiri::XML.parse(@ws.to_xml_string) @@ -241,13 +241,13 @@ class TestDataValidation < Test::Unit::TestCase p = Axlsx::Package.new @ws = p.workbook.add_worksheet :name => "data_validation" @ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', - :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values between 5 and 10' }) + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10', + :errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!', + :prompt => 'Only values between 5 and 10' }) @ws.add_data_validation("B1", { :type => :list, :formula1 => 'A1:A5', - :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', - :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', - :prompt => 'Only values from list', :hideDropDown => true }) + :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list', + :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!', + :prompt => 'Only values from list', :hideDropDown => true }) doc = Nokogiri::XML.parse(@ws.to_xml_string) diff --git a/test/workbook/worksheet/tc_sheet_view.rb b/test/workbook/worksheet/tc_sheet_view.rb index 03030d2c..0f0986cf 100644 --- a/test/workbook/worksheet/tc_sheet_view.rb +++ b/test/workbook/worksheet/tc_sheet_view.rb @@ -5,8 +5,8 @@ class TestSheetView < Test::Unit::TestCase def setup # inverse defaults for booleans @boolean_options = { :right_to_left => true, :show_formulas => true, :show_outline_symbols => true, - :show_white_space => true, :tab_selected => true, :default_grid_color => false, :show_grid_lines => false, - :show_row_col_headers => false, :show_ruler => false, :show_zeros => false, :window_protection => true } + :show_white_space => true, :tab_selected => true, :default_grid_color => false, :show_grid_lines => false, + :show_row_col_headers => false, :show_ruler => false, :show_zeros => false, :window_protection => true } @symbol_options = { :view => :page_break_preview } @nil_options = { :color_id => 2, :top_left_cell => 'A2' } @int_0 = { :zoom_scale_normal => 100, :zoom_scale_page_layout_view => 100, :zoom_scale_sheet_layout_view => 100, :workbook_view_id => 2 } diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb index b56ac560..3d71dc9b 100644 --- a/test/workbook/worksheet/tc_table_style_info.rb +++ b/test/workbook/worksheet/tc_table_style_info.rb @@ -9,10 +9,10 @@ class TestTableStyleInfo < Test::Unit::TestCase end @table = @ws.add_table(Axlsx::cell_range([@ws.rows.first.cells.first, @ws.rows.last.cells.last], false), :name => 'foo') @options = { :show_first_column => 1, - :show_last_column => 1, - :show_row_stripes => 1, - :show_column_stripes => 1, - :name => "TableStyleDark4" } + :show_last_column => 1, + :show_row_stripes => 1, + :show_column_stripes => 1, + :name => "TableStyleDark4" } end def test_initialize -- cgit v1.2.3 From c4bd23bdb6b20763027370f7db13cef1ed7d6e75 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Tue, 11 Apr 2023 15:04:00 +0200 Subject: Regenerate RuboCop config and todo - Remove timestamps and offense counts for a smaller todo and prevent conflicts - Keep config limited to `Layout` and `Style` scopes --- .rubocop.yml | 7 + .rubocop_todo.yml | 387 +----------------------------------------------------- 2 files changed, 9 insertions(+), 385 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 28352bd5..a8f660ca 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,7 @@ inherit_from: .rubocop_todo.yml AllCops: + DisabledByDefault: true NewCops: enable SuggestExtensions: false TargetRubyVersion: 2.3 @@ -9,8 +10,14 @@ AllCops: - 'examples/**/*' - 'vendor/bundle/**/*' +Layout: + Enabled: true + Layout/CommentIndentation: AllowForAlignment: true Layout/ExtraSpacing: AllowBeforeTrailingComments: true + +Style: + Enabled: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 192ea3ca..59777b4c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,35 +1,17 @@ # This configuration was generated by -# `rubocop --auto-gen-config` -# on 2023-04-10 10:12:38 UTC using RuboCop version 1.48.1. +# `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp` +# using RuboCop version 1.50.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. -# Include: **/*.gemspec -Gemspec/OrderedDependencies: - Exclude: - - 'axlsx.gemspec' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Severity, Include. -# Include: **/*.gemspec -Gemspec/RequireMFA: - Exclude: - - 'axlsx.gemspec' - -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_braces Layout/FirstHashElementIndentation: EnforcedStyle: consistent -# Offense count: 12 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # SupportedHashRocketStyles: key, separator, table @@ -40,293 +22,12 @@ Layout/HashAlignment: - 'lib/axlsx/workbook/worksheet/border_creator.rb' - 'test/tc_axlsx.rb' -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Layout/HeredocIndentation: Exclude: - 'lib/axlsx/drawing/vml_drawing.rb' - 'lib/axlsx/drawing/vml_shape.rb' -# Offense count: 2 -# Configuration parameters: AllowedMethods, AllowedPatterns. -Lint/AmbiguousBlockAssociation: - Exclude: - - 'test/workbook/worksheet/tc_worksheet.rb' - -# Offense count: 24 -# This cop supports safe autocorrection (--autocorrect). -Lint/AmbiguousOperatorPrecedence: - Exclude: - - 'lib/axlsx/drawing/area_series.rb' - - 'lib/axlsx/drawing/line_series.rb' - - 'lib/axlsx/drawing/pie_series.rb' - - 'lib/axlsx/workbook/worksheet/dimension.rb' - - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' - - 'lib/axlsx/workbook/worksheet/worksheet.rb' - - 'test/tc_axlsx.rb' - - 'test/workbook/worksheet/tc_cell.rb' - - 'test/workbook/worksheet/tc_date_time_converter.rb' - - 'test/workbook/worksheet/tc_worksheet.rb' - -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowSafeAssignment. -Lint/AssignmentInCondition: - Exclude: - - 'lib/axlsx/drawing/area_chart.rb' - - 'lib/axlsx/drawing/line_chart.rb' - - 'lib/axlsx/workbook/shared_strings_table.rb' - -# Offense count: 11 -# This cop supports unsafe autocorrection (--autocorrect-all). -Lint/BooleanSymbol: - Exclude: - - 'lib/axlsx/stylesheet/font.rb' - - 'lib/axlsx/util/validators.rb' - - 'lib/axlsx/workbook/worksheet/cell.rb' - - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - - 'test/util/tc_validators.rb' - - 'test/workbook/tc_workbook.rb' - -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -Lint/DisjunctiveAssignmentInConstructor: - Exclude: - - 'lib/axlsx/drawing/num_data_source.rb' - -# Offense count: 2 -# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. -Lint/DuplicateBranch: - Exclude: - - 'lib/axlsx/workbook/worksheet/cell.rb' - - 'lib/axlsx/workbook/worksheet/merged_cells.rb' - -# Offense count: 4 -# Configuration parameters: AllowComments, AllowEmptyLambdas. -Lint/EmptyBlock: - Exclude: - - 'test/stylesheet/tc_styles.rb' - -# Offense count: 1 -Lint/NonLocalExitFromIterator: - Exclude: - - 'lib/axlsx/util/validators.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowPercentLiteralArrayArgument. -Lint/RedundantSplatExpansion: - Exclude: - - 'test/drawing/tc_d_lbls.rb' - -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -Lint/RedundantStringCoercion: - Exclude: - - 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb' - - 'lib/axlsx/workbook/worksheet/cell.rb' - - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - - 'test/drawing/tc_axis.rb' - - 'test/stylesheet/tc_table_style_element.rb' - - 'test/workbook/worksheet/tc_comment.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Lint/ScriptPermission: - Exclude: - - 'test/benchmark.rb' - - 'test/profile.rb' - -# Offense count: 23 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: strict, consistent -Lint/SymbolConversion: - Exclude: - - 'test/doc_props/tc_app.rb' - -# Offense count: 15 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. -Lint/UnusedBlockArgument: - Exclude: - - 'lib/axlsx.rb' - - 'lib/axlsx/drawing/axes.rb' - - 'lib/axlsx/workbook/worksheet/pivot_table.rb' - - 'lib/axlsx/workbook/worksheet/sheet_view.rb' - - 'test/drawing/tc_bar_series.rb' - - 'test/stylesheet/tc_styles.rb' - - 'test/util/tc_validators.rb' - - 'test/workbook/worksheet/tc_data_validation.rb' - - 'test/workbook/worksheet/tc_sheet_protection.rb' - - 'test/workbook/worksheet/tc_sheet_view.rb' - - 'test/workbook/worksheet/tc_worksheet.rb' - -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. -Lint/UnusedMethodArgument: - Exclude: - - 'lib/axlsx/package.rb' - - 'lib/axlsx/util/serialized_attributes.rb' - - 'lib/axlsx/util/validators.rb' - -# Offense count: 2 -Lint/UselessAssignment: - Exclude: - - 'lib/axlsx/workbook/worksheet/header_footer.rb' - - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' - -# Offense count: 7 -# Configuration parameters: CheckForMethodsWithNoSideEffects. -Lint/Void: - Exclude: - - 'lib/axlsx/drawing/title.rb' - - 'lib/axlsx/util/simple_typed_list.rb' - - 'lib/axlsx/util/storage.rb' - - 'lib/axlsx/workbook/worksheet/data_bar.rb' - - 'lib/axlsx/workbook/worksheet/pivot_table.rb' - -# Offense count: 163 -# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. -Metrics/AbcSize: - Max: 227 - -# Offense count: 2 -# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. -# AllowedMethods: refine -Metrics/BlockLength: - Max: 54 - -# Offense count: 28 -# Configuration parameters: CountComments, CountAsOne. -Metrics/ClassLength: - Max: 710 - -# Offense count: 21 -# Configuration parameters: AllowedMethods, AllowedPatterns. -Metrics/CyclomaticComplexity: - Max: 25 - -# Offense count: 141 -# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. -Metrics/MethodLength: - Max: 128 - -# Offense count: 2 -# Configuration parameters: CountComments, CountAsOne. -Metrics/ModuleLength: - Max: 115 - -# Offense count: 17 -# Configuration parameters: AllowedMethods, AllowedPatterns. -Metrics/PerceivedComplexity: - Max: 29 - -# Offense count: 2 -Naming/AccessorMethodName: - Exclude: - - 'lib/axlsx/drawing/axes.rb' - - 'lib/axlsx/workbook/worksheet/data_validation.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Naming/BinaryOperatorParameterName: - Exclude: - - 'lib/axlsx/util/simple_typed_list.rb' - -# Offense count: 7 -# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. -# CheckDefinitionPathHierarchyRoots: lib, spec, test, src -# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS -Naming/FileName: - Exclude: - - 'lib/axlsx/drawing/bar_3D_chart.rb' - - 'lib/axlsx/drawing/line_3D_chart.rb' - - 'lib/axlsx/drawing/pie_3D_chart.rb' - - 'lib/axlsx/drawing/view_3D.rb' - - 'test/drawing/tc_bar_3D_chart.rb' - - 'test/drawing/tc_pie_3D_chart.rb' - - 'test/drawing/tc_view_3D.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: lowercase, uppercase -Naming/HeredocDelimiterCase: - Exclude: - - 'axlsx.gemspec' - -# Offense count: 1 -# Configuration parameters: ForbiddenDelimiters. -# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$)) -Naming/HeredocDelimiterNaming: - Exclude: - - 'axlsx.gemspec' - -# Offense count: 1 -# Configuration parameters: EnforcedStyleForLeadingUnderscores. -# SupportedStylesForLeadingUnderscores: disallowed, required, optional -Naming/MemoizedInstanceVariableName: - Exclude: - - 'lib/axlsx/workbook/worksheet/sheet_pr.rb' - -# Offense count: 201 -# Configuration parameters: EnforcedStyle, AllowedPatterns. -# SupportedStyles: snake_case, camelCase -Naming/MethodName: - Enabled: false - -# Offense count: 422 -# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to -Naming/MethodParameterName: - Enabled: false - -# Offense count: 5 -# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. -# NamePrefix: is_, has_, have_ -# ForbiddenPrefixes: is_, has_, have_ -# AllowedMethods: is_a? -# MethodDefinitionMacros: define_method, define_singleton_method -Naming/PredicateName: - Exclude: - - 'spec/**/*' - - 'lib/axlsx/workbook/worksheet/cell.rb' - - 'lib/axlsx/workbook/worksheet/worksheet_comments.rb' - - 'lib/axlsx/workbook/worksheet/worksheet_drawing.rb' - -# Offense count: 96 -# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns. -# SupportedStyles: snake_case, camelCase -Naming/VariableName: - Enabled: false - -# Offense count: 34 -# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. -# SupportedStyles: snake_case, normalcase, non_integer -# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 -Naming/VariableNumber: - Exclude: - - 'lib/axlsx/util/validators.rb' - - 'lib/axlsx/workbook/worksheet/cell.rb' - - 'lib/axlsx/workbook/worksheet/cell_serializer.rb' - - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' - - 'test/rels/tc_relationship.rb' - - 'test/rels/tc_relationships.rb' - - 'test/tc_package.rb' - - 'test/workbook/worksheet/tc_cell.rb' - - 'test/workbook/worksheet/tc_date_time_converter.rb' - - 'test/workbook/worksheet/tc_sheet_view.rb' - - 'test/workbook/worksheet/tc_worksheet.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Security/IoMethods: - Exclude: - - 'lib/axlsx/package.rb' - -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: separated, grouped @@ -334,14 +35,12 @@ Style/AccessorGrouping: Exclude: - 'lib/axlsx/workbook/worksheet/worksheet_drawing.rb' -# Offense count: 149 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: prefer_alias, prefer_alias_method Style/Alias: Enabled: false -# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, conditionals @@ -349,7 +48,6 @@ Style/AndOr: Exclude: - 'lib/axlsx/workbook/worksheet/data_validation.rb' -# Offense count: 5 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces @@ -360,20 +58,17 @@ Style/BlockDelimiters: Exclude: - 'test/benchmark.rb' -# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: MinBranchesCount. Style/CaseLikeIf: Exclude: - 'lib/axlsx/workbook/worksheet/merged_cells.rb' -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/CharacterLiteral: Exclude: - 'lib/axlsx/workbook/worksheet/cell.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: is_a?, kind_of? @@ -381,7 +76,6 @@ Style/ClassCheck: Exclude: - 'lib/axlsx/drawing/axes.rb' -# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowedMethods, AllowedPatterns. # AllowedMethods: ==, equal?, eql? @@ -391,19 +85,16 @@ Style/ClassEqualityComparison: - 'lib/axlsx/workbook/worksheet/selection.rb' - 'lib/axlsx/workbook/worksheet/sheet_view.rb' -# Offense count: 6 Style/ClassVars: Exclude: - 'lib/axlsx.rb' - 'lib/axlsx/workbook/workbook.rb' - 'lib/axlsx/workbook/worksheet/dimension.rb' -# Offense count: 267 # This cop supports safe autocorrection (--autocorrect). Style/ColonMethodCall: Enabled: false -# Offense count: 9 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Keywords, RequireColon. # Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE @@ -417,13 +108,11 @@ Style/CommentAnnotation: - 'test/workbook/worksheet/tc_col.rb' - 'test/workbook/worksheet/tc_comments.rb' -# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/ConcatArrayLiterals: Exclude: - 'lib/axlsx/workbook/worksheet/icon_set.rb' -# Offense count: 5 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. # SupportedStyles: assign_to_condition, assign_inside_condition @@ -435,18 +124,15 @@ Style/ConditionalAssignment: - 'lib/axlsx/workbook/worksheet/data_bar.rb' - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/DefWithParentheses: Exclude: - 'lib/axlsx/stylesheet/styles.rb' -# Offense count: 1 Style/DocumentDynamicEvalDefinition: Exclude: - 'lib/axlsx/util/simple_typed_list.rb' -# Offense count: 10 # Configuration parameters: AllowedConstants. Style/Documentation: Exclude: @@ -463,40 +149,34 @@ Style/Documentation: - 'lib/axlsx/workbook/worksheet/row_breaks.rb' - 'lib/axlsx/workbook/worksheet/sheet_format_pr.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/EachForSimpleLoop: Exclude: - 'test/workbook/worksheet/tc_rich_text.rb' -# Offense count: 44 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: compact, expanded Style/EmptyMethod: Enabled: false -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/EvalWithLocation: Exclude: - 'lib/axlsx/util/simple_typed_list.rb' -# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). Style/ExpandPathArguments: Exclude: - 'axlsx.gemspec' - 'test/tc_package.rb' -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/FileWrite: Exclude: - 'lib/axlsx/util/zip_command.rb' - 'test/benchmark.rb' -# Offense count: 12 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: format, sprintf, percent @@ -510,27 +190,23 @@ Style/FormatString: - 'lib/axlsx/workbook/worksheet/dimension.rb' - 'lib/axlsx/workbook/worksheet/worksheet.rb' -# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns. # SupportedStyles: annotated, template, unannotated Style/FormatStringToken: EnforcedStyle: unannotated -# Offense count: 267 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Enabled: false -# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/GlobalStdStream: Exclude: - 'test/profile.rb' -# Offense count: 11 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. Style/GuardClause: @@ -546,7 +222,6 @@ Style/GuardClause: - 'lib/axlsx/workbook/worksheet/table.rb' - 'lib/axlsx/workbook/worksheet/worksheet.rb' -# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowSplatArgument. Style/HashConversion: @@ -555,7 +230,6 @@ Style/HashConversion: - 'lib/axlsx/workbook/worksheet/cell_serializer.rb' - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' -# Offense count: 6 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowedReceivers. # AllowedReceivers: Thread.current @@ -565,7 +239,6 @@ Style/HashEachMethods: - 'test/workbook/worksheet/tc_table_style_info.rb' - 'test/workbook/worksheet/tc_worksheet.rb' -# Offense count: 1230 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys @@ -573,19 +246,16 @@ Style/HashEachMethods: Style/HashSyntax: Enabled: false -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowIfModifier. Style/IfInsideElse: Exclude: - 'lib/axlsx/stylesheet/styles.rb' -# Offense count: 37 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Enabled: false -# Offense count: 9 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: line_count_dependent, lambda, literal @@ -598,13 +268,11 @@ Style/Lambda: - 'lib/axlsx/stylesheet/styles.rb' - 'lib/axlsx/util/validators.rb' -# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). Style/LineEndConcatenation: Exclude: - 'lib/axlsx/package.rb' -# Offense count: 6 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowedMethods, AllowedPatterns. Style/MethodCallWithoutArgsParentheses: @@ -616,7 +284,6 @@ Style/MethodCallWithoutArgsParentheses: - 'test/workbook/worksheet/tc_comments.rb' - 'test/workbook/worksheet/tc_rich_text.rb' -# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline @@ -626,7 +293,6 @@ Style/MethodDefParentheses: - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - 'lib/axlsx/workbook/worksheet/worksheet.rb' -# Offense count: 6 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMethodComparison. Style/MultipleComparison: @@ -637,7 +303,6 @@ Style/MultipleComparison: - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - 'test/workbook/tc_workbook_view.rb' -# Offense count: 17 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: literals, strict @@ -659,7 +324,6 @@ Style/MutableConstant: - 'lib/axlsx/workbook/worksheet/data_bar.rb' - 'lib/axlsx/workbook/worksheet/sheet_view.rb' -# Offense count: 12 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: both, prefix, postfix @@ -674,7 +338,6 @@ Style/NegatedIf: - 'lib/axlsx/workbook/worksheet/border_creator.rb' - 'lib/axlsx/workbook/worksheet/worksheet.rb' -# Offense count: 9 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowedMethods. # AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with @@ -683,7 +346,6 @@ Style/NestedParenthesizedCalls: - 'test/stylesheet/tc_styles.rb' - 'test/workbook/worksheet/tc_worksheet.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, MinBodyLength. # SupportedStyles: skip_modifier_ifs, always @@ -691,7 +353,6 @@ Style/Next: Exclude: - 'lib/axlsx/stylesheet/styles.rb' -# Offense count: 17 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: predicate, comparison @@ -707,7 +368,6 @@ Style/NilComparison: - 'test/workbook/worksheet/tc_page_setup.rb' - 'test/workbook/worksheet/tc_worksheet.rb' -# Offense count: 5 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IncludeSemanticChanges. Style/NonNilCheck: @@ -717,7 +377,6 @@ Style/NonNilCheck: - 'lib/axlsx/workbook/worksheet/col.rb' - 'lib/axlsx/workbook/worksheet/page_setup.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedOctalStyle. # SupportedOctalStyles: zero_with_o, zero_only @@ -725,13 +384,11 @@ Style/NumericLiteralPrefix: Exclude: - 'test/doc_props/tc_core.rb' -# Offense count: 46 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns. Style/NumericLiterals: MinDigits: 11 -# Offense count: 32 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. # SupportedStyles: predicate, comparison @@ -754,13 +411,11 @@ Style/NumericPredicate: - 'test/tc_package.rb' - 'test/util/tc_simple_typed_list.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/OperatorMethodCall: Exclude: - 'lib/axlsx/drawing/vml_shape.rb' -# Offense count: 11 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: @@ -773,7 +428,6 @@ Style/OptionalBooleanParameter: - 'lib/axlsx/workbook/worksheet/col.rb' - 'lib/axlsx/workbook/worksheet/worksheet.rb' -# Offense count: 12 # This cop supports safe autocorrection (--autocorrect). Style/ParallelAssignment: Exclude: @@ -790,7 +444,6 @@ Style/ParallelAssignment: - 'lib/axlsx/workbook/worksheet/row.rb' - 'test/rels/tc_relationships.rb' -# Offense count: 8 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions. Style/ParenthesesAroundCondition: @@ -801,7 +454,6 @@ Style/ParenthesesAroundCondition: - 'lib/axlsx/workbook/worksheet/data_validation.rb' - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' -# Offense count: 17 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: PreferredDelimiters. Style/PercentLiteralDelimiters: @@ -820,14 +472,12 @@ Style/PercentLiteralDelimiters: - 'test/workbook/worksheet/tc_pivot_table.rb' - 'test/workbook/worksheet/tc_table_style_info.rb' -# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). Style/PerlBackrefs: Exclude: - 'lib/axlsx.rb' - 'test/workbook/worksheet/tc_sheet_protection.rb' -# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: short, verbose @@ -836,7 +486,6 @@ Style/PreferredHashMethods: - 'lib/axlsx.rb' - 'test/workbook/tc_shared_strings_table.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: same_as_string_literals, single_quotes, double_quotes @@ -844,7 +493,6 @@ Style/QuotedSymbols: Exclude: - 'lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb' -# Offense count: 5 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, AllowedCompactTypes. # SupportedStyles: compact, exploded @@ -855,25 +503,21 @@ Style/RaiseArgs: - 'lib/axlsx/util/zip_command.rb' - 'lib/axlsx/workbook/worksheet/border_creator.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/RandomWithOffset: Exclude: - 'lib/axlsx/drawing/vml_shape.rb' -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/RedundantCondition: Exclude: - 'lib/axlsx/drawing/area_series.rb' - 'lib/axlsx/drawing/line_series.rb' -# Offense count: 238 # This cop supports safe autocorrection (--autocorrect). Style/RedundantFileExtensionInRequire: Enabled: false -# Offense count: 14 # This cop supports unsafe autocorrection (--autocorrect-all). Style/RedundantInterpolation: Exclude: @@ -888,7 +532,6 @@ Style/RedundantInterpolation: - 'lib/axlsx/workbook/worksheet/worksheet.rb' - 'test/content_type/tc_content_type.rb' -# Offense count: 13 # This cop supports safe autocorrection (--autocorrect). Style/RedundantParentheses: Exclude: @@ -903,7 +546,6 @@ Style/RedundantParentheses: - 'lib/axlsx/workbook/worksheet/worksheet.rb' - 'test/stylesheet/tc_styles.rb' -# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). Style/RedundantRegexpEscape: Exclude: @@ -911,7 +553,6 @@ Style/RedundantRegexpEscape: - 'lib/axlsx/workbook/worksheet/pivot_table.rb' - 'lib/axlsx/workbook/worksheet/table.rb' -# Offense count: 7 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleReturnValues. Style/RedundantReturn: @@ -921,12 +562,10 @@ Style/RedundantReturn: - 'lib/axlsx/stylesheet/styles.rb' - 'lib/axlsx/workbook/worksheet/worksheet.rb' -# Offense count: 37 # This cop supports safe autocorrection (--autocorrect). Style/RedundantSelf: Enabled: false -# Offense count: 18 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, AllowInnerSlashes. # SupportedStyles: slashes, percent_r, mixed @@ -935,7 +574,6 @@ Style/RegexpLiteral: - 'lib/axlsx/workbook/worksheet/cell.rb' - 'test/tc_package.rb' -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, explicit @@ -944,39 +582,33 @@ Style/RescueStandardError: - 'lib/axlsx.rb' - 'test/workbook/worksheet/tc_date_time_converter.rb' -# Offense count: 28 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. # AllowedMethods: present?, blank?, presence, try, try! Style/SafeNavigation: Enabled: false -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/SelfAssignment: Exclude: - 'lib/axlsx/stylesheet/color.rb' -# Offense count: 367 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowAsExpressionSeparator. Style/Semicolon: Enabled: false -# Offense count: 244 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowIfMethodIsEmpty. Style/SingleLineMethods: Enabled: false -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowModifier. Style/SoleNestedConditional: Exclude: - 'lib/axlsx/util/validators.rb' -# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: RequireEnglish, EnforcedStyle. # SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names @@ -985,26 +617,22 @@ Style/SpecialGlobalVars: - 'test/benchmark.rb' - 'test/profile.rb' -# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/StringChars: Exclude: - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' -# Offense count: 28 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. Style/StringConcatenation: Enabled: false -# Offense count: 1571 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes Style/StringLiterals: Enabled: false -# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: single_quotes, double_quotes @@ -1012,20 +640,17 @@ Style/StringLiteralsInInterpolation: Exclude: - 'test/content_type/tc_content_type.rb' -# Offense count: 97 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MinSize. # SupportedStyles: percent, brackets Style/SymbolArray: EnforcedStyle: brackets -# Offense count: 23 # This cop supports safe autocorrection (--autocorrect). Style/SymbolLiteral: Exclude: - 'test/doc_props/tc_app.rb' -# Offense count: 14 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. # AllowedMethods: define_method @@ -1044,7 +669,6 @@ Style/SymbolProc: - 'test/workbook/tc_shared_strings_table.rb' - 'test/workbook/worksheet/tc_worksheet.rb' -# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, AllowSafeAssignment. # SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex @@ -1055,7 +679,6 @@ Style/TernaryParentheses: - 'lib/axlsx/drawing/scatter_series.rb' - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' -# Offense count: 11 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods. # AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym @@ -1072,26 +695,22 @@ Style/TrivialAccessors: - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - 'lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/WhileUntilDo: Exclude: - 'lib/axlsx.rb' -# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/WhileUntilModifier: Exclude: - 'lib/axlsx/workbook/worksheet/color_scale.rb' -# Offense count: 41 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, MinSize, WordRegex. # SupportedStyles: percent, brackets Style/WordArray: Enabled: false -# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: forbid_for_all_comparison_operators, forbid_for_equality_operators_only, require_for_all_comparison_operators, require_for_equality_operators_only @@ -1099,7 +718,6 @@ Style/YodaCondition: Exclude: - 'lib/axlsx/workbook/worksheet/col.rb' -# Offense count: 12 # This cop supports unsafe autocorrection (--autocorrect-all). Style/ZeroLengthPredicate: Exclude: @@ -1112,7 +730,6 @@ Style/ZeroLengthPredicate: - 'test/tc_package.rb' - 'test/util/tc_simple_typed_list.rb' -# Offense count: 363 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https -- cgit v1.2.3