summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-10 12:13:09 +0200
committerGeremia Taglialatela <[email protected]>2023-04-10 12:13:09 +0200
commita7532517c74ba3589279aa92042ca9da2336a5ea (patch)
tree06962b0ba4e49e2182b43766e1859d14280f0cc9
parent84a2b255d6fd780f526ac3d9bf99a40f08792986 (diff)
downloadcaxlsx-a7532517c74ba3589279aa92042ca9da2336a5ea.tar.gz
caxlsx-a7532517c74ba3589279aa92042ca9da2336a5ea.zip
Fix some Layout/HashAlignment offenses
Some offenses have been selected and fixed automatically
-rw-r--r--.rubocop_todo.yml20
-rw-r--r--test/stylesheet/tc_cell_alignment.rb4
-rw-r--r--test/workbook/tc_workbook_view.rb4
-rw-r--r--test/workbook/worksheet/tc_conditional_formatting.rb26
-rw-r--r--test/workbook/worksheet/tc_data_validation.rb30
-rw-r--r--test/workbook/worksheet/tc_sheet_view.rb4
-rw-r--r--test/workbook/worksheet/tc_table_style_info.rb8
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