Skip to content

Commit 08ac312

Browse files
authored
Merge pull request #443 from koic/disalbe_performance_casecmp_by_default
[Fix #240] Disable `Performance/Casecmp` cop
2 parents dd698b2 + 4dc1e5c commit 08ac312

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#240](https://github.com/rubocop/rubocop-performance/issues/240): Disable `Performance/Casecmp` cop by default. ([@parkerfinch][])

config/default.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ Performance/Casecmp:
5555
Description: >-
5656
Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
5757
Reference: 'https://github.com/fastruby/fast-ruby#stringcasecmp-vs--stringcasecmp-vs-stringdowncase---code'
58-
Enabled: true
58+
Enabled: false
5959
Safe: false
6060
VersionAdded: '0.36'
61+
VersionChanged: '<<next>>'
6162

6263
Performance/ChainArrayAllocation:
6364
Description: >-

lib/rubocop/cop/performance/casecmp.rb

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ module Performance
66
# Identifies places where a case-insensitive string comparison
77
# can better be implemented using `casecmp`.
88
#
9+
# This cop is disabled by default because `String#casecmp` only works with
10+
# ASCII characters. See https://github.com/rubocop/rubocop/issues/9753.
11+
#
12+
# If you are working only with ASCII characters, then this cop can be
13+
# safely enabled.
14+
#
915
# @safety
1016
# This cop is unsafe because `String#casecmp` and `String#casecmp?` behave
1117
# differently when using Non-ASCII characters.

0 commit comments

Comments
 (0)