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/ConstantOverwrittenInRescue cop #10722

Merged
merged 1 commit into from Jun 20, 2022

Commits on Jun 20, 2022

  1. Add new Lint/ConstantOverwrittenInRescue cop

    This PR is add a new cop.
    Checks for overwriting an exception with an exception result by use `rescue =>`.
    
    You intended to write as `rescue StandardError`.
    However, you have written `rescue => StandardError`.
    In that case, the result of `rescue` will overwrite `StandardError`.
    
    ## @example
    
    ```ruby
    # bad
    begin
      something
    rescue => StandardError
    end
    
    # good
    begin
      something
    rescue StandardError
    end
    ```
    ydah committed Jun 20, 2022
    Copy the full SHA
    a24174a View commit details
    Browse the repository at this point in the history