Skip to content

Commit

Permalink
Improve documentation for Style/EvalWithLocation cop
Browse files Browse the repository at this point in the history
Add description and example code for the case that a string variable
is given as a code string.
  • Loading branch information
taichi-ishitani authored and bbatsov committed Feb 14, 2021
1 parent 6cdce3b commit fcb3a94
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#9405](https://github.com/rubocop-hq/rubocop/pull/9405): Improve documentation for `Style/EvalWithLocation` cop. ([@taichi-ishitani][])
12 changes: 12 additions & 0 deletions lib/rubocop/cop/style/eval_with_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ module Style
# def do_something
# end
# RUBY
#
# This cop works only when a string literal is given as a code string.
# No offence is reported if a string variable is given as below:
#
# @example
# # not checked
# code = <<-RUBY
# def do_something
# end
# RUBY
# eval code
#
class EvalWithLocation < Base
extend AutoCorrector

Expand Down

0 comments on commit fcb3a94

Please sign in to comment.