From 0b9aeedbcc7e0ce696213c11f75d3be136bb3de1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:29:52 +0000 Subject: [PATCH 1/4] Bump rubocop from 1.64.1 to 1.66.1 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.64.1 to 1.66.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.64.1...v1.66.1) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 13323572e..57dc34c4d 100644 --- a/Gemfile +++ b/Gemfile @@ -98,7 +98,7 @@ group :development do gem "pronto-eslint", "~> 0.11.1", require: false gem "pronto-rubocop", "~> 0.11.5", require: false gem "pronto-stylelint", "~> 0.10.3", require: false - gem "rubocop", "~> 1.64.1", require: false + gem "rubocop", "~> 1.66.1", require: false gem "rubocop-capybara", "~> 2.21.0", require: false gem "rubocop-factory_bot", "~> 2.26.1", require: false gem "rubocop-performance", "~> 1.22.1", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 17b69fc85..b4a4a6186 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -538,15 +538,14 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.64.1) + rubocop (1.66.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.32.3) @@ -769,7 +768,7 @@ DEPENDENCIES rinku (~> 2.0.6) ros-apartment (~> 2.11.0) rspec-rails (~> 7.0.1) - rubocop (~> 1.64.1) + rubocop (~> 1.66.1) rubocop-capybara (~> 2.21.0) rubocop-factory_bot (~> 2.26.1) rubocop-performance (~> 1.22.1) From d94eed8628cd5e18333a53dfabdc6644320d95cc Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 9 Oct 2024 09:33:35 +0200 Subject: [PATCH 2/4] Add and apply Style/RedundantRegexpCharacterClass rubocop rule This rule was introduced in RuboCop 0.93.0, but now after seeing a fix in version 1.65, we have decided to add it. The reason for adding it is to simplify our regular expressions. This enforcement will help us maintain better regular expression practices across the project. --- .rubocop.yml | 3 +++ app/models/signature_sheet.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index a183aa5b7..dacb743ae 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -781,6 +781,9 @@ Style/RedundantInterpolation: Style/RedundantParentheses: Enabled: true +Style/RedundantRegexpCharacterClass: + Enabled: true + Style/RedundantReturn: Enabled: true diff --git a/app/models/signature_sheet.rb b/app/models/signature_sheet.rb index 713d6ef71..3f7462999 100644 --- a/app/models/signature_sheet.rb +++ b/app/models/signature_sheet.rb @@ -39,7 +39,7 @@ class SignatureSheet < ApplicationRecord end def parsed_required_fields_to_verify_groups - required_fields_to_verify.split(/[;]/).map { |d| d.gsub(/\s+/, "") }.map { |group| group.split(/[,]/) } + required_fields_to_verify.split(/;/).map { |d| d.gsub(/\s+/, "") }.map { |group| group.split(/,/) } end def signable_found From 6b15a073a277bcb91865f2d9492421719a42250a Mon Sep 17 00:00:00 2001 From: taitus Date: Thu, 10 Oct 2024 09:47:33 +0200 Subject: [PATCH 3/4] Add and apply Style/RedundantRegexpArgument RuboCop rule This rule was introduced in RuboCop 1.53.0. After adding the Style/RedundantRegexpCharacterClass rule in the previous commit, RuboCop started detecting redundant regular expression arguments. Therefore, we apply this rule to remove them and prevent future occurrences. --- .rubocop.yml | 3 +++ app/models/signature_sheet.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index dacb743ae..adea1e858 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -781,6 +781,9 @@ Style/RedundantInterpolation: Style/RedundantParentheses: Enabled: true +Style/RedundantRegexpArgument: + Enabled: true + Style/RedundantRegexpCharacterClass: Enabled: true diff --git a/app/models/signature_sheet.rb b/app/models/signature_sheet.rb index 3f7462999..d123967be 100644 --- a/app/models/signature_sheet.rb +++ b/app/models/signature_sheet.rb @@ -39,7 +39,7 @@ class SignatureSheet < ApplicationRecord end def parsed_required_fields_to_verify_groups - required_fields_to_verify.split(/;/).map { |d| d.gsub(/\s+/, "") }.map { |group| group.split(/,/) } + required_fields_to_verify.split(";").map { |d| d.gsub(/\s+/, "") }.map { |group| group.split(",") } end def signable_found From 4dcac5bed5c0c90fb303c4eb3a4c306b9e6d932a Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 9 Oct 2024 10:14:08 +0200 Subject: [PATCH 4/4] Add and apply Naming/RescuedExceptionsVariableName rubocop rule This rule was introduced in RuboCop 0.67.2, but now after seeing a fix in version 1.65.1, we have decided to add it. The reason for adding it is to ensure consistency in how we reference exceptions throughout the project, by following a standard naming convention for exception variables. --- .rubocop.yml | 3 +++ app/models/machine_learning.rb | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index adea1e858..e36c33623 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -337,6 +337,9 @@ Naming/BlockForwarding: - "app/controllers/management/base_controller.rb" - "app/controllers/subscriptions_controller.rb" +Naming/RescuedExceptionsVariableName: + Enabled: true + Naming/VariableName: Enabled: true diff --git a/app/models/machine_learning.rb b/app/models/machine_learning.rb index f7bb3503e..5541d3327 100644 --- a/app/models/machine_learning.rb +++ b/app/models/machine_learning.rb @@ -62,9 +62,9 @@ class MachineLearning job.update!(finished_at: Time.current) Mailer.machine_learning_success(user).deliver_later - rescue Exception => error - handle_error(error) - raise error + rescue Exception => e + handle_error(e) + raise e end end handle_asynchronously :run, queue: "machine_learning"