From d8712aaf61a6ce294a654c0cb20bf12c73692aea Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 6 Feb 2023 11:42:50 +0900 Subject: [PATCH] Cut 1.16.0 --- CHANGELOG.md | 2 ++ docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops_performance.adoc | 25 +++++++++++-------- lib/rubocop/performance/version.rb | 2 +- relnotes/v1.16.0.md | 5 ++++ 5 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 relnotes/v1.16.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 9411c6d3f8..11eebd6c0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +## 1.16.0 (2023-02-06) + ### Changes * [#332](https://github.com/rubocop/rubocop-performance/pull/332): Register offenses for variables against regexes in `Performance/StringInclude`. ([@fatkodima][]) diff --git a/docs/antora.yml b/docs/antora.yml index 21b1815a34..2bcdad75d1 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -2,6 +2,6 @@ name: rubocop-performance title: RuboCop Performance # We always provide version without patch here (e.g. 1.1), # as patch versions should not appear in the docs. -version: ~ +version: '1.16' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_performance.adoc b/docs/modules/ROOT/pages/cops_performance.adoc index c07b10cb21..197bdb07f9 100644 --- a/docs/modules/ROOT/pages/cops_performance.adoc +++ b/docs/modules/ROOT/pages/cops_performance.adoc @@ -754,9 +754,12 @@ chained to `select`, `find_all` or `filter` and change them to use === Safety -This cop is unsafe because is has known compatibility issues with `ActiveRecord` and other -frameworks. `ActiveRecord` does not implement a `detect` method and `find` has its own -meaning. Correcting `ActiveRecord` methods with this cop should be considered unsafe. +This cop is unsafe because is assumes the class implements the +`Enumerable` interface, but can't reliably detect this. This creates +known compatibility issues with `Hash`, `ActiveRecord` and other +frameworks. `Hash` and `ActiveRecord` do not implement a `detect` +method and `find` has its own meaning. Correcting `Hash` and +`ActiveRecord` methods with this cop should be considered unsafe. === Examples @@ -2001,22 +2004,22 @@ Identifies unnecessary use of a regex where `String#include?` would suffice. === Safety -This cop's offenses are not safe to autocorrect if a receiver is nil. +This cop's offenses are not safe to autocorrect if a receiver is nil or a Symbol. === Examples [source,ruby] ---- # bad -'abc'.match?(/ab/) -/ab/.match?('abc') -'abc' =~ /ab/ -/ab/ =~ 'abc' -'abc'.match(/ab/) -/ab/.match('abc') +str.match?(/ab/) +/ab/.match?(str) +str =~ /ab/ +/ab/ =~ str +str.match(/ab/) +/ab/.match(str) # good -'abc'.include?('ab') +str.include?('ab') ---- == Performance/StringReplacement diff --git a/lib/rubocop/performance/version.rb b/lib/rubocop/performance/version.rb index 693d5510bb..0de76a386c 100644 --- a/lib/rubocop/performance/version.rb +++ b/lib/rubocop/performance/version.rb @@ -4,7 +4,7 @@ module RuboCop module Performance # This module holds the RuboCop Performance version information. module Version - STRING = '1.15.2' + STRING = '1.16.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v1.16.0.md b/relnotes/v1.16.0.md new file mode 100644 index 0000000000..5cd024cd4b --- /dev/null +++ b/relnotes/v1.16.0.md @@ -0,0 +1,5 @@ +### Changes + +* [#332](https://github.com/rubocop/rubocop-performance/pull/332): Register offenses for variables against regexes in `Performance/StringInclude`. ([@fatkodima][]) + +[@fatkodima]: https://github.com/fatkodima