style guide doesn't follow Style/RescueStandardError
This issue has 2 parts
- Style/RescueStandardError isn't represented at all in the style guide
- In particular, https://github.com/bbatsov/ruby-style-guide/tree/2c0b4713794ea07a70ca4e1dee81405350fa7544#no-blind-rescues shows that
rescue => eis "good", but this line would fail against Style/RescueStandardError 's default of "explicit".
Since this cop has 2 choices (implicit and explicit), I'm not sure how to make a PR for this change to show that it's "bad" with defaults, but "good" with changes (not even sure the guide cares about those choices)
What about just adding a comment to the code:
# good, if Style/RescueStandardError is set to "implicit"
begin
# a blind rescue rescues from StandardError, not Exception as many
# programmers assume.
rescue => e
# exception handling
end
That section of the README was primarily written with regard to rescue Exception, so I think there is certainly some value in highlighting why rescue => e is typically OK - and does not violate the above.
Style/RescueStandardError isn't represented at all in the style guide
I guess we'll have to change that and add a rule about it here. :-)
good, if Style/RescueStandardError is set to "implicit"
I've avoided adding any references to specific cops in the guide, as I want it to be focused on the code itself, not on the tools.