From e346e6fee531736200e1487877256c982c908eb8 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 10 Jan 2022 05:59:54 +0900 Subject: [PATCH] Cut 2.13.1 --- CHANGELOG.md | 2 ++ docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops_rails.adoc | 12 ++++++++++++ lib/rubocop/rails/version.rb | 2 +- relnotes/v2.13.1.md | 15 +++++++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 relnotes/v2.13.1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 50d5848408..d30b88e11e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +## 2.13.1 (2022-01-10) + ### Bug fixes * [#601](https://github.com/rubocop/rubocop-rails/pull/601): Handle ignored_columns from mixins for `Rails/UnusedIgnoredColumns` cop. ([@tachyons][]) diff --git a/docs/antora.yml b/docs/antora.yml index 34b6c248ba..b4e0f9a95a 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: master +version: '2.13' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_rails.adoc b/docs/modules/ROOT/pages/cops_rails.adoc index 2c75994df7..410a9e13f7 100644 --- a/docs/modules/ROOT/pages/cops_rails.adoc +++ b/docs/modules/ROOT/pages/cops_rails.adoc @@ -3439,6 +3439,10 @@ an `ActiveModel::MissingAttributeError`. Explicitly raising an error in this situation is preferable, and that is why rubocop recommends using square brackets. +When called from within a method with the same name as the attribute, +`read_attribute` and `write_attribute` must be used to prevent an +infinite loop: + === Examples [source,ruby] @@ -3452,6 +3456,14 @@ x = self[:attr] self[:attr] = val ---- +[source,ruby] +---- +# good +def foo + bar || read_attribute(:foo) +end +---- + === Configurable attributes |=== diff --git a/lib/rubocop/rails/version.rb b/lib/rubocop/rails/version.rb index 14f2158be3..2c55711cc7 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.13.0' + STRING = '2.13.1' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v2.13.1.md b/relnotes/v2.13.1.md new file mode 100644 index 0000000000..fe27cc9790 --- /dev/null +++ b/relnotes/v2.13.1.md @@ -0,0 +1,15 @@ +### Bug fixes + +* [#601](https://github.com/rubocop/rubocop-rails/pull/601): Handle ignored_columns from mixins for `Rails/UnusedIgnoredColumns` cop. ([@tachyons][]) +* [#603](https://github.com/rubocop/rubocop-rails/issues/603): Fix autocorrection of multiple attributes for `Rails/RedundantPresenceValidationOnBelongsTo` cop. ([@pirj][]) +* [#608](https://github.com/rubocop/rubocop-rails/issues/608): Fix autocorrection of strict validation for `Rails/RedundantPresenceValidationOnBelongsTo` cop. ([@pirj][]) + +### Changes + +* [#585](https://github.com/rubocop/rubocop-rails/pull/585): Make `Rails/ReadWriteAttribute` cop aware of shadowing methods. ([@drenmi][]) +* [#604](https://github.com/rubocop/rubocop-rails/issues/604): Remove `remove_reference` and `remove_belongs_to` methods from `Rails/ReversibleMigration` cop offenses. ([@TonyArra][]) + +[@tachyons]: https://github.com/tachyons +[@pirj]: https://github.com/pirj +[@drenmi]: https://github.com/drenmi +[@TonyArra]: https://github.com/TonyArra