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

Lint/RequireRelativeSelfPath crash if require_relative is called with a variable instead of a string literal #10143

Closed
ntkme opened this issue Sep 29, 2021 · 0 comments · Fixed by #10146
Labels

Comments

@ntkme
Copy link

ntkme commented Sep 29, 2021

Input:

Dir['test/**/test_*.rb'].each { |f| require_relative f }

Error:

An error occurred while Lint/RequireRelativeSelfPath cop was inspecting /build/test.rb:1:36.
undefined method `value' for s(:lvar, :f):RuboCop::AST::Node

return unless same_file?(processed_source.file_path, required_feature.value)

@koic koic added the bug label Sep 29, 2021
koic added a commit to koic/rubocop that referenced this issue Sep 29, 2021
Fixes rubocop#10143.

This PR fixes an error for `Lint/RequireRelativeSelfPath`
when using a variable as an argument of `require_relative`.
koic added a commit that referenced this issue Sep 29, 2021
…ative_self_path

[Fix #10143] Fix an error for `Lint/RequireRelativeSelfPath`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants