`Style/EvalWithLocation` could auto-correct #9403
Closed
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
RUBYWithout 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. |
ceteece
added a commit
to ceteece/rubocop
that referenced
this issue
Jan 28, 2021
ceteece
added a commit
to ceteece/rubocop
that referenced
this issue
Jan 30, 2021
ceteece
added a commit
to ceteece/rubocop
that referenced
this issue
Jan 30, 2021
ceteece
added a commit
to ceteece/rubocop
that referenced
this issue
Jan 30, 2021
ceteece
added a commit
to ceteece/rubocop
that referenced
this issue
Jan 30, 2021
ceteece
added a commit
to ceteece/rubocop
that referenced
this issue
Jan 30, 2021
bbatsov
added a commit
that referenced
this issue
Feb 12, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The cop
Style/EvalWithLocationcould autocorrect:The text was updated successfully, but these errors were encountered: