diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 7b3281e..6161bd7 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - gemfile: ['rails-7.0.x', 'rails-6.1.x'] + gemfile: ['rails-7.1.x', 'rails-7.0.x', 'rails-6.1.x'] ruby: [3.2, 3.1, '3.0'] include: - gemfile: rails-7.0.x diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 225c6a2..6127c6a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,19 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config --exclude-limit 180` -# on 2024-01-04 23:33:26 UTC using RuboCop version 1.59.0. +# on 2024-01-16 23:33:30 UTC using RuboCop version 1.60.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: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. -# Include: **/*.gemfile, **/Gemfile, **/gems.rb -Bundler/OrderedGems: - Exclude: - - 'Gemfile' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Severity, Include. @@ -80,14 +72,6 @@ Layout/EmptyLines: Exclude: - 'lib/excel_templating/excel_abstraction/work_book.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: around, only_before -Layout/EmptyLinesAroundAccessModifier: - Exclude: - - 'lib/excel_templating/render_helper.rb' - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowAliasSyntax, AllowedMethods. @@ -127,13 +111,6 @@ Layout/IndentationWidth: Exclude: - 'lib/excel_templating/excel_abstraction/work_book.rb' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. -Layout/LeadingCommentSpace: - Exclude: - - 'lib/excel_templating/renderer.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. @@ -142,12 +119,6 @@ Layout/MultilineOperationIndentation: Exclude: - 'lib/excel_templating/document/data_source_registry/registry_renderer.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceAfterComma: - Exclude: - - 'spec/cell_validation_spec.rb' - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. @@ -320,6 +291,16 @@ Style/Alias: - 'lib/excel_templating/excel_abstraction/cell_range.rb' - 'lib/excel_templating/excel_abstraction/row.rb' +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. +# RedundantRestArgumentNames: args, arguments +# RedundantKeywordRestArgumentNames: kwargs, options, opts +# RedundantBlockArgumentNames: blk, block, proc +Style/ArgumentsForwarding: + Exclude: + - 'lib/excel_templating/document.rb' + # Offense count: 7 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. diff --git a/Gemfile b/Gemfile index 40e77d8..fa75df1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,3 @@ source 'https://rubygems.org' gemspec - -group :development do - gem 'kramdown' - gem 'rubocop' - gem 'byebug' - gem 'gemfury' -end diff --git a/gemfiles/Gemfile.rails-7.0.x b/gemfiles/Gemfile.rails-7.0.x index c92c679..6198256 100644 --- a/gemfiles/Gemfile.rails-7.0.x +++ b/gemfiles/Gemfile.rails-7.0.x @@ -3,5 +3,4 @@ source 'https://rubygems.org' gemspec path: '../' gem 'activerecord', '~> 7.0.0' -gem 'writeexcel', github: 'mathieujobin/writeexcel', branch: 'ruby3.3-rebased' diff --git a/gemfiles/Gemfile.rails-7.1.x b/gemfiles/Gemfile.rails-7.1.x new file mode 100644 index 0000000..7723097 --- /dev/null +++ b/gemfiles/Gemfile.rails-7.1.x @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gemspec path: '../' + +gem 'activerecord', '~> 7.1.2' + diff --git a/lib/excel_templating/render_helper.rb b/lib/excel_templating/render_helper.rb index 0b63a60..87a0f8c 100644 --- a/lib/excel_templating/render_helper.rb +++ b/lib/excel_templating/render_helper.rb @@ -6,6 +6,7 @@ def letter_for(one_based_index) end private + def letters @row_letters ||= ('A' .. 'ZZ').to_a end diff --git a/lib/excel_templating/renderer.rb b/lib/excel_templating/renderer.rb index 4d3b87d..5f5d54d 100644 --- a/lib/excel_templating/renderer.rb +++ b/lib/excel_templating/renderer.rb @@ -227,8 +227,8 @@ def whole_cell_template?(template) def add_validation(sheet, row_number, column_number) raise ArgumentError, "No :data_sources defined for validation!" unless data_source_registry source = sheet.validation_source_name(row_number, column_number) - #Use current_row and current_col here because row_number and column_number refer to the template - #sheet and we want to write a reference to the cell we just wrote + # Use current_row and current_col here because row_number and column_number refer to the template + # sheet and we want to write a reference to the cell we just wrote active_sheet.data_validation absolute_reference(current_row + 1, current_col), registry_renderer.absolute_reference_for(source) end diff --git a/spec/cell_validation_spec.rb b/spec/cell_validation_spec.rb index 010de88..4b199e0 100644 --- a/spec/cell_validation_spec.rb +++ b/spec/cell_validation_spec.rb @@ -63,7 +63,7 @@ class SimpleFromDataValidatedDocument < ExcelTemplating::Document { all_sheets: { - valid_foos: ["foo","bar"], + valid_foos: ["foo", "bar"], valid_value: "foo", } }