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 EnforcedStyle for Style/DoubleNegation cop #7985

Merged

Commits on May 17, 2020

  1. Add EnforcedStyle for Style/DoubleNegation cop

    This PR adds `EnforcedStyle` option for `Style/DoubleNegation` cop,
    and `EnforcedStyle: allowed_in_boolean_context` by default based on rubocop#7833 survey.
    
    ```ruby
    # @example EnforcedStyle: allowed_in_boolean_context (default)
    #   # good
    #   def foo?
    #     !!return_value
    #   end
    #
    # @example EnforcedStyle: always
    #   # bad
    #   def foo?
    #     !!return_value
    #   end
    ```
    
    Ruby will return the last evaluated value.
    
    This PR only supports simple contexts, such as the end of line value of
    method, and when using `return`.
    A complex contexts should also be supported, such as when branching with
    `if` and others in the future.
    koic committed May 17, 2020
    Copy the full SHA
    9d19019 View commit details
    Browse the repository at this point in the history