-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rubocop 0.58.0 errors on Rails/BulkChangeTable cop #6089
Labels
Comments
wata727
added a commit
to wata727/rubocop
that referenced
this issue
Jul 9, 2018
…le name Fixes rubocop#6089 The following error is occurred when using variables as table name: ``` NoMethodError: undefined method `value' for s(:lvar, :table):RuboCop::AST::Node # ./lib/rubocop/cop/rails/bulk_change_table.rb:258:in `process' # ./lib/rubocop/cop/rails/bulk_change_table.rb:144:in `block in on_def' # ./lib/rubocop/ast/node.rb:185:in `block in each_child_node' # ./lib/rubocop/ast/node.rb:183:in `each' # ./lib/rubocop/ast/node.rb:183:in `each_child_node' # ./lib/rubocop/cop/rails/bulk_change_table.rb:142:in `on_def' # ./lib/rubocop/cop/commissioner.rb:57:in `block (2 levels) in trigger_responding_cops' # ./lib/rubocop/cop/commissioner.rb:105:in `with_cop_error_handling' # ./lib/rubocop/cop/commissioner.rb:56:in `block in trigger_responding_cops' # ./lib/rubocop/cop/commissioner.rb:55:in `each' # ./lib/rubocop/cop/commissioner.rb:55:in `trigger_responding_cops' # ./lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>' # ./lib/rubocop/ast/traversal.rb:12:in `walk' # ./lib/rubocop/cop/commissioner.rb:45:in `investigate' # ./lib/rubocop/rspec/cop_helper.rb:71:in `_investigate' # ./lib/rubocop/rspec/cop_helper.rb:25:in `inspect_source' # ./lib/rubocop/rspec/expect_offense.rb:61:in `expect_no_offenses' # ./spec/rubocop/cop/rails/bulk_change_table_spec.rb:358:in `block (3 levels) in <top (required)>' ``` This problem occurs because the table name is not a literal node. It is very difficult to interpolate variables, so in that case this cop ignores such nodes.
8 tasks
bbatsov
pushed a commit
that referenced
this issue
Jul 10, 2018
…#6090) Fixes #6089 The following error is occurred when using variables as table name: ``` NoMethodError: undefined method `value' for s(:lvar, :table):RuboCop::AST::Node # ./lib/rubocop/cop/rails/bulk_change_table.rb:258:in `process' # ./lib/rubocop/cop/rails/bulk_change_table.rb:144:in `block in on_def' # ./lib/rubocop/ast/node.rb:185:in `block in each_child_node' # ./lib/rubocop/ast/node.rb:183:in `each' # ./lib/rubocop/ast/node.rb:183:in `each_child_node' # ./lib/rubocop/cop/rails/bulk_change_table.rb:142:in `on_def' # ./lib/rubocop/cop/commissioner.rb:57:in `block (2 levels) in trigger_responding_cops' # ./lib/rubocop/cop/commissioner.rb:105:in `with_cop_error_handling' # ./lib/rubocop/cop/commissioner.rb:56:in `block in trigger_responding_cops' # ./lib/rubocop/cop/commissioner.rb:55:in `each' # ./lib/rubocop/cop/commissioner.rb:55:in `trigger_responding_cops' # ./lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>' # ./lib/rubocop/ast/traversal.rb:12:in `walk' # ./lib/rubocop/cop/commissioner.rb:45:in `investigate' # ./lib/rubocop/rspec/cop_helper.rb:71:in `_investigate' # ./lib/rubocop/rspec/cop_helper.rb:25:in `inspect_source' # ./lib/rubocop/rspec/expect_offense.rb:61:in `expect_no_offenses' # ./spec/rubocop/cop/rails/bulk_change_table_spec.rb:358:in `block (3 levels) in <top (required)>' ``` This problem occurs because the table name is not a literal node. It is very difficult to interpolate variables, so in that case this cop ignores such nodes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actual behavior
Rubocop throws error during inspect on migration file:
Content of the file is:
RuboCop version
The text was updated successfully, but these errors were encountered: