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 Lint/DeprecatedConstants cop #9324

Merged
merged 1 commit into from
Jan 5, 2021

Commits on Jan 5, 2021

  1. Add new Lint/DeprecatedConstants cop

    This PR adds new `Lint/DeprecatedConstants` cop.
    
    This cop checks for deprecated constants.
    
    It has `DeprecatedConstants` config. If there is an alternative method,
    you can set alternative value as `Alternative`.
    And you can set the deprecated version as `DeprecatedVersion`.
    These options can be omitted if they are not needed.
    By default, `NIL`, `TRUE`, `FALSE` and `Random::DEFAULT` are configured.
    
    ```ruby
    # bad
    NIL
    TRUE
    FALSE
    Random::DEFAULT # Return value of Ruby 2 is `Random` instance, Ruby 3.0 is `Random` class.
    
    # good
    nil
    true
    false
    Random.new # `::DEFAULT` has been deprecated in Ruby 3, `.new` is compatible with Ruby 2.
    ```
    
    The following are these sources of information.
    
    - Remove (deprecated) `NIL`, `TRUE`, and `FALSE` ... ruby/ruby@62554ca
    - Deprecate `Random::DEFAULT` ... https://bugs.ruby-lang.org/issues/17351
    koic committed Jan 5, 2021
    Configuration menu
    Copy the full SHA
    b95afa7 View commit details
    Browse the repository at this point in the history