From d48e8a5faf7a6ef83dac728dd019e03b67893f85 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 25 Dec 2022 14:58:54 +0900 Subject: [PATCH] Cut 1.15.2 --- CHANGELOG.md | 2 ++ docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops_performance.adoc | 7 +++++-- lib/rubocop/performance/version.rb | 2 +- relnotes/v1.15.2.md | 12 ++++++++++++ 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 relnotes/v1.15.2.md diff --git a/CHANGELOG.md b/CHANGELOG.md index dca1a86050..9ea5c1f931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +## 1.15.2 (2022-12-25) + ### Bug fixes * [#313](https://github.com/rubocop/rubocop-performance/issues/313): Fix a false negative for `Performance/RedundantStringChars` when using `str.chars.last` without argument. ([@koic][]) diff --git a/docs/antora.yml b/docs/antora.yml index 21b1815a34..22bad35178 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.15' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_performance.adoc b/docs/modules/ROOT/pages/cops_performance.adoc index ab89ebf32d..c07b10cb21 100644 --- a/docs/modules/ROOT/pages/cops_performance.adoc +++ b/docs/modules/ROOT/pages/cops_performance.adoc @@ -1539,6 +1539,7 @@ Checks for redundant `String#chars`. # bad str.chars[0..2] str.chars.slice(0..2) +str.chars.last # good str[0..2].chars @@ -1550,6 +1551,7 @@ str.chars.first(2) # good str[0] str[0...2].chars +str[-1] # bad str.chars.take(2) @@ -1563,9 +1565,8 @@ str.length str.size str.empty? -# For example, if the receiver is a blank string, it will be incompatible. +# For example, if the receiver is an empty string, it will be incompatible. # If a negative value is specified for the receiver, `nil` is returned. -str.chars.last # Incompatible with `str[-1]`. str.chars.last(2) # Incompatible with `str[-2..-1].chars`. str.chars.drop(2) # Incompatible with `str[2..-1].chars`. ---- @@ -2055,6 +2056,8 @@ Identifies places where `gsub` can be replaced by `tr` or `delete`. == Performance/Sum +NOTE: Required Ruby version: 2.4 + |=== | Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed diff --git a/lib/rubocop/performance/version.rb b/lib/rubocop/performance/version.rb index 0f11abe706..693d5510bb 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.1' + STRING = '1.15.2' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v1.15.2.md b/relnotes/v1.15.2.md new file mode 100644 index 0000000000..27aaf37919 --- /dev/null +++ b/relnotes/v1.15.2.md @@ -0,0 +1,12 @@ +### Bug fixes + +* [#313](https://github.com/rubocop/rubocop-performance/issues/313): Fix a false negative for `Performance/RedundantStringChars` when using `str.chars.last` without argument. ([@koic][]) +* [#321](https://github.com/rubocop/rubocop-performance/pull/321): Fix a false positive for `Performance/Sum` when using `TargetRubyVersion` is 2.3 or lower. ([@koic][]) +* [#314](https://github.com/rubocop/rubocop-performance/issues/314): Fix `Performance/RegexpMatch` to handle `::Regexp`. ([@fatkodima][]) + +### Changes + +* [#318](https://github.com/rubocop/rubocop-performance/issues/318): Extend `Performance/StringInclude` to handle `!~`. ([@fatkodima][]) + +[@koic]: https://github.com/koic +[@fatkodima]: https://github.com/fatkodima