You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add RuboCop::Node::Traversal (to traverse AST without mutating it)
When AST::Processor calls a hook, it takes the return value as an updated
node and tries building a modified AST. We don't want to do this.
Closesrubocop#7624 and rubocop#7774.
This PR supports pattern match for `Layout/ElseAlignment` cop.
Also this resolves the crash reported in rubocop#7624 and rubocop#7774 for
using Ruby 2.7's pattern match.
Following code
produces such AST (with
Parser::CurrentRuby.parse
, usingParser::Ruby27
parser gem version:2.7.0.1
):Second children of the
in_pattern
s-expression isnil
, which leads toerror on line https://github.com/rubocop-hq/rubocop/blob/master/lib/rubocop/ast/traversal.rb#L57
Simplest fix (maksar@db9f1cf) for me was adding
.compact
, but I'm not sure it is the right thing to do.Issue is reproducible with current master (019fe5e)
The text was updated successfully, but these errors were encountered: