From 6d6fca2e6fc6e4c4d0785c09538b59f8f55a5f6c Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 7 Sep 2024 17:07:14 +0900 Subject: [PATCH] Cut 2.26.1 --- CHANGELOG.md | 2 ++ config/default.yml | 2 +- docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops_rails.adoc | 21 +++++++++++++++++++-- lib/rubocop/rails/version.rb | 2 +- relnotes/v2.26.1.md | 12 ++++++++++++ 6 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 relnotes/v2.26.1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f4ef61d35a..ae1c5d800e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ ## master (unreleased) +## 2.26.1 (2024-09-07) + ### Bug fixes * [#1343](https://github.com/rubocop/rubocop-rails/issues/1343): Fix false negatives for `Rails/EnumSyntax` for non-literal mappings. ([@earlopain][]) diff --git a/config/default.yml b/config/default.yml index 74a0251182..b59db897c5 100644 --- a/config/default.yml +++ b/config/default.yml @@ -212,7 +212,7 @@ Rails/ApplicationRecord: Enabled: true SafeAutoCorrect: false VersionAdded: '0.49' - VersionChanged: '<>' + VersionChanged: '2.26' Exclude: - db/**/*.rb diff --git a/docs/antora.yml b/docs/antora.yml index 9e0ff48acb..0e3477f379 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -2,6 +2,6 @@ name: rubocop-rails title: RuboCop Rails # We always provide version without patch here (e.g. 1.1), # as patch versions should not appear in the docs. -version: ~ +version: '2.26' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_rails.adoc b/docs/modules/ROOT/pages/cops_rails.adoc index b946879608..ad89ca7c52 100644 --- a/docs/modules/ROOT/pages/cops_rails.adoc +++ b/docs/modules/ROOT/pages/cops_rails.adoc @@ -612,11 +612,15 @@ end | Yes | Always (Unsafe) | 0.49 -| 2.5 +| 2.26 |=== Checks that models subclass `ApplicationRecord` with Rails 5.0. +It is a common practice to define models inside migrations in order to retain forward +compatibility by avoiding loading any application code. And so migration files are excluded +by default for this cop. + === Safety This cop's autocorrection is unsafe because it may let the logic from `ApplicationRecord` @@ -638,6 +642,16 @@ class Rails4Model < ActiveRecord::Base end ---- +=== Configurable attributes + +|=== +| Name | Default value | Configurable values + +| Exclude +| `+db/**/*.rb+` +| Array +|=== + == Rails/ArelStar |=== @@ -4178,7 +4192,7 @@ core extensions to the numeric classes. 3.day.ago 1.months.ago 5.megabyte -1.gigabyte +1.gigabytes # good 3.days.ago @@ -5458,6 +5472,8 @@ File.read(Rails.root.join('db', 'schema.rb')) File.binread(Rails.root.join('db', 'schema.rb')) File.write(Rails.root.join('db', 'schema.rb'), content) File.binwrite(Rails.root.join('db', 'schema.rb'), content) +Dir.glob(Rails.root.join('db', 'schema.rb')) +Dir[Rails.root.join('db', 'schema.rb')] # good Rails.root.join('db', 'schema.rb').open @@ -5466,6 +5482,7 @@ Rails.root.join('db', 'schema.rb').read Rails.root.join('db', 'schema.rb').binread Rails.root.join('db', 'schema.rb').write(content) Rails.root.join('db', 'schema.rb').binwrite(content) +Rails.root.glob("db/schema.rb") ---- == Rails/RootPublicPath diff --git a/lib/rubocop/rails/version.rb b/lib/rubocop/rails/version.rb index 438e0a2245..c77f1c36d1 100644 --- a/lib/rubocop/rails/version.rb +++ b/lib/rubocop/rails/version.rb @@ -4,7 +4,7 @@ module RuboCop module Rails # This module holds the RuboCop Rails version information. module Version - STRING = '2.26.0' + STRING = '2.26.1' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v2.26.1.md b/relnotes/v2.26.1.md new file mode 100644 index 0000000000..4a0505bc57 --- /dev/null +++ b/relnotes/v2.26.1.md @@ -0,0 +1,12 @@ +### Bug fixes + +* [#1343](https://github.com/rubocop/rubocop-rails/issues/1343): Fix false negatives for `Rails/EnumSyntax` for non-literal mappings. ([@earlopain][]) +* [#1340](https://github.com/rubocop/rubocop-rails/issues/1340): Fix a false positive for `Rails/WhereEquals`, `Rails/WhereNot`, and `Rails/WhereRange` when qualifying the database name. ([@earlopain][]) + +### Changes + +* [#1342](https://github.com/rubocop/rubocop-rails/issues/1342): Change `Rails/ApplicationRecord` to ignore migrations. ([@fatkodima][]) +* [#1350](https://github.com/rubocop/rubocop-rails/pull/1350): Change `Rails/EnumSyntax` to autocorrect underscored options. ([@fatkodima][]) + +[@earlopain]: https://github.com/earlopain +[@fatkodima]: https://github.com/fatkodima