From 31230f9d5fe03fb1b802f2a1520d0b57e00666a8 Mon Sep 17 00:00:00 2001 From: Zulfiqar Ali Date: Thu, 13 Mar 2025 13:55:54 -0400 Subject: [PATCH 1/4] update to rubocop-rails 2.30.x --- Gemfile.lock | 41 ++++++++++--------- config/base.yml | 9 ++++ ..._rubocop_rails_without_the_monkey_patch.rb | 10 ++--- standard-rails.gemspec | 2 +- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9590368..0117935 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: standard-rails (1.2.0) lint_roller (~> 1.0) - rubocop-rails (~> 2.26.0) + rubocop-rails (~> 2.30.0) GEM remote: https://rubygems.org/ @@ -49,27 +49,30 @@ GEM rack (3.1.7) rainbow (3.1.1) rake (13.2.1) - regexp_parser (2.9.2) - rubocop (1.66.1) + regexp_parser (2.10.0) + rubocop (1.73.2) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.34.1) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.38.1) parser (>= 3.3.1.0) - rubocop-performance (1.22.1) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.26.0) + rubocop-performance (1.24.0) + lint_roller (~> 1.1) + rubocop (>= 1.72.1, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rails (2.30.3) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.52.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop (>= 1.72.1, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) securerandom (0.3.1) simplecov (0.22.0) @@ -78,18 +81,18 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - standard (1.41.1) + standard (1.47.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.66.0) + rubocop (~> 1.73.0) standard-custom (~> 1.0.0) - standard-performance (~> 1.5) + standard-performance (~> 1.7) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.5.0) + standard-performance (1.7.0) lint_roller (~> 1.1) - rubocop-performance (~> 1.22.0) + rubocop-performance (~> 1.24.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) diff --git a/config/base.yml b/config/base.yml index ac4bf60..dead3a8 100644 --- a/config/base.yml +++ b/config/base.yml @@ -30,6 +30,9 @@ Lint/SafeNavigationChain: - try! - in? +Lint/UselessAccessModifier: + Enabled: true + Rails/ActionControllerFlashBeforeRender: Enabled: false @@ -237,6 +240,9 @@ Rails/MatchRoute: Rails/MigrationClassName: Enabled: true +Rails/MultipleRoutePaths: + Enabled: true + Rails/NegateInclude: Enabled: false @@ -366,6 +372,9 @@ Rails/SquishedSQLHeredocs: Rails/StripHeredoc: Enabled: true +Rails/StrongParametersExpect: + Enabled: true + Rails/TableNameAssignment: Enabled: false diff --git a/lib/standard/rails/load_rubocop_rails_without_the_monkey_patch.rb b/lib/standard/rails/load_rubocop_rails_without_the_monkey_patch.rb index e137a1a..382fda5 100644 --- a/lib/standard/rails/load_rubocop_rails_without_the_monkey_patch.rb +++ b/lib/standard/rails/load_rubocop_rails_without_the_monkey_patch.rb @@ -7,7 +7,7 @@ # of RuboCop built-in cops in this file, we need to monitor it for changes # in rubocop-rails and keep it up to date. # -# Last updated from rubocop-rails v2.26.0 +# Last updated from rubocop-rails v2.30.3 # frozen_string_literal: true @@ -19,14 +19,14 @@ require_path = Pathname.new(Gem.loaded_specs["rubocop-rails"].full_require_paths.first) require require_path.join("rubocop/rails") require require_path.join("rubocop/rails/version") -# require_relative 'rubocop/rails/inject' require require_path.join("rubocop/rails/schema_loader") require require_path.join("rubocop/rails/schema_loader/schema") - -# RuboCop::Rails::Inject.defaults! - +require require_path.join("rubocop/rails/plugin") require require_path.join("rubocop/cop/rails_cops") +require require_path.join("rubocop/rails/migration_file_skippable") +RuboCop::Rails::MigrationFileSkippable.apply_to_cops! + RuboCop::Cop::Style::HashExcept.minimum_target_ruby_version(2.0) RuboCop::Cop::Style::InverseMethods.singleton_class.prepend( diff --git a/standard-rails.gemspec b/standard-rails.gemspec index 171ce07..7b69e8c 100644 --- a/standard-rails.gemspec +++ b/standard-rails.gemspec @@ -30,5 +30,5 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "lint_roller", "~> 1.0" - spec.add_dependency "rubocop-rails", "~> 2.26.0" + spec.add_dependency "rubocop-rails", "~> 2.30.0" end From 268214482f44ae006f69749fd45f7b5d0cf1e04f Mon Sep 17 00:00:00 2001 From: Robby Thompson Date: Wed, 19 Mar 2025 15:36:37 -0400 Subject: [PATCH 2/4] test: add ruby 3.4 --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b561d3e..67b288a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: - '3.1' - '3.2' - '3.3' + - '3.4' runs-on: ${{ matrix.os }} From 39f59ad180dab415a331e0b986c513711299cbcc Mon Sep 17 00:00:00 2001 From: Robby Thompson Date: Wed, 19 Mar 2025 15:50:14 -0400 Subject: [PATCH 3/4] dep: update dependencies --- CHANGELOG.md | 11 +++++++++++ Gemfile.lock | 32 +++++++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74c55a1..027a4a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [unreleased] + +- Update Gems + - regexp_parser@2.10.0 + - rubocop-ast@1.40.0 + - rubocop@1.73.2 + - rubocop-performance@1.24.0 + - standard-performance@1.7.0 + - standard@1.47.0 +- add Ruby 3.4 to Github Action Runner + ## [1.2.0] - Update to [rubocop-rails@2.26.0](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md#2260-2024-08-24) diff --git a/Gemfile.lock b/Gemfile.lock index 9590368..75d3155 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -49,22 +49,24 @@ GEM rack (3.1.7) rainbow (3.1.1) rake (13.2.1) - regexp_parser (2.9.2) - rubocop (1.66.1) + regexp_parser (2.10.0) + rubocop (1.73.2) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.34.1) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.40.0) parser (>= 3.3.1.0) - rubocop-performance (1.22.1) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop-performance (1.24.0) + lint_roller (~> 1.1) + rubocop (>= 1.72.1, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) rubocop-rails (2.26.0) activesupport (>= 4.2.0) rack (>= 1.1) @@ -78,18 +80,18 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - standard (1.41.1) + standard (1.47.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.66.0) + rubocop (~> 1.73.0) standard-custom (~> 1.0.0) - standard-performance (~> 1.5) + standard-performance (~> 1.7) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.5.0) + standard-performance (1.7.0) lint_roller (~> 1.1) - rubocop-performance (~> 1.22.0) + rubocop-performance (~> 1.24.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) From fb96eb2f66a44be65d3d5a29be4d365e7cf33c50 Mon Sep 17 00:00:00 2001 From: Camilo Payan Date: Thu, 20 Mar 2025 12:15:49 -0400 Subject: [PATCH 4/4] Updates Readme and disabled a rule to match standard --- README.md | 14 -------------- config/base.yml | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 593c626..561b8be 100644 --- a/README.md +++ b/README.md @@ -36,20 +36,6 @@ plugins: target_rails_version: 7.0 ``` -### Ignoring violations from old migrations - -Rails migrations are intended to be written as forward-compatible and subsequently unchanged, but they may contain Standard Ruby violations. Rather than apply fixes to those old migrations (and risk changing their behavior), you can ignore them in your `.standard.yml` like this: - -```ruby -ignore: - # Legacy migrations - - 'db/migrate/201*.rb' - - 'db/migrate/2020*.rb' - - 'db/migrate/2021*.rb' - - 'db/migrate/2022*.rb' - - 'db/migrate/2023*.rb' -``` - ## Code of Conduct This project follows Test Double's [code of diff --git a/config/base.yml b/config/base.yml index dead3a8..b60eda1 100644 --- a/config/base.yml +++ b/config/base.yml @@ -31,7 +31,7 @@ Lint/SafeNavigationChain: - in? Lint/UselessAccessModifier: - Enabled: true + Enabled: false Rails/ActionControllerFlashBeforeRender: Enabled: false @@ -373,7 +373,7 @@ Rails/StripHeredoc: Enabled: true Rails/StrongParametersExpect: - Enabled: true + Enabled: false Rails/TableNameAssignment: Enabled: false