Closed scottmatthewman closed 6 years ago
@scottmatthewman I opened a PR #6335 that wrote the reproduction test and the patch. Thanks to what you were detailed investigating, the fix was straightforward. I write your account both credit in the changelog. Thank you!
Thanks, @koic!
I'm in the process of updating some gem dependencies in a long-standing Rails 4.2 project. One of these is RuboCop: we have been on v0.52.1 for a while.
Upon updating to the latest (v0.52.9), running
rubocop --auto-gen-config
against the full code base crashed out.As you can see from the (partially obfuscated) file path, this is a migration that dates from 2014, and which previously has been able to be parsed successfully until now.
The file itself that causes the error:
However, if I create a test using this migration code in reversible_migration_spec.rb, this passes without crashing:
Using
git bisect
, I can establish that this particular migration file was parsed correctly until 4c68d5b226ebeba8284719078d13476f0641c6f2 (Remove Node#method_name in favour of node extensions). Given the commit message it does seem like they're related, but I don't know enough aboutNode
or node extensions to immediately say why or how the issue is arising in a genuine file, but not in an RSpec test.Expected behavior
The Rails/ReversibleMigration cop should be run against the file concerned and not crash (actual output may vary depending on RuboCop config settings):
Actual behavior
The cop crashes:
RuboCop version