diff options
| author | Geremia Taglialatela <[email protected]> | 2023-05-24 17:01:23 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-05-24 17:01:23 +0200 |
| commit | 93c434ef56187225567719689ce860f922a825a6 (patch) | |
| tree | fcc711344ba40340d80354e1c4fa55f5e0a481c2 | |
| parent | 14b7da239879d5299775c48666b43f3016add8ec (diff) | |
| download | caxlsx-93c434ef56187225567719689ce860f922a825a6.tar.gz caxlsx-93c434ef56187225567719689ce860f922a825a6.zip | |
Fix Style/IfInsideElse offense
| -rw-r--r-- | .rubocop_todo.yml | 6 | ||||
| -rw-r--r-- | lib/axlsx/stylesheet/styles.rb | 24 |
2 files changed, 11 insertions, 19 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a0260f2e..66d56f6d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -190,12 +190,6 @@ Style/HashEachMethods: - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowIfModifier. -Style/IfInsideElse: - Exclude: - - 'lib/axlsx/stylesheet/styles.rb' - -# This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Enabled: false diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index 625f6a02..a3428e27 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -390,24 +390,22 @@ module Axlsx if options[:border].nil? base_border_opts = {} - else - if options[:border].is_a?(Array) - borders_array += options[:border] + elsif options[:border].is_a?(Array) + borders_array += options[:border] - base_border_opts = {} + base_border_opts = {} - options[:border].each do |b_opts| - if b_opts[:edges].nil? - base_border_opts = base_border_opts.merge(b_opts) - end + options[:border].each do |b_opts| + if b_opts[:edges].nil? + base_border_opts = base_border_opts.merge(b_opts) end - else - borders_array << options[:border] + end + else + borders_array << options[:border] - base_border_opts = options[:border] + base_border_opts = options[:border] - validate_border_hash.call(base_border_opts) - end + validate_border_hash.call(base_border_opts) end Border::EDGES.each do |edge| |
