From 30f6669ffb7241676d269645a4c55ed6da7adaa1 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 30 Mar 2024 19:10:44 +0900 Subject: [PATCH] Cut 1.21.0 --- CHANGELOG.md | 2 + config/default.yml | 2 +- docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops_performance.adoc | 96 ++++++++++--------- lib/rubocop/performance/version.rb | 2 +- relnotes/v1.21.0.md | 15 +++ 6 files changed, 71 insertions(+), 48 deletions(-) create mode 100644 relnotes/v1.21.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index dc5d1b2c44..994fe43cb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ ## master (unreleased) +## 1.21.0 (2024-03-30) + ### New features * [#446](https://github.com/rubocop/rubocop-performance/pull/446): Support Prism as a Ruby parser (experimental). ([@koic][]) diff --git a/config/default.yml b/config/default.yml index c9a434625b..95dc830898 100644 --- a/config/default.yml +++ b/config/default.yml @@ -58,7 +58,7 @@ Performance/Casecmp: Enabled: false Safe: false VersionAdded: '0.36' - VersionChanged: '<>' + VersionChanged: '1.21' Performance/ChainArrayAllocation: Description: >- diff --git a/docs/antora.yml b/docs/antora.yml index 21b1815a34..b1478fcc7a 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.21' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_performance.adoc b/docs/modules/ROOT/pages/cops_performance.adoc index ee84d096e3..f7bf3fad6b 100644 --- a/docs/modules/ROOT/pages/cops_performance.adoc +++ b/docs/modules/ROOT/pages/cops_performance.adoc @@ -13,7 +13,7 @@ | Pending | No -| Yes (Unsafe) +| Always (Unsafe) | 1.7 | - |=== @@ -49,7 +49,7 @@ NOTE: Required Ruby version: 2.7 | Disabled | No -| Yes (Unsafe) +| Always (Unsafe) | 1.9 | - |=== @@ -89,7 +89,7 @@ array.take(3) | Pending | Yes -| Yes +| Always | 1.7 | - |=== @@ -124,7 +124,7 @@ NOTE: Required Ruby version: 2.7 | Enabled | Yes -| Yes +| Always | 1.6 | - |=== @@ -156,7 +156,7 @@ umethod.bind_call(obj, foo, bar) | Pending | Yes -| Yes +| Always | 1.9 | - |=== @@ -193,7 +193,7 @@ end | Enabled | Yes -| Yes +| Always | 0.49 | 1.9 |=== @@ -224,7 +224,7 @@ caller_locations(1..1).first | Disabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 0.34 | 1.13 |=== @@ -292,16 +292,22 @@ end |=== | Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed -| Enabled +| Disabled | No -| Yes (Unsafe) +| Always (Unsafe) | 0.36 -| - +| 1.21 |=== Identifies places where a case-insensitive string comparison can better be implemented using `casecmp`. +This cop is disabled by default because `String#casecmp` only works with +ASCII characters. See https://github.com/rubocop/rubocop/issues/9753. + +If you are working only with ASCII characters, then this cop can be +safely enabled. + === Safety This cop is unsafe because `String#casecmp` and `String#casecmp?` behave @@ -422,7 +428,7 @@ end | Enabled | Yes -| Yes +| Always | 0.46 | - |=== @@ -463,7 +469,7 @@ array.sort_by { |a| a[:foo] } | Pending | Yes -| Yes +| Always | 1.12 | - |=== @@ -493,7 +499,7 @@ Process.clock_gettime(Process::CLOCK_MONOTONIC) | Pending | Yes -| Yes +| Always | 1.9 | 1.10 |=== @@ -538,7 +544,7 @@ end | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 0.31 | 1.8 |=== @@ -600,7 +606,7 @@ NOTE: Required Ruby version: 2.5 | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 1.6 | 1.11 |=== @@ -677,7 +683,7 @@ NOTE: Required Ruby version: 2.5 | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 1.6 | 1.11 |=== @@ -752,7 +758,7 @@ str.sub!(/suffix$/, '') | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 0.30 | 1.8 |=== @@ -797,7 +803,7 @@ if the receiver is a `Hash`, it may report a false positive. | Enabled | Yes -| Yes +| Always | 0.36 | 0.48 |=== @@ -866,7 +872,7 @@ str.ends_with?(var1, var2) | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 0.36 | 1.10 |=== @@ -1004,7 +1010,7 @@ waldo.size | Enabled | Yes -| Yes +| Always | 0.30 | - |=== @@ -1047,7 +1053,7 @@ change them to use `flat_map { ... }` instead. | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 0.56 | - |=== @@ -1104,7 +1110,7 @@ h = { a: 1, b: 2 }; h.value?(nil) | Disabled | Yes -| Yes +| Always | 1.7 | - |=== @@ -1146,7 +1152,7 @@ NOTE: Required Ruby version: 2.7 | Pending | Yes -| Yes (Unsafe) +| Always (Unsafe) | 1.11 | - |=== @@ -1318,7 +1324,7 @@ end | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 0.36 | 1.7 |=== @@ -1363,7 +1369,7 @@ Example of a case where `Range#cover?` may not provide the desired result: | Enabled | Yes -| Yes +| Always | 0.36 | - |=== @@ -1405,7 +1411,7 @@ NOTE: Required Ruby version: 2.5 | Pending | No -| Yes (Unsafe) +| Always (Unsafe) | 1.10 | - |=== @@ -1485,7 +1491,7 @@ items.all? { |item| item.match?(pattern) } | Enabled | Yes -| Yes +| Always | 0.36 | - |=== @@ -1516,7 +1522,7 @@ return value unless regex =~ 'str' | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 0.36 | 1.11 |=== @@ -1576,7 +1582,7 @@ hash[:b] = 2 | Pending | Yes -| Yes +| Always | 1.7 | - |=== @@ -1601,7 +1607,7 @@ array.sort | Pending | Yes -| Yes +| Always | 1.10 | - |=== @@ -1627,7 +1633,7 @@ a deterministic regexp to a string. | Pending | Yes -| Yes +| Always | 1.7 | - |=== @@ -1682,7 +1688,7 @@ NOTE: Required Ruby version: 2.4 | Enabled | Yes -| Yes +| Always | 0.47 | - |=== @@ -1772,7 +1778,7 @@ end | Enabled | Yes -| Yes +| Always | 0.30 | - |=== @@ -1809,7 +1815,7 @@ items.reverse_each | Pending | Yes -| Yes +| Always | 1.7 | - |=== @@ -1867,7 +1873,7 @@ ary.filter_map { |o| o.bar if o.foo } | Enabled | Yes -| Yes +| Always | 0.30 | - |=== @@ -1920,7 +1926,7 @@ Hash(key: :value).size | Pending | Yes -| Yes +| Always | 1.7 | - |=== @@ -1946,7 +1952,7 @@ array.sort.reverse | Pending | Yes -| Yes +| Always | 1.7 | - |=== @@ -1980,7 +1986,7 @@ str.squeeze!('a') | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 0.36 | 1.10 |=== @@ -2060,7 +2066,7 @@ of the variables which rubocop doesn't have. | Pending | Yes -| Yes +| Always | 1.13 | - |=== @@ -2101,7 +2107,7 @@ const_defined?("#{module_path}::Base") | Pending | Yes -| Yes (Unsafe) +| Always (Unsafe) | 1.7 | 1.12 |=== @@ -2136,7 +2142,7 @@ str.include?('ab') | Enabled | Yes -| Yes +| Always | 0.33 | - |=== @@ -2173,7 +2179,7 @@ NOTE: Required Ruby version: 2.4 | Pending | Yes -| Yes (Unsafe) +| Always (Unsafe) | 1.8 | 1.13 |=== @@ -2274,7 +2280,7 @@ as initial value and successively add all following values to it, whereas | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 0.36 | 1.13 |=== @@ -2320,7 +2326,7 @@ NOTE: Required Ruby version: 2.3 | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 0.50 | 1.9 |=== @@ -2359,7 +2365,7 @@ String.new('something') | Enabled | Yes -| Yes +| Always | 0.50 | - |=== diff --git a/lib/rubocop/performance/version.rb b/lib/rubocop/performance/version.rb index fe1ebd482e..5fcb5a75d1 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.20.2' + STRING = '1.21.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v1.21.0.md b/relnotes/v1.21.0.md new file mode 100644 index 0000000000..5cf764aeb8 --- /dev/null +++ b/relnotes/v1.21.0.md @@ -0,0 +1,15 @@ +### New features + +* [#446](https://github.com/rubocop/rubocop-performance/pull/446): Support Prism as a Ruby parser (experimental). ([@koic][]) + +### Bug fixes + +* [#437](https://github.com/rubocop/rubocop-performance/issues/437): Fix a false positive for `Performance/ChainArrayAllocation` when using `select` with block argument after `select`. ([@koic][]) +* [#448](https://github.com/rubocop/rubocop-performance/issues/448): Fix a false positive for `Performance/RedundantBlockCall` when using `block.call` with block argument. ([@koic][]) + +### Changes + +* [#240](https://github.com/rubocop/rubocop-performance/issues/240): Disable `Performance/Casecmp` cop by default. ([@parkerfinch][]) + +[@koic]: https://github.com/koic +[@parkerfinch]: https://github.com/parkerfinch