fcsonline / rubocop-changes

Runs rubocop and shows only the offenses you introduced since the fork point
https://rubygems.org/gems/rubocop-changes
MIT License
21 stars 9 forks source link

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

Open Jauvil opened 3 months ago

Jauvil commented 3 months ago

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:inrubocop_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 commented 1 month ago

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