Skip to content

Support for Ruby 2.4 casecmp? method #100

@alejandrovelez7

Description

@alejandrovelez7

Is your feature request related to a problem? Please describe.

The suggestion for casecmp can be updated to use the newer Ruby 2.4 method casecmp? instead of casecmp.zero? which requires the user to know the contract for the casecmp method. The ? variation returns truthy or falsy values and is more succinct.

Example:
str.casecmp('ABC').zero? vs. str.casecmp?('ABC')

Describe the solution you'd like

Would it be possible to include casecmp? as a potential Good alternative in the casecmp cop?

Describe alternatives you've considered

Removing the .zero? variation completely might not be preferable if we are supporting versions of Ruby before 2.4.

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions