Skip to content

Commit 983f264

Browse files
committed
Cut 2.29.0
1 parent 72a9281 commit 983f264

File tree

7 files changed

+129
-4
lines changed

7 files changed

+129
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
## master (unreleased)
1111

12+
## 2.29.0 (2025-01-18)
13+
1214
### New features
1315

1416
* [#1407](https://github.com/rubocop/rubocop-rails/pull/1407): Add new `Rails/MultipleRoutePaths` cop. ([@koic][])

config/default.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ Rails/MultipleRoutePaths:
702702
Description: 'Checks for mapping a route with multiple paths, which is deprecated and will be removed in Rails 8.1.'
703703
Enabled: pending
704704
Severity: warning
705-
VersionAdded: '<<next>>'
705+
VersionAdded: '2.29'
706706
Include:
707707
- config/routes.rb
708708
- config/routes/**/*.rb
@@ -1088,7 +1088,7 @@ Rails/StrongParametersExpect:
10881088
Include:
10891089
- app/controllers/**/*.rb
10901090
SafeAutoCorrect: false
1091-
VersionAdded: '<<next>>'
1091+
VersionAdded: '2.29'
10921092

10931093
Rails/TableNameAssignment:
10941094
Description: >-

docs/antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: rubocop-rails
22
title: RuboCop Rails
33
# We always provide version without patch here (e.g. 1.1),
44
# as patch versions should not appear in the docs.
5-
version: ~
5+
version: '2.29'
66
nav:
77
- modules/ROOT/nav.adoc

docs/modules/ROOT/pages/cops.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ based on the https://rails.rubystyle.guide/[Rails Style Guide].
8484
* xref:cops_rails.adoc#railsmailername[Rails/MailerName]
8585
* xref:cops_rails.adoc#railsmatchroute[Rails/MatchRoute]
8686
* xref:cops_rails.adoc#railsmigrationclassname[Rails/MigrationClassName]
87+
* xref:cops_rails.adoc#railsmultipleroutepaths[Rails/MultipleRoutePaths]
8788
* xref:cops_rails.adoc#railsnegateinclude[Rails/NegateInclude]
8889
* xref:cops_rails.adoc#railsnotnullcolumn[Rails/NotNullColumn]
8990
* xref:cops_rails.adoc#railsorderbyid[Rails/OrderById]
@@ -127,6 +128,7 @@ based on the https://rails.rubystyle.guide/[Rails Style Guide].
127128
* xref:cops_rails.adoc#railsskipsmodelvalidations[Rails/SkipsModelValidations]
128129
* xref:cops_rails.adoc#railssquishedsqlheredocs[Rails/SquishedSQLHeredocs]
129130
* xref:cops_rails.adoc#railsstripheredoc[Rails/StripHeredoc]
131+
* xref:cops_rails.adoc#railsstrongparametersexpect[Rails/StrongParametersExpect]
130132
* xref:cops_rails.adoc#railstablenameassignment[Rails/TableNameAssignment]
131133
* xref:cops_rails.adoc#railsthreestatebooleancolumn[Rails/ThreeStateBooleanColumn]
132134
* xref:cops_rails.adoc#railstimezone[Rails/TimeZone]

docs/modules/ROOT/pages/cops_rails.adoc

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,6 +3975,49 @@ end
39753975
| Array
39763976
|===
39773977
3978+
[#railsmultipleroutepaths]
3979+
== Rails/MultipleRoutePaths
3980+
3981+
|===
3982+
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
3983+
3984+
| Pending
3985+
| Yes
3986+
| Always
3987+
| 2.29
3988+
| -
3989+
|===
3990+
3991+
Checks for mapping a route with multiple paths, which is deprecated and will be removed in Rails 8.1.
3992+
3993+
[#examples-railsmultipleroutepaths]
3994+
=== Examples
3995+
3996+
[source,ruby]
3997+
----
3998+
# bad
3999+
get '/users', '/other_path', to: 'users#index'
4000+
4001+
# good
4002+
get '/users', to: 'users#index'
4003+
get '/other_path', to: 'users#index'
4004+
----
4005+
4006+
[#configurable-attributes-railsmultipleroutepaths]
4007+
=== Configurable attributes
4008+
4009+
|===
4010+
| Name | Default value | Configurable values
4011+
4012+
| Severity
4013+
| `warning`
4014+
| String
4015+
4016+
| Include
4017+
| `config/routes.rb`, `+config/routes/**/*.rb+`
4018+
| Array
4019+
|===
4020+
39784021
[#railsnegateinclude]
39794022
== Rails/NegateInclude
39804023
@@ -6602,6 +6645,60 @@ EOS
66026645
66036646
* https://rails.rubystyle.guide/#prefer-squiggly-heredoc
66046647
6648+
[#railsstrongparametersexpect]
6649+
== Rails/StrongParametersExpect
6650+
6651+
NOTE: Required Rails version: 8.0
6652+
6653+
|===
6654+
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
6655+
6656+
| Pending
6657+
| Yes
6658+
| Always (Unsafe)
6659+
| 2.29
6660+
| -
6661+
|===
6662+
6663+
Enforces the use of `ActionController::Parameters#expect` as a method for strong parameter handling.
6664+
6665+
[#safety-railsstrongparametersexpect]
6666+
=== Safety
6667+
6668+
This cop's autocorrection is considered unsafe because there are cases where the HTTP status may change
6669+
from 500 to 400 when handling invalid parameters. This change, however, reflects an intentional
6670+
incompatibility introduced for valid reasons by the `expect` method, which aligns better with
6671+
strong parameter conventions.
6672+
6673+
[#examples-railsstrongparametersexpect]
6674+
=== Examples
6675+
6676+
[source,ruby]
6677+
----
6678+
# bad
6679+
params.require(:user).permit(:name, :age)
6680+
params.permit(user: [:name, :age]).require(:user)
6681+
6682+
# good
6683+
params.expect(user: [:name, :age])
6684+
----
6685+
6686+
[#configurable-attributes-railsstrongparametersexpect]
6687+
=== Configurable attributes
6688+
6689+
|===
6690+
| Name | Default value | Configurable values
6691+
6692+
| Include
6693+
| `+app/controllers/**/*.rb+`
6694+
| Array
6695+
|===
6696+
6697+
[#references-railsstrongparametersexpect]
6698+
=== References
6699+
6700+
* https://api.rubyonrails.org/classes/ActionController/Parameters.html#method-i-expect
6701+
66056702
[#railstablenameassignment]
66066703
== Rails/TableNameAssignment
66076704

lib/rubocop/rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module RuboCop
44
module Rails
55
# This module holds the RuboCop Rails version information.
66
module Version
7-
STRING = '2.28.0'
7+
STRING = '2.29.0'
88

99
def self.document_version
1010
STRING.match('\d+\.\d+').to_s

relnotes/v2.29.0.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
### New features
2+
3+
* [#1407](https://github.com/rubocop/rubocop-rails/pull/1407): Add new `Rails/MultipleRoutePaths` cop. ([@koic][])
4+
* [#1358](https://github.com/rubocop/rubocop-rails/issues/1358): Add new `Rails/StrongParametersExpect` cop. ([@koic][])
5+
6+
### Bug fixes
7+
8+
* [#1409](https://github.com/rubocop/rubocop-rails/pull/1409): Fix an error for `Rails/ReversibleMigration` when calling `drop_table` without any arguments. ([@earlopain][])
9+
* [#1397](https://github.com/rubocop/rubocop-rails/pull/1397): Fix an incorrect autocorrect for `Rails/TimeZone` when Time.new has a string argument. ([@mterada1228][])
10+
* [#1406](https://github.com/rubocop/rubocop-rails/pull/1406): Fix autocorrection for `Rails/IndexBy` and `Rails/IndexWith` when `map { ... }.to_h` is enclosed in another block. ([@franzliedke][], [@eugeneius][])
11+
* [#1404](https://github.com/rubocop/rubocop-rails/pull/1404): Update `Rails/IndexBy` and `Rails/IndexWith` to support numbered block parameters. ([@eugeneius][])
12+
* [#1405](https://github.com/rubocop/rubocop-rails/pull/1405): Fix autocorrection for `Rails/IndexWith` when the value is a hash literal without braces. ([@koic][], [@eugeneius][])
13+
* [#1414](https://github.com/rubocop/rubocop-rails/pull/1414): Fix `Rails/HttpPositionalArguments` cop false positives with arguments forwarding. ([@viralpraxis][])
14+
15+
### Changes
16+
17+
* [#1410](https://github.com/rubocop/rubocop-rails/issues/1410): Make registered cops aware of `AllCops: MigratedSchemaVersion`. ([@koic][])
18+
19+
[@koic]: https://github.com/koic
20+
[@earlopain]: https://github.com/earlopain
21+
[@mterada1228]: https://github.com/mterada1228
22+
[@franzliedke]: https://github.com/franzliedke
23+
[@eugeneius]: https://github.com/eugeneius
24+
[@viralpraxis]: https://github.com/viralpraxis

0 commit comments

Comments
 (0)