From 114862f21e564cded354de092f20438db318f761 Mon Sep 17 00:00:00 2001 From: Jean-Francis Bastien Date: Tue, 19 Dec 2023 08:04:05 -0500 Subject: [PATCH] Update rubocop dependencies (#75) --- .github/workflows/build.yml | 2 +- CHANGELOG.md | 1 + Gemfile.lock | 42 +++++++++++++------- lib/rubocop/cop/rails/enum_starting_value.rb | 2 +- lib/rubocop/cop/rspec/aggregate_examples.rb | 2 +- rubocop-petal.gemspec | 11 ++--- 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b58e409..cc7e6ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6 + ruby-version: 2.7 bundler-cache: true - name: Default task, RSpec and Rubocop run: bundle exec rake diff --git a/CHANGELOG.md b/CHANGELOG.md index a380845..955f483 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ # main +* Update rubocop dependencies and minimum Ruby version. (Fix [#68](https://github.com/petalmd/rubocop-petal/issues/68)). ([#75](https://github.com/petalmd/rubocop-petal/pull/75)) * Enabled `RSpec/MultipleExpectations`. ([#73](https://github.com/petalmd/rubocop-petal/pull/73)) * Added new cops from test-prod RSpec/AggregateExamples (Fix [#59](https://github.com/petalmd/rubocop-petal/issues/59)). ([#72](https://github.com/petalmd/rubocop-petal/pull/72)) diff --git a/Gemfile.lock b/Gemfile.lock index 1d4d170..1bb7255 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,10 +2,11 @@ PATH remote: . specs: rubocop-petal (1.2.0) - rubocop (~> 1.50) - rubocop-performance (~> 1.17) - rubocop-rails (~> 2.19) - rubocop-rspec (~> 2.17) + rubocop (~> 1.59) + rubocop-factory_bot (~> 2.24) + rubocop-performance (~> 1.20) + rubocop-rails (~> 2.23) + rubocop-rspec (~> 2.25) GEM remote: https://rubygems.org/ @@ -21,10 +22,13 @@ GEM i18n (1.8.11) concurrent-ruby (~> 1.0) json (2.6.3) + language_server-protocol (3.17.0.3) minitest (5.15.0) parallel (1.21.0) - parser (3.2.2.1) + parser (3.2.2.4) ast (~> 2.4.1) + racc + racc (1.7.3) rack (3.0.7) rainbow (3.0.0) rake (13.0.6) @@ -43,27 +47,35 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) rspec-support (3.10.3) - rubocop (1.50.2) + rubocop (1.59.0) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.1) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-performance (1.17.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.19.1) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.24.0) + rubocop (~> 1.33) + rubocop-performance (1.20.0) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.23.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.17.1) - rubocop (~> 1.33) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rspec (2.25.0) + rubocop (~> 1.40) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) ruby-progressbar (1.11.0) thread_safe (0.3.6) tzinfo (1.2.9) diff --git a/lib/rubocop/cop/rails/enum_starting_value.rb b/lib/rubocop/cop/rails/enum_starting_value.rb index 19dc4e6..d4f1b07 100644 --- a/lib/rubocop/cop/rails/enum_starting_value.rb +++ b/lib/rubocop/cop/rails/enum_starting_value.rb @@ -31,7 +31,7 @@ def on_send(node) end def start_with_zero?(node) - return unless node.type == :hash + return false unless node.type == :hash node.children.any? do |child| value = child.value diff --git a/lib/rubocop/cop/rspec/aggregate_examples.rb b/lib/rubocop/cop/rspec/aggregate_examples.rb index 3685354..c8f5836 100644 --- a/lib/rubocop/cop/rspec/aggregate_examples.rb +++ b/lib/rubocop/cop/rspec/aggregate_examples.rb @@ -122,7 +122,7 @@ class AggregateExamples < ::RuboCop::Cop::Cop def on_block(node) example_group_with_several_examples(node) do |all_examples| - example_clusters(all_examples).each do |_, examples| + example_clusters(all_examples).each_value do |examples| examples[1..].each do |example| add_offense(example, location: :expression, diff --git a/rubocop-petal.gemspec b/rubocop-petal.gemspec index 691c85e..8c1ad4b 100644 --- a/rubocop-petal.gemspec +++ b/rubocop-petal.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.summary = 'Petal custom cops' spec.homepage = 'https://github.com/petalmd/rubocop-petal' spec.license = 'MIT' - spec.required_ruby_version = Gem::Requirement.new('>= 2.6') + spec.required_ruby_version = Gem::Requirement.new('>= 2.7') spec.files = Dir['LICENSE.txt', 'README.md', 'config/**/*', 'lib/**/*'] spec.extra_rdoc_files = %w[LICENSE.txt README.md] @@ -25,8 +25,9 @@ Gem::Specification.new do |spec| 'rubygems_mfa_required' => 'true' } - spec.add_dependency 'rubocop', '~> 1.50' - spec.add_dependency 'rubocop-performance', '~> 1.17' - spec.add_dependency 'rubocop-rails', '~> 2.19' - spec.add_dependency 'rubocop-rspec', '~> 2.17' + spec.add_dependency 'rubocop', '~> 1.59' + spec.add_dependency 'rubocop-factory_bot', '~> 2.24' + spec.add_dependency 'rubocop-performance', '~> 1.20' + spec.add_dependency 'rubocop-rails', '~> 2.23' + spec.add_dependency 'rubocop-rspec', '~> 2.25' end