summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-05-20 17:19:24 +0200
committerGeremia Taglialatela <[email protected]>2023-05-20 17:19:24 +0200
commit90db2eecf0271b9597891dc3dd96b2b0b26ec5d3 (patch)
treef6528b095a3ff407e4afab262c65b5ef0ee18571
parent6a4b82def2e94b4811c38c37e606d426710d1e6c (diff)
downloadcaxlsx-90db2eecf0271b9597891dc3dd96b2b0b26ec5d3.tar.gz
caxlsx-90db2eecf0271b9597891dc3dd96b2b0b26ec5d3.zip
Fix Lint/Void offenses
Setter methods return the assigned value. Given: ```rb class MyClass def foo=(v) v = 10 42 end end ``` `my_object.foo = 5` will always return `5` This methods removes code that does not have effect
-rw-r--r--.rubocop_todo.yml8
-rw-r--r--lib/axlsx/drawing/title.rb3
-rw-r--r--lib/axlsx/util/storage.rb1
-rw-r--r--lib/axlsx/workbook/worksheet/data_bar.rb1
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table.rb1
5 files changed, 0 insertions, 14 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 19c4b3f5..3fc85dec 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -82,14 +82,6 @@ Lint/UselessAssignment:
- 'lib/axlsx/workbook/worksheet/header_footer.rb'
- 'lib/axlsx/workbook/worksheet/sheet_protection.rb'
-# Configuration parameters: CheckForMethodsWithNoSideEffects.
-Lint/Void:
- Exclude:
- - 'lib/axlsx/drawing/title.rb'
- - 'lib/axlsx/util/storage.rb'
- - 'lib/axlsx/workbook/worksheet/data_bar.rb'
- - 'lib/axlsx/workbook/worksheet/pivot_table.rb'
-
# Configuration parameters: MinSize.
Performance/CollectionLiteralInLoop:
Exclude:
diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb
index c3ca9632..2e4037fb 100644
--- a/lib/axlsx/drawing/title.rb
+++ b/lib/axlsx/drawing/title.rb
@@ -32,7 +32,6 @@ module Axlsx
DataTypeValidator.validate 'Title.text', String, v
@text = v
@cell = nil
- v
end
# @see text_size
@@ -40,7 +39,6 @@ module Axlsx
DataTypeValidator.validate 'Title.text_size', String, v
@text_size = v
@cell = nil
- v
end
# @see cell
@@ -48,7 +46,6 @@ module Axlsx
DataTypeValidator.validate 'Title.text', Cell, v
@cell = v
@text = v.value.to_s
- v
end
# Check if the title is empty.
diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb
index 2ce0d8f5..1e12b2d4 100644
--- a/lib/axlsx/util/storage.rb
+++ b/lib/axlsx/util/storage.rb
@@ -63,7 +63,6 @@ module Axlsx
def name=(v)
@name = v.bytes.to_a << 0
@name_size = @name.size * 2
- @name
end
# The size of the stream
diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb
index 108a5c16..482bd029 100644
--- a/lib/axlsx/workbook/worksheet/data_bar.rb
+++ b/lib/axlsx/workbook/worksheet/data_bar.rb
@@ -101,7 +101,6 @@ module Axlsx
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
diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb
index 27065e4b..44a50f19 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table.rb
@@ -135,7 +135,6 @@ module Axlsx
end
@data << data_field
end
- @data
end
# The pages