overcommit icon indicating copy to clipboard operation
overcommit copied to clipboard

FYI: unable to determine line number or type of error/warning for output: lockfile.rb

Open bmulholland opened this issue 2 years ago • 4 comments

https://github.com/rubocop/rubocop/issues/12823 seems to cause an obscure error:

Unexpected output: unable to determine line number or type of error/warning for output:
/Users/bmulholland/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rubocop-1.63.0/lib/rubocop/lockfile.rb:66:in `rescue in parser'
/Users/bmulholland/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rubocop-1.63.0/lib/rubocop/lockfile.rb:60:in `parser'

Looks like they intend to fix that, but this error only happened on pre-commit hooks in overcommit, so posting here as an FYI.

bmulholland avatar Apr 09 '24 15:04 bmulholland

As a workaround I made rubocop run using bundle exec with the config at https://github.com/sds/overcommit?tab=readme-ov-file#configuration

bmulholland avatar Apr 09 '24 15:04 bmulholland

I also encountered this today - is there anything else to try ?

ms-ati avatar Dec 04 '24 18:12 ms-ati

@ms-ati yes, see the workaround I posted

bmulholland avatar Dec 04 '24 19:12 bmulholland

The underlying RuboCop 1.63.0 crash linked in this report was fixed upstream in rubocop/rubocop#12826 and released in RuboCop 1.63.1. The release notes explicitly identify the uninitialized RuboCop::Lockfile::Bundler error when running without bundle exec.

I checked the upstream fix and release, and current Overcommit runs the RuboCop hook successfully with RuboCop 1.77.0 in local testing and CI. Please update the project's RuboCop version; command: ['bundle', 'exec', 'rubocop'] remains useful for selecting the project's locked version. Closing as already fixed upstream.

sds avatar Nov 10 '26 05:11 sds