From 5e439aa07b21170a49581af9897fc97fa001cd3f Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:35:35 +0000 Subject: [PATCH 1/4] Update rubocop-rails to version 2.27.0 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index acbb799a..b1b6024e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -292,7 +292,7 @@ GEM mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.25.1) + minitest (5.25.2) monetize (1.13.0) money (~> 6.12) money (6.19.0) @@ -390,7 +390,7 @@ GEM puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.9) + rack (2.2.10) rack-openid (1.4.2) rack (>= 1.1.0) ruby-openid (>= 2.1.8) @@ -490,10 +490,10 @@ GEM rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.24.1) + rubocop-rails (2.27.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) + rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) rubocop-rspec (2.29.2) rubocop (~> 1.40) From 5b49af755992377e62683f771a0c9591d945e244 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 2 Dec 2024 13:15:26 +0100 Subject: [PATCH 2/4] Autocorrect Rails/EnumSyntax --- app/models/conference.rb | 2 +- app/models/payment.rb | 2 +- app/models/survey.rb | 2 +- app/models/survey_question.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index 90a45345..8f306380 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -96,7 +96,7 @@ class Conference < ApplicationRecord after_create :create_free_ticket after_update :delete_event_schedules - enum ticket_layout: [:portrait, :landscape] + enum :ticket_layout, [:portrait, :landscape] ## # Checks if the user is registered to the conference diff --git a/app/models/payment.rb b/app/models/payment.rb index e313f8dd..4d28887e 100644 --- a/app/models/payment.rb +++ b/app/models/payment.rb @@ -12,7 +12,7 @@ class Payment < ApplicationRecord validates :user_id, presence: true validates :conference_id, presence: true - enum status: { + enum :status, { unpaid: 0, success: 1, failure: 2 diff --git a/app/models/survey.rb b/app/models/survey.rb index 66783e90..933fa9f6 100644 --- a/app/models/survey.rb +++ b/app/models/survey.rb @@ -5,7 +5,7 @@ class Survey < ActiveRecord::Base has_many :survey_questions, dependent: :destroy has_many :survey_submissions, dependent: :destroy - enum target: [:after_conference, :during_registration, :after_event] + enum :target, [:after_conference, :during_registration, :after_event] validates :title, presence: true ## diff --git a/app/models/survey_question.rb b/app/models/survey_question.rb index 748f70dd..520e24dc 100644 --- a/app/models/survey_question.rb +++ b/app/models/survey_question.rb @@ -5,7 +5,7 @@ class SurveyQuestion < ActiveRecord::Base has_many :survey_replies, dependent: :destroy # Order of this list should not be changed without proper action! - enum kind: [:boolean, :choice, :string, :text, :datetime, :numeric] + enum :kind, [:boolean, :choice, :string, :text, :datetime, :numeric] ICONS = { boolean: 'circle-dot', choice: 'square-check', string: 'pen-to-square', text: 'align-left', datetime: 'clock', numeric: 'hashtag' }.freeze From a274940b5de9d51d00c75fe873865d4f22c9eafd Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 2 Dec 2024 13:16:34 +0100 Subject: [PATCH 3/4] Autocorrect Rails/WhereRange --- app/models/conference.rb | 4 ++-- app/models/user.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index 8f306380..2e63e4ee 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -9,8 +9,8 @@ class Conference < ApplicationRecord resourcify :roles, dependent: :delete_all default_scope { order('start_date DESC') } - scope :upcoming, (-> { where('end_date >= ?', Date.current) }) - scope :past, (-> { where('end_date < ?', Date.current) }) + scope :upcoming, (-> { where(end_date: Date.current..) }) + scope :past, (-> { where(end_date: ...Date.current) }) has_paper_trail ignore: %i(updated_at guid revision events_per_week), meta: { conference_id: :id } diff --git a/app/models/user.rb b/app/models/user.rb index 993d4892..dace4655 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -44,7 +44,7 @@ class User < ApplicationRecord where('last_sign_in_at > ?', Date.today - 3.months).where(is_disabled: false) } scope :unconfirmed, -> { where('confirmed_at IS NULL') } - scope :dead, -> { where('last_sign_in_at < ?', Date.today - 1.year) } + scope :dead, -> { where(last_sign_in_at: ...(Date.today - 1.year)) } # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, From a447ad90c4417bed69c91ff82816236932dacdd9 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 2 Dec 2024 13:17:05 +0100 Subject: [PATCH 4/4] Autocorrect Rails/RootPathnameMethods --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d5330db5..71065740 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -35,7 +35,7 @@ include ERB::Util # run twice. It is recommended that you do not name files matching this glob to # end with _spec.rb. You can configure this pattern with with the --pattern # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. -Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } +Rails.root.glob('spec/support/**/*.rb').each { |f| require f } RSpec.configure do |config| # ## Mock Framework