diff --git a/CHANGELOG.md b/CHANGELOG.md index b6a3f70672..c4f4035f95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ ## master (unreleased) +## 2.23.0 (2023-12-16) + ### New features * [#1183](https://github.com/rubocop/rubocop-rails/pull/1183): Support PostGIS adapter for PostgreSQL. ([@Dania02525][]) diff --git a/docs/antora.yml b/docs/antora.yml index 9e0ff48acb..ebab17b65b 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.23' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_rails.adoc b/docs/modules/ROOT/pages/cops_rails.adoc index 9568a7783c..156dc48ba9 100644 --- a/docs/modules/ROOT/pages/cops_rails.adoc +++ b/docs/modules/ROOT/pages/cops_rails.adoc @@ -4014,10 +4014,13 @@ as the cop cannot replace to `select` between calls to `pluck` on an ---- # bad Post.where(user_id: User.active.pluck(:id)) +Post.where(user_id: User.active.ids) +Post.where.not(user_id: User.active.pluck(:id)) # good Post.where(user_id: User.active.select(:id)) Post.where(user_id: active_users.select(:id)) +Post.where.not(user_id: active_users.select(:id)) ---- ==== EnforcedStyle: conservative (default) @@ -4346,8 +4349,7 @@ end Detect redundant `all` used as a receiver for Active Record query methods. -NOTE: For the methods `delete_all` and `destroy_all`, -this cop will only check cases where the receiver is a model. +For the methods `delete_all` and `destroy_all`, this cop will only check cases where the receiver is a model. It will ignore cases where the receiver is an association (e.g., `user.articles.all.delete_all`). This is because omitting `all` from an association changes the methods from `ActiveRecord::Relation` to `ActiveRecord::Associations::CollectionProxy`, @@ -4984,13 +4986,14 @@ require_dependency 'some_lib' | 2.19 |=== -Prefer `response.parsed_body` to `JSON.parse(response.body)`. +Prefer `response.parsed_body` to custom parsing logic for `response.body`. === Safety -This cop is unsafe because Content-Type may not be `application/json`. For example, the proprietary -Content-Type provided by corporate entities such as `application/vnd.github+json` is not supported at -`response.parsed_body` by default, so you still have to use `JSON.parse(response.body)` there. +This cop is unsafe because Content-Type may not be `application/json` or `text/html`. +For example, the proprietary Content-Type provided by corporate entities such as +`application/vnd.github+json` is not supported at `response.parsed_body` by default, +so you still have to use `JSON.parse(response.body)` there. === Examples @@ -4999,6 +5002,12 @@ Content-Type provided by corporate entities such as `application/vnd.github+json # bad JSON.parse(response.body) +# bad +Nokogiri::HTML.parse(response.body) + +# bad +Nokogiri::HTML5.parse(response.body) + # good response.parsed_body ---- diff --git a/lib/rubocop/rails/version.rb b/lib/rubocop/rails/version.rb index efb8304adc..4b20fde50f 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.22.2' + STRING = '2.23.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v2.23.0.md b/relnotes/v2.23.0.md new file mode 100644 index 0000000000..24c676efe0 --- /dev/null +++ b/relnotes/v2.23.0.md @@ -0,0 +1,20 @@ +### New features + +* [#1183](https://github.com/rubocop/rubocop-rails/pull/1183): Support PostGIS adapter for PostgreSQL. ([@Dania02525][]) + +### Bug fixes + +* [#1206](https://github.com/rubocop/rubocop-rails/issues/1206): Fix an error for `Rails/WhereMissing` where join method is called without arguments. ([@fatkodima][]) +* [#1189](https://github.com/rubocop/rubocop-rails/issues/1189): Fix false negatives for `Rails/Pluck` when using safe navigation method calls. ([@koic][]) +* [#1204](https://github.com/rubocop/rubocop-rails/pull/1204): Make `Rails/ActiveSupportAliases`, `Rails/FindBy`, `Rails/FindById`, `Rails/Inquiry`, `Rails/Pick` `Rails/PluckId`, `Rails/PluckInWhere`, `Rails/WhereEquals`, `Rails/WhereExists`, and `Rails/WhereNot` cops aware of safe navigation operator. ([@koic][]) + +### Changes + +* [#1213](https://github.com/rubocop/rubocop-rails/issues/1213): Update `Rails/PluckInWhere` to check for `.ids` call. ([@fatkodima][]) +* [#1181](https://github.com/rubocop/rubocop-rails/pull/1181): Support `Nokogiri::HTML.parse` and `Nokogiri::HTML5.parse` on `Rails/ResponseParsedBody`. ([@r7kamura][]) +* [#1198](https://github.com/rubocop/rubocop-rails/issues/1198): Support `where.not` for `Rails/PluckInWhere`. ([@fatkodima][]) + +[@Dania02525]: https://github.com/Dania02525 +[@fatkodima]: https://github.com/fatkodima +[@koic]: https://github.com/koic +[@r7kamura]: https://github.com/r7kamura