From 91b35bad41f534dc7d3b429336973491f74f54f1 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 9 Apr 2023 15:56:53 +0900 Subject: [PATCH] Fix `AllowRegexpMatch` of `Performance/RedundantEqualityComparisonBlock` by default This PR fixes `AllowRegexpMatch` of `Performance/RedundantEqualityComparisonBlock` by default. Default value is true as documented example below: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performanceredundantequalitycomparisonblock --- ...fix_default_config_of_redundant_equality_comparison_block.md | 1 + config/default.yml | 2 +- .../cop/performance/redundant_equality_comparison_block.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog/fix_default_config_of_redundant_equality_comparison_block.md diff --git a/changelog/fix_default_config_of_redundant_equality_comparison_block.md b/changelog/fix_default_config_of_redundant_equality_comparison_block.md new file mode 100644 index 0000000000..24b73ea118 --- /dev/null +++ b/changelog/fix_default_config_of_redundant_equality_comparison_block.md @@ -0,0 +1 @@ +* [#352](https://github.com/rubocop/rubocop-performance/pull/352): Fix the default config for `AllowRegexpMatch` option of `Performance/RedundantEqualityComparisonBlock`. ([@koic][]) diff --git a/config/default.yml b/config/default.yml index a345fb8dc6..6993c89521 100644 --- a/config/default.yml +++ b/config/default.yml @@ -226,7 +226,7 @@ Performance/RedundantEqualityComparisonBlock: Reference: 'https://github.com/rails/rails/pull/41363' Enabled: pending Safe: false - AllowRegexpMatch: false + AllowRegexpMatch: true VersionAdded: '1.10' Performance/RedundantMatch: diff --git a/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb b/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb index ff1771de6a..2600f5c969 100644 --- a/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb +++ b/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb @@ -10,7 +10,7 @@ module Performance # behavior is appropriately overridden in subclass. For example, # `Range#===` returns `true` when argument is within the range. # - # This cop has `AllowRegexpMatch` option and it is false by default because + # This cop has `AllowRegexpMatch` option and it is true by default because # `regexp.match?('string')` often used in block changes to the opposite result: # # [source,ruby]