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

Fix Violations of and Reenable Style/RescueModifier #57847

Merged
merged 4 commits into from
Apr 16, 2024

Commits on Apr 5, 2024

  1. Fix Violations of and Reenable Style/RescueModifier

    [The official Ruby Style guide](https://rubystyle.guide/#no-rescue-modifiers) recommends
    avoiding the use of `rescue` in its modifier form. It does somewhat beg the question of
    why include a modifier form in the first place, but that's just by the by.
    
    Quoting from Rubocop documentation, this rule:
    
    > Checks for uses of `rescue` in its modifier form is added for following reasons:
    >
    > - The syntax of modifier form `rescue` can be misleading because it might lead us to
    >   believe that `rescue` handles the given exception but it actually rescue all exceptions
    >   to return the given rescue block. In this case, value returned by handle_error or
    >   SomeException.
    >
    > - Modifier form`‘rescue` would rescue all the exceptions. It would silently skip all
    >   exception or errors and handle the error.  Example: If `NoMethodError` is raised,
    >   modifier form rescue would handle the exception.
    
    Initial fix applied automatically with `bundle exec rubocop --autocorrect-all --only
    Style/RescueModifier`; I then manually ran a few more autocorrect commands to fix up some
    of the indentation and layout errors produced by the initial autocorrection.
    
    - https://rubystyle.guide/#no-rescue-modifiers
    - https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RescueModifier
    - https://docs.rubocop.org/rubocop/cops_style.html#stylerescuemodifier
    Hamms committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    652edcf View commit details
    Browse the repository at this point in the history

Commits on Apr 12, 2024

  1. Configuration menu
    Copy the full SHA
    33994f7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7d9ebb9 View commit details
    Browse the repository at this point in the history
  3. Manually update one instance of an inlined rescue modifier

    To match what we believe the original intent was, rather than to
    preverse existing (and likely broken) original functionality.
    
    See the commit that introduced this behavior for more context:
    d04d412
    Hamms committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    1465f1c View commit details
    Browse the repository at this point in the history