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

An error occurred while Rails/BulkChangeTable cop was inspecting #947

Closed
nroose opened this issue Mar 8, 2023 · 1 comment
Closed

An error occurred while Rails/BulkChangeTable cop was inspecting #947

nroose opened this issue Mar 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@nroose
Copy link

nroose commented Mar 8, 2023

Expected behavior

Inspect the file without an error

Actual behavior

The parser/inspecter got an error:

n error occurred while Rails/BulkChangeTable cop was inspecting /Users/nroose/work/db/migrate/20230308165236_test.rb:1:13.                                        
For /Users/nroose/work/: configuration from /Users/nroose/work/.rubocop.yml                                                                         
configuration from /Users/nroose/.rvm/gems/ruby-3.1.3/gems/rubocop-performance-1.14.0/config/default.yml                                                                           
configuration from /Users/nroose/.rvm/gems/ruby-3.1.3/gems/rubocop-performance-1.14.0/config/default.yml                                                                           
Default configuration from /Users/nroose/.rvm/gems/ruby-3.1.3/gems/rubocop-1.48.0/config/default.yml                                                                               
configuration from /Users/nroose/.rvm/gems/ruby-3.1.3/gems/rubocop-rails-2.9.1/config/default.yml                                                                                  
configuration from /Users/nroose/.rvm/gems/ruby-3.1.3/gems/rubocop-rails-2.9.1/config/default.yml                                                                                  
configuration from /Users/nroose/.rvm/gems/ruby-3.1.3/gems/rubocop-rspec-2.11.1/config/default.yml                                                                                 
configuration from /Users/nroose/.rvm/gems/ruby-3.1.3/gems/rubocop-rspec-2.11.1/config/default.yml                                                                                 
Use parallel by default.                                                                                                                                                           
Skipping parallel inspection: only a single file needs inspection                                                                                                                  
Inspecting 1 file                                                                                                                                                                  
Scanning /Users/nroose/work/db/migrate/20230308165236_test.rb                                                                                                      
Unknown alias: default                                                                                                                                                             
/Users/nroose/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias'                                                                     

Steps to reproduce the problem

Create a migration file:

class Test < ActiveRecord::Migration[7.0]
  def change
    ActiveRecord::Base.connection.execute(
      <<~SQL.squish
        ALTER TABLE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
      SQL
    )
  end
end

Run

rubocop -d db/migrate/20230308165236_test.rb

RuboCop version

$ rubocop -V
1.48.0 (using Parser 3.2.1.1, rubocop-ast 1.27.0, running on ruby 3.1.3) [x86_64-darwin22]
  - rubocop-performance 1.14.0
  - rubocop-rails 2.9.1
  - rubocop-rspec 2.11.1
@koic koic transferred this issue from rubocop/rubocop Mar 8, 2023
@koic koic added the bug Something isn't working label Mar 14, 2023
@koic
Copy link
Member

koic commented Mar 29, 2023

This issue has been resolved by #516. Please upgrade RuboCop Rails to the latest version (2.18).

@koic koic closed this as completed Mar 29, 2023
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