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

lib/rubocop/changes/checker.rb needs require 'ostruct' #14

Open
Jauvil opened this issue Jun 6, 2024 · 2 comments
Open

lib/rubocop/changes/checker.rb needs require 'ostruct' #14

Jauvil opened this issue Jun 6, 2024 · 2 comments

Comments

@Jauvil
Copy link

Jauvil commented Jun 6, 2024

After an automated dependabot update in a project that uses this gem, I began getting the following error:
% bundle exec rubocop-changes -b develop --format github /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/gems/rubocop-changes-0.8.1/lib/rubocop/changes/checker.rb:104:in rubocop_json': uninitialized constant Rubocop::Changes::Checker::OpenStruct (NameError)

    @rubocop_json ||= JSON.parse(rubocop, object_class: OpenStruct)
                                                        ^^^^^^^^^^
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/gems/rubocop-changes-0.8.1/lib/rubocop/changes/checker.rb:109:in `block in checks'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/gems/rubocop-changes-0.8.1/lib/rubocop/changes/checker.rb:108:in `map'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/gems/rubocop-changes-0.8.1/lib/rubocop/changes/checker.rb:108:in `checks'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/gems/rubocop-changes-0.8.1/lib/rubocop/changes/checker.rb:127:in `print_offenses!'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/gems/rubocop-changes-0.8.1/lib/rubocop/changes/checker.rb:30:in `run'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/gems/rubocop-changes-0.8.1/exe/rubocop-changes:17:in `<top (required)>'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/bin/rubocop-changes:25:in `load'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/bin/rubocop-changes:25:in `<main>'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/bin/ruby_executable_hooks:22:in `eval'
from /Users/justin.auvil/.rvm/gems/ruby-3.1.3@erp/bin/ruby_executable_hooks:22:in `<main>'`

Seems like an issue with OpenStruct needing to be required in the checker class. I've rebuilt the gem locally adding the requirement, and no issues. Attempted to create a PR but couldn't.

@syamnich
Copy link

Any updates on this issue? Is the gem is still being maintained?

@zacheryph
Copy link

One way around this is via RUBYOPT

env RUBYOPT="-rostruct" bundle exec rubocop-changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants