summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZsolt Kozaroczy <[email protected]>2023-05-24 09:21:18 +0200
committerGitHub <[email protected]>2023-05-24 09:21:18 +0200
commit2b8ca519f6f2b622a721ccaad38da93e7daa4c61 (patch)
treecbb939ec0f14a0d596a591ff1307011999af1522
parente88e281f10e60fc548a2eb6001618a803d669528 (diff)
parent0f6062ef7cafb53396256c7b5b9cf5e715693637 (diff)
downloadcaxlsx-2b8ca519f6f2b622a721ccaad38da93e7daa4c61.tar.gz
caxlsx-2b8ca519f6f2b622a721ccaad38da93e7daa4c61.zip
Merge pull request #250 from tagliala/chore/fix-style-non-nil-check-offenses
Fix Style/NonNilCheck offenses
-rw-r--r--.rubocop_todo.yml8
-rw-r--r--lib/axlsx/drawing/d_lbls.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/col.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/page_setup.rb4
4 files changed, 4 insertions, 12 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index c1d2a7d8..2b553a78 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -273,14 +273,6 @@ Style/Next:
Exclude:
- 'lib/axlsx/stylesheet/styles.rb'
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: IncludeSemanticChanges.
-Style/NonNilCheck:
- Exclude:
- - 'lib/axlsx/drawing/d_lbls.rb'
- - 'lib/axlsx/workbook/worksheet/col.rb'
- - 'lib/axlsx/workbook/worksheet/page_setup.rb'
-
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb
index 8965599c..7e3936cc 100644
--- a/lib/axlsx/drawing/d_lbls.rb
+++ b/lib/axlsx/drawing/d_lbls.rb
@@ -76,7 +76,7 @@ module Axlsx
str << '<c:dLbls>'
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.key?(key) && instance_vals[key] != nil
+ next unless instance_vals.key?(key) && !instance_vals[key].nil?
str << "<c:#{Axlsx::camel(key, false)} val='#{instance_vals[key]}' />"
end
diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb
index 539a6007..ff942d32 100644
--- a/lib/axlsx/workbook/worksheet/col.rb
+++ b/lib/axlsx/workbook/worksheet/col.rb
@@ -114,7 +114,7 @@ module Axlsx
# current @width value.
# TODO!!!
# Axlsx.validate_unsigned_numeric(v) unless v == nil
- @custom_width = @best_fit = 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 0bd0cdb8..6fc8ccba 100644
--- a/lib/axlsx/workbook/worksheet/page_setup.rb
+++ b/lib/axlsx/workbook/worksheet/page_setup.rb
@@ -225,8 +225,8 @@ module Axlsx
# 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]
def fit_to_page?
- # is there some better what to express this?
- (fit_to_width != nil || fit_to_height != nil)
+ # is there some better way to express this?
+ (!fit_to_width.nil? || !fit_to_height.nil?)
end
# Serializes the page settings element.