Skip to content

Commit

Permalink
Merge pull request #443 from koic/disalbe_performance_casecmp_by_default
Browse files Browse the repository at this point in the history
[Fix #240] Disable `Performance/Casecmp` cop
  • Loading branch information
koic authored Feb 17, 2024
2 parents dd698b2 + 4dc1e5c commit 08ac312
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/change_disalbe_performance_casecmp_by_default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#240](https://github.com/rubocop/rubocop-performance/issues/240): Disable `Performance/Casecmp` cop by default. ([@parkerfinch][])
3 changes: 2 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<<next>>'

Performance/ChainArrayAllocation:
Description: >-
Expand Down
6 changes: 6 additions & 0 deletions lib/rubocop/cop/performance/casecmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 08ac312

Please # to comment.