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
Thanks, @gotrevor for the analysis. I'm working on this problem already, but hadn't gotten down to VariableForce#investigate yet. I'll take your views in to consideration, and will make a PR soon.
To answer your question, I think it is reasonable for EndKeywordAlignment#align to expect that nodes given to it as the base for alignment have a loc attribute. When the node turns out to be a "fake" begin node, then it's the caller that's in error.
Using this file (
crash.rb
) as input:With this option enabled:
I get the following crash:
I've tracked the problem down to the method
investigate
here:https://github.com/bbatsov/rubocop/blob/v0.32.1/lib/rubocop/cop/variable_force.rb#L71-L79
processed_source
enters withit exists with
This causes the crash here:
https://github.com/bbatsov/rubocop/blob/v0.32.1/lib/rubocop/cop/mixin/end_keyword_alignment.rb#L49
Which assumes that a non-nil node will have a
loc
. Is that a valid assumption?I suspect that
VariableForce#investigate
shouldn't be mutatingprocessed_source.ast
.Am I right about that?
The text was updated successfully, but these errors were encountered: