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

SpaceInsideStringInterpolation cop fails with empty interpolation #2129

Closed
tfausak opened this issue Aug 10, 2015 · 0 comments
Closed

SpaceInsideStringInterpolation cop fails with empty interpolation #2129

tfausak opened this issue Aug 10, 2015 · 0 comments

Comments

@tfausak
Copy link

tfausak commented Aug 10, 2015

# example.rb
"#{}"
> rubocop -d example.rb
Inspecting 1 file
Scanning /private/tmp/example.rb
For /private/tmp: configuration from .../.gem/ruby/2.2.2/gems/rubocop-0.33.0/config/default.yml
Inheriting configuration from .../.gem/ruby/2.2.2/gems/rubocop-0.33.0/config/enabled.yml
Inheriting configuration from .../.gem/ruby/2.2.2/gems/rubocop-0.33.0/config/disabled.yml
An error occurred while Style/SpaceInsideStringInterpolation cop was inspecting /private/tmp/example.rb.
undefined method `loc' for nil:NilClass
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/cop/style/space_inside_string_interpolation.rb:24:in `block in on_dstr'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/cop/style/space_inside_string_interpolation.rb:21:in `each'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/cop/style/space_inside_string_interpolation.rb:21:in `on_dstr'
(eval):5:in `block (2 levels) in on_dstr'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/cop/commissioner.rb:92:in `with_cop_error_handling'
(eval):4:in `block in on_dstr'
(eval):2:in `each'
(eval):2:in `on_dstr'
.../.gem/ruby/2.2.2/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/cop/commissioner.rb:52:in `investigate'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/cop/team.rb:33:in `inspect_file'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:135:in `inspect_file'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:106:in `block in do_inspection_loop'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:100:in `loop'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:100:in `do_inspection_loop'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:78:in `process_file'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:53:in `block in inspect_files'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:51:in `each'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:51:in `inspect_files'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/runner.rb:30:in `run'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/lib/rubocop/cli.rb:26:in `run'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/bin/rubocop:13:in `block in <top (required)>'
.../.rubies/ruby-2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
.../.gem/ruby/2.2.2/gems/rubocop-0.33.0/bin/rubocop:12:in `<top (required)>'
.../.gem/ruby/2.2.2/bin/rubocop:23:in `load'
.../.gem/ruby/2.2.2/bin/rubocop:23:in `<main>'
W

Offenses:

example.rb:2:2: W: Lint/EmptyInterpolation: Empty interpolation detected.
"#{}"
 ^^^

1 file inspected, 1 offense detected

1 error occurred:
An error occurred while Style/SpaceInsideStringInterpolation cop was inspecting /private/tmp/example.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
Mention the following information in the issue report:
0.33.0 (using Parser 2.2.2.6, running on ruby 2.2.2 x86_64-darwin14)
Finished in 0.023413064999658673 seconds

https://github.com/bbatsov/rubocop/blob/490c6af5068b61c0292ccc2850eabf6723cdd619/lib/rubocop/cop/style/space_inside_string_interpolation.rb#L22-L24

bbatsov added a commit that referenced this issue Aug 10, 2015
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

1 participant