From 21d39bac621a3fbc24790a4ea9fa8369499b934d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:11:42 +0000 Subject: [PATCH] Bump rubocop-rails from 2.20.2 to 2.21.2 Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.20.2 to 2.21.2. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.20.2...v2.21.2) --- updated-dependencies: - dependency-name: rubocop-rails dependency-type: direct:development update-type: version-update:semver-minor ... Note version 2.21.0 relaxes the default `Include` path for `Rails/FindEach`, and so this version can find and correct offenses outside the `app/models/` folder [1]. Also note this version replaces `unless something.include?` with `if something.exclude?`; since we don't use the `exclude?` method anywhere, we're removing the `include?` method from the list of methods checked by this cop. Finally, the Rails/HttpStatus method now returns a false positive when rendering a dashboard partial and passing the `status` variable. In order to avoid this issue, we could change the name of the local variable or move the partial to a component, but for now we're simply excluding these files for this cop. [1] https://github.com/rubocop/rubocop-rails/pull/1059/commits/0066b3505 Signed-off-by: dependabot[bot] --- .erb-lint.yml | 4 ++++ .rubocop.yml | 1 + Gemfile | 2 +- Gemfile.lock | 4 ++-- db/dev_seeds/budgets.rb | 2 +- db/dev_seeds/polls.rb | 2 +- db/dev_seeds/sdg.rb | 2 +- lib/acts_as_paranoid_aliases.rb | 2 +- spec/components/shared/banner_component_spec.rb | 2 +- 9 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.erb-lint.yml b/.erb-lint.yml index 5e93f2fae..07676c3fc 100644 --- a/.erb-lint.yml +++ b/.erb-lint.yml @@ -38,5 +38,9 @@ linters: Enabled: false Lint/UselessAssignment: Enabled: false + Rails/HttpStatus: + Enabled: true + Exclude: + - app/views/dashboard/* Rails/OutputSafety: Enabled: false diff --git a/.rubocop.yml b/.rubocop.yml index 7d025999a..7863dd09c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -683,6 +683,7 @@ Style/InvertibleUnlessCondition: Enabled: true InverseMethods: :blank?: :present? + :include?: ~ :present?: :blank? :zero?: ~ diff --git a/Gemfile b/Gemfile index afccd8d46..8c540cc7a 100644 --- a/Gemfile +++ b/Gemfile @@ -109,7 +109,7 @@ group :development do gem "rubocop-capybara", "~> 2.18.0", require: false gem "rubocop-factory_bot", "~> 2.24.0", require: false gem "rubocop-performance", "~> 1.19.1", require: false - gem "rubocop-rails", "~> 2.20.2", require: false + gem "rubocop-rails", "~> 2.21.2", require: false gem "rubocop-rspec", "~> 2.24.1", require: false gem "rvm1-capistrano3", "~> 1.4.0", require: false gem "scss_lint", "~> 0.60.0", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 6e7688c2e..7a31e15a6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -536,7 +536,7 @@ GEM rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.20.2) + rubocop-rails (2.21.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -754,7 +754,7 @@ DEPENDENCIES rubocop-capybara (~> 2.18.0) rubocop-factory_bot (~> 2.24.0) rubocop-performance (~> 1.19.1) - rubocop-rails (~> 2.20.2) + rubocop-rails (~> 2.21.2) rubocop-rspec (~> 2.24.1) rvm1-capistrano3 (~> 1.4.0) sassc-rails (~> 2.1.2) diff --git a/db/dev_seeds/budgets.rb b/db/dev_seeds/budgets.rb index bdae27338..b82587473 100644 --- a/db/dev_seeds/budgets.rb +++ b/db/dev_seeds/budgets.rb @@ -48,7 +48,7 @@ section "Creating Budgets" do end end - Budget.all.each do |budget| + Budget.all.find_each do |budget| city_group = budget.groups.create!( random_locales_attributes(name: -> { I18n.t("seeds.budgets.groups.all_city") }) ) diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index 9fc1cfd69..f8b5dde45 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -102,7 +102,7 @@ end section "Creating Poll Shifts for Poll Officers" do Poll.find_each do |poll| - Poll::BoothAssignment.where(poll: poll).each do |booth_assignment| + Poll::BoothAssignment.where(poll: poll).find_each do |booth_assignment| scrutiny = (poll.ends_at.to_datetime..poll.ends_at.to_datetime + Poll::RECOUNT_DURATION) Poll::Officer.find_each do |poll_officer| { diff --git a/db/dev_seeds/sdg.rb b/db/dev_seeds/sdg.rb index 7f90b594d..27558cb5e 100644 --- a/db/dev_seeds/sdg.rb +++ b/db/dev_seeds/sdg.rb @@ -32,7 +32,7 @@ section "Creating Sustainable Development Goals" do end section "Creating SDG homepage cards" do - SDG::Phase.all.each do |phase| + SDG::Phase.all.find_each do |phase| Widget::Card.create!(cardable: phase, title: "#{phase.title} card", link_text: "Link Text", link_url: "/any_path") end diff --git a/lib/acts_as_paranoid_aliases.rb b/lib/acts_as_paranoid_aliases.rb index f4c813ab0..369bdc6c9 100644 --- a/lib/acts_as_paranoid_aliases.rb +++ b/lib/acts_as_paranoid_aliases.rb @@ -63,7 +63,7 @@ module ActsAsParanoidAliases def restore_all(ids) return if ids.blank? - only_hidden.where(id: ids).each(&:restore) + only_hidden.where(id: ids).find_each(&:restore) end end end diff --git a/spec/components/shared/banner_component_spec.rb b/spec/components/shared/banner_component_spec.rb index ef36de26a..2dda4dca8 100644 --- a/spec/components/shared/banner_component_spec.rb +++ b/spec/components/shared/banner_component_spec.rb @@ -75,7 +75,7 @@ describe Shared::BannerComponent do end it "does not render anything with no active banners" do - Banner.all.each { |banner| banner.update!(post_ended_at: Date.current - 1.day) } + Banner.all.find_each { |banner| banner.update!(post_ended_at: Date.current - 1.day) } render_inline Shared::BannerComponent.new("debates")