rubocop: Why rescues are no-blind rescues are enforced and blind returns are not?

I’m really curios of reasoning why implicit rescues are considered bad, but at the same time implicit return is considered good?

First of all I believe cop should be renamed to Lint/RescueStandardErrorClass and it whould be either forcing to specify StandardError in case of blind rescues, or forcing the opposite - removing StandardError. And by default it should prefer blind style.

Otherwise, it’s absolutely not obvious why at the same time we enforce avoiding returns.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16

Most upvoted comments

Robocop represents a great tool for us here and one that we really appreciate.

It offered what we believed to be an exact interpretation of the Ruby Style Guide and has helped greatly to suggest standardisation in a non partisan fashion. The second that one starts to implement general override files for personal preference negates that and also means that one loses any real changes in opinion that we believed came from the RSG.

I don’t think that I’m unique in finding the suggestion to change a default that used to be perfectly good and hasn’t changed because of a change in RSG opinion to be odd and irksome now that previously good code is failing linting checks - particularly for such a well understood area.

Our approach is to never use override files. Overrides here need to be justified in comments so that they can be considered every time the code is reviewed and one member of the team may have a better take on how to meet the RSG so the comment approach is better. Doing it this way also doesn’t weaken the message that nobodies opinion in our team should outweigh through personal preference a well thought out argument from the RSG.