diff --git a/changelog/change_disalbe_performance_casecmp_by_default.md b/changelog/change_disalbe_performance_casecmp_by_default.md new file mode 100644 index 0000000000..4aacf83881 --- /dev/null +++ b/changelog/change_disalbe_performance_casecmp_by_default.md @@ -0,0 +1 @@ +* [#240](https://github.com/rubocop/rubocop-performance/issues/240): Disable `Performance/Casecmp` cop by default. ([@parkerfinch][]) diff --git a/config/default.yml b/config/default.yml index a508a39827..c9a434625b 100644 --- a/config/default.yml +++ b/config/default.yml @@ -55,9 +55,10 @@ Performance/Casecmp: Description: >- Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`.. Reference: 'https://github.com/fastruby/fast-ruby#stringcasecmp-vs--stringcasecmp-vs-stringdowncase---code' - Enabled: true + Enabled: false Safe: false VersionAdded: '0.36' + VersionChanged: '<>' Performance/ChainArrayAllocation: Description: >- diff --git a/lib/rubocop/cop/performance/casecmp.rb b/lib/rubocop/cop/performance/casecmp.rb index 29471c7d59..268934e78b 100644 --- a/lib/rubocop/cop/performance/casecmp.rb +++ b/lib/rubocop/cop/performance/casecmp.rb @@ -6,6 +6,12 @@ module Performance # 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 # differently when using Non-ASCII characters.