Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #240] Disable Performance/Casecmp cop #443

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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