Skip to content
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

Rails 6.1.4: An error occurred while Rails/BulkChangeTable cop was inspecting #515

Closed
pawneetdev opened this issue Jul 1, 2021 · 0 comments · Fixed by #516
Closed

Rails 6.1.4: An error occurred while Rails/BulkChangeTable cop was inspecting #515

pawneetdev opened this issue Jul 1, 2021 · 0 comments · Fixed by #516
Assignees
Labels
bug Something isn't working

Comments

@pawneetdev
Copy link

Getting the following error in all create migration with Rails 6.1.4:

5 errors occurred:
An error occurred while Rails/BulkChangeTable cop was inspecting /Users/pawneets/Star-Apps/test_app/db/migrate/20210701062815_create_my_models.rb:3:23.
An error occurred while Rails/BulkChangeTable cop was inspecting /Users/pawneets/Star-Apps/test_app/db/migrate/20210701062815_create_my_models.rb:4:2.
An error occurred while Rails/BulkChangeTable cop was inspecting /Users/pawneets/Star-Apps/test_app/db/migrate/20210701062815_create_my_models.rb:5:4.
An error occurred while Rails/BulkChangeTable cop was inspecting /Users/pawneets/Star-Apps/test_app/db/migrate/20210701062815_create_my_models.rb:6:6.
An error occurred while Rails/BulkChangeTable cop was inspecting /Users/pawneets/Star-Apps/test_app/db/migrate/20210701062815_create_my_models.rb:8:6.

Expected behavior

No warnings should be reported.

Actual behavior

After upgrading to Rails 6.1.4, I am getting this error. Following are the debug logs:

An error occurred while Rails/BulkChangeTable cop was inspecting /Users/pawneets/Star-Apps/test_app/db/migrate/20210701062815_create_my_models.rb:8:6.
Unknown alias: default
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each_slice'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `revive_hash'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each_slice'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `revive_hash'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych.rb:335:in `safe_load'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych.rb:370:in `load'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych.rb:671:in `block in load_file'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych.rb:670:in `open'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/psych-4.0.1/lib/psych.rb:670:in `load_file'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-rails-2.11.1/lib/rubocop/cop/rails/bulk_change_table.rb:197:in `database_yaml'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-rails-2.11.1/lib/rubocop/cop/rails/bulk_change_table.rb:184:in `database_from_yaml'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-rails-2.11.1/lib/rubocop/cop/rails/bulk_change_table.rb:180:in `database'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-rails-2.11.1/lib/rubocop/cop/rails/bulk_change_table.rb:209:in `support_bulk_alter?'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-rails-2.11.1/lib/rubocop/cop/rails/bulk_change_table.rb:153:in `on_send'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:100:in `public_send'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:100:in `block (2 levels) in trigger_responding_cops'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:160:in `with_cop_error_handling'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:99:in `block in trigger_responding_cops'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:98:in `each'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:98:in `trigger_responding_cops'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:69:in `on_send'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:137:in `each'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:158:in `on_block'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:71:in `on_block'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:154:in `on_def'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:71:in `on_def'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:154:in `on_class'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:71:in `on_class'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:20:in `walk'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/commissioner.rb:86:in `investigate'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/team.rb:155:in `investigate_partial'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cop/team.rb:83:in `investigate'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:310:in `inspect_file'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:254:in `block in do_inspection_loop'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:288:in `block in iterate_until_no_changes'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:281:in `loop'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:281:in `iterate_until_no_changes'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:250:in `do_inspection_loop'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:130:in `block in file_offenses'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:155:in `file_offense_cache'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:129:in `file_offenses'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:120:in `process_file'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:100:in `each'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:100:in `reduce'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:100:in `each_inspected_file'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:86:in `inspect_files'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/runner.rb:47:in `run'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli/command.rb:11:in `run'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli/environment.rb:18:in `run'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli.rb:65:in `run_command'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/lib/rubocop/cli.rb:41:in `run'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/exe/rubocop:12:in `block in <top (required)>'
/Users/pawneets/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/benchmark.rb:308:in `realtime'
/Users/pawneets/.rvm/gems/ruby-3.0.1/gems/rubocop-1.18.1/exe/rubocop:12:in `<top (required)>'
/Users/pawneets/.rvm/gems/ruby-3.0.1/bin/rubocop:23:in `load'
/Users/pawneets/.rvm/gems/ruby-3.0.1/bin/rubocop:23:in `<main>'

Steps to reproduce the problem

  1. Create an app with Ruby version 3.0.1 and Rails version 6.1.4
  2. Add rubocop-rails in require block of .rubocop.yml
  3. Create a create-migaration the following migration:
class CreateMyModels < ActiveRecord::Migration[6.1]
  def change
    create_table :my_models do |t|
      t.string :name

      t.timestamps
    end
  end
end

RuboCop version

1.18.1 (using Parser 3.0.1.1, rubocop-ast 1.7.0, running on ruby 3.0.1 x86_64-darwin19)
  - rubocop-performance 1.11.3
  - rubocop-rails 2.11.1
  - rubocop-rspec 2.4.0

@koic koic added the bug Something isn't working label Jul 1, 2021
@koic koic self-assigned this Jul 1, 2021
koic added a commit to koic/rubocop-rails that referenced this issue Jul 1, 2021
Fixes rubocop#515
Follow up ruby/psych#487 and rails/rails@255b5ff

This PR fixes an error for `Rails/BulkChangeTable` when using Psych 4.0.
koic added a commit to koic/rubocop-rails that referenced this issue Jul 1, 2021
Fixes rubocop#515
Follow up ruby/psych#487 and rails/rails@255b5ff

This PR fixes an error for `Rails/BulkChangeTable` when using Psych 4.0.
koic added a commit to koic/rubocop-rails that referenced this issue Jul 1, 2021
Fixes rubocop#515
Follow up ruby/psych#487 and rails/rails@255b5ff

This PR fixes an error for `Rails/BulkChangeTable` when using Psych 4.0.
@koic koic closed this as completed in #516 Jul 1, 2021
koic added a commit that referenced this issue Jul 1, 2021
[Fix #515] Fix an error for `Rails/BulkChangeTable`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants