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

Add new Rails/WhereEquals cop #362

Merged
merged 1 commit into from
Sep 26, 2020
Merged

Commits on Sep 21, 2020

  1. Add new Rails/WhereEquals cop

    This complements the existing `Rails/WhereNot` cop, so that simple
    equality and inequality conditions are corrected in the same way.
    
    For example, code like this:
    
        scope :incomplete, -> { where('completed_at IS NULL') }
        scope :complete, -> { where('completed_at IS NOT NULL') }
    
    Will now be autocorrected to:
    
        scope :incomplete, -> { where(completed_at: nil) }
        scope :complete, -> { where.not(completed_at: nil) }
    
    Instead of:
    
        scope :incomplete, -> { where('completed_at IS NULL') }
        scope :complete, -> { where.not(completed_at: nil) }
    eugeneius committed Sep 21, 2020
    Configuration menu
    Copy the full SHA
    d4bd05f View commit details
    Browse the repository at this point in the history