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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix load error with REXML document #1699

Open
bkuhlmann opened this issue Feb 5, 2023 · 3 comments
Open

Fix load error with REXML document #1699

bkuhlmann opened this issue Feb 5, 2023 · 3 comments
Assignees

Comments

@bkuhlmann
Copy link

bkuhlmann commented Feb 5, 2023

Overview

Hello. 馃憢 I stumbled across an issue where I can't include Reek as a gem unless RuboCop is also required. I can see that Reek::Report::XMLReport requires rexml/document but there appears to be an order of operation issue where REXML isn't loaded in time.

Steps to Recreate

You can run the following script to reproduce:

#! /usr/bin/env ruby
# frozen_string_literal: true

# Save as `snippet`, then `chmod 755 snippet`, and run as `./snippet`.

require "bundler/inline"

gemfile true do
  source "https://rubygems.org"
  gem "reek"
end

puts "Failed to make it here. 馃槩"

Upon running ./snippet, I'll get the following output:

Stack Dump
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Using ast 2.4.2
Using bundler 2.4.6
Using kwalify 0.7.2
Using rainbow 3.1.1
Using parser 3.2.0.0
Using reek 6.1.4
<internal:/Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require': cannot load such file -- rexml/document (LoadError)
	from <internal:/Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek/report/xml_report.rb:13:in `<class:XMLReport>'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek/report/xml_report.rb:12:in `<module:Report>'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek/report/xml_report.rb:6:in `<module:Reek>'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek/report/xml_report.rb:5:in `<top (required)>'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek/report.rb:6:in `require_relative'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek/report.rb:6:in `<top (required)>'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek.rb:8:in `require_relative'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/gems/3.2.0/gems/reek-6.1.4/lib/reek.rb:8:in `<top (required)>'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:60:in `require'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:55:in `each'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:55:in `block in require'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:44:in `each'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:44:in `require'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/inline.rb:66:in `block (2 levels) in gemfile'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/settings.rb:131:in `temporary'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/inline.rb:51:in `block in gemfile'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler.rb:418:in `block in with_unbundled_env'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler.rb:664:in `with_env'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler.rb:418:in `with_unbundled_env'
	from /Users/bkuhlmann/.cache/frum/versions/3.2.0/lib/ruby/site_ruby/3.2.0/bundler/inline.rb:42:in `gemfile'
	from /Users/bkuhlmann/Engineering/Misc/snippet:8:in `<main>'

Environment

  • Ruby: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [arm64-darwin22.2.0]
  • Reek: 6.1.4
@mvz
Copy link
Collaborator

mvz commented Feb 6, 2023

Thanks, @bkuhlmann. We probably missed this because RuboCop is part of the bundle in development.

@mvz mvz self-assigned this Feb 6, 2023
@hakanai
Copy link

hakanai commented Feb 7, 2023

I found this independently on our project the other day but had forgotten to come here and report it. 馃槀

Worked fine after adding rexml to our Gemfile, so that seems to be the only missing dependency.

@fbuys
Copy link
Contributor

fbuys commented Oct 6, 2023

Hey @mvz this dependency was added: https://github.com/troessner/reek/pull/1703/files
But it does not seem like it is included in the 6.1.4 release: https://github.com/troessner/reek/blob/v6.1.4/reek.gemspec
We should probably release a new minor version with rexml included.

Also, we did not add anything about it to the CHANGELOG.
So I wonder if we should add a note about it to the CHANGELOG.

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

4 participants