Skip to content

Commit

Permalink
Cut 2.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Dec 25, 2024
1 parent bac0f3e commit fcc4cf6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

## master (unreleased)

## 2.28.0 (2024-12-25)

### New features

* [#1383](https://github.com/rubocop/rubocop-rails/pull/1383): Introduce `AllCops: MigratedSchemaVersion` config. ([@koic][])
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.28'
nav:
- modules/ROOT/nav.adoc
26 changes: 22 additions & 4 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ enum status: { active: 0, archived: 1 }
[#railsenumsyntax]
== Rails/EnumSyntax
NOTE: Required Ruby version: 3.0
NOTE: Requires Ruby version 3.0
NOTE: Required Rails version: 7.0
Expand Down Expand Up @@ -4324,6 +4324,24 @@ Enforces the use of `pluck` over `map`.
element in an enumerable. When called on an Active Record relation, it
results in a more efficient query that only selects the necessary key.
NOTE: If the receiver's relation is not loaded and `pluck` is used inside an iteration,
it may result in N+1 queries because `pluck` queries the database on each iteration.
This cop ignores offenses for `map/collect` when they are suspected to be part of an iteration
to prevent such potential issues.
[source,ruby]
----
users = User.all
5.times do
users.map { |user| user[:foo] } # Only one query is executed
end
users = User.all
5.times do
users.pluck(:id) # A query is executed on every iteration
end
----
[#safety-railspluck]
=== Safety
Expand Down Expand Up @@ -5928,7 +5946,7 @@ Rails.public_path.join('file.pdf')
[#railssafenavigation]
== Rails/SafeNavigation
NOTE: Required Ruby version: 2.3
NOTE: Requires Ruby version 2.3
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
Expand Down Expand Up @@ -6544,7 +6562,7 @@ SQL
[#railsstripheredoc]
== Rails/StripHeredoc
NOTE: Required Ruby version: 2.3
NOTE: Requires Ruby version 2.3
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
Expand Down Expand Up @@ -7670,7 +7688,7 @@ User.where.not('trashed = ? OR role = ?', true, 'admin')
[#railswhererange]
== Rails/WhereRange
NOTE: Required Ruby version: 2.6
NOTE: Requires Ruby version 2.6
NOTE: Required Rails version: 6.0
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/rails/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Rails
# This module holds the RuboCop Rails version information.
module Version
STRING = '2.27.0'
STRING = '2.28.0'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
19 changes: 19 additions & 0 deletions relnotes/v2.28.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### New features

* [#1383](https://github.com/rubocop/rubocop-rails/pull/1383): Introduce `AllCops: MigratedSchemaVersion` config. ([@koic][])

### Bug fixes

* [#1390](https://github.com/rubocop/rubocop-rails/pull/1390): Fix an incorrect autocorrect for `Rails/SelectMap` when `select` has no receiver and method chains are used. ([@masato-bkn][])
* [#1382](https://github.com/rubocop/rubocop-rails/pull/1382): Fix false negatives for `Rails/RedundantActiveRecordAllMethod` when using `all` method in block. ([@masato-bkn][])
* [#1397](https://github.com/rubocop/rubocop-rails/pull/1397): Fix `Rails/FilePath` cop error on `join` method with implicit receiver. ([@viralpraxis][])
* [#1398](https://github.com/rubocop/rubocop-rails/pull/1398): Fix `Rails/FilePath` cop error in case of extra operations in `Rails.root` interpolation. ([@viralpraxis][])
* [#1392](https://github.com/rubocop/rubocop-rails/pull/1392): Fix `Rails/FilePath` cop error with rescued `Rails.root`. ([@viralpraxis][])

### Changes

* [#1388](https://github.com/rubocop/rubocop-rails/pull/1388): Modify `Rails/Pluck` to ignore `map/collect` when used inside blocks to prevent potential N+1 queries. ([@masato-bkn][])

[@koic]: https://github.com/koic
[@masato-bkn]: https://github.com/masato-bkn
[@viralpraxis]: https://github.com/viralpraxis

0 comments on commit fcc4cf6

Please sign in to comment.