-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Style/EvalWithLocation
could auto-correct
#9403
Comments
For it 'registers an offense when using `#eval` without any arguments' do
expect_offense(<<~RUBY)
eval <<-CODE
^^^^^^^^^^^^ Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.
do_something
CODE
RUBY Without binding, there would be an error: eval(<<~CODE, __FILE__, __LINE__ + 1)
raise 'test error in eval'
CODE
# Traceback (most recent call last):
# 1: from sample.rb:3:in `<main>'
# sample.rb:3:in `eval': no implicit conversion of Integer into String (TypeError) I think this should be fixed first before adding auto-correct. |
I opened #9409 to fix the offense messages for this cop. |
I can take a stab at this issue this weekend if no one else has gotten a start on it. |
Sounds good, I'll wait for those to get merged before submitting a PR. |
The cop
Style/EvalWithLocation
could autocorrect:The text was updated successfully, but these errors were encountered: