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

MultilineIfThen raising NoMethodError `source_buffer' for nil:NilClass #316

Closed
yaauie opened this issue Jul 1, 2013 · 3 comments
Closed

Comments

@yaauie
Copy link
Contributor

yaauie commented Jul 1, 2013

Unfortunately I can't provide more than this stack trace at the moment; this is occurring in many places, and my brief attempts to isolate the offending code (e.g., one offending file only has one if statement, so I extracted it) have not reproduced the exception.

An error occurred while MultilineIfThen cop was inspecting /Users/yaauie/projects/scrubbed/lib/scrubbed.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.9.0 (using Parser 2.0.0.beta9, running on ruby 1.9.3 x86_64-darwin12.2.1)

With the following backtrace:

Scanning /Users/yaauie/projects/scrubbed/lib/scrubbed.rb
An error occurred while MultilineIfThen cop was inspecting /Users/yaauie/projects/scrubbed/lib/scrubbed.rb.
undefined method `source_buffer' for nil:NilClass
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cop/style/if_then_else.rb:53:in `offending_line'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cop/style/if_then_else.rb:21:in `check'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cop/style/if_then_else.rb:9:in `on_if'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:255:in `block in process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `map'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/parser-2.0.0.beta9/lib/parser/ast/processor.rb:6:in `process_regular_node'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/parser-2.0.0.beta9/lib/parser/ast/processor.rb:129:in `on_defs'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:255:in `block in process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `map'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/parser-2.0.0.beta9/lib/parser/ast/processor.rb:6:in `process_regular_node'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:255:in `block in process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `map'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/parser-2.0.0.beta9/lib/parser/ast/processor.rb:6:in `process_regular_node'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:255:in `block in process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `map'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/parser-2.0.0.beta9/lib/parser/ast/processor.rb:6:in `process_regular_node'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:255:in `block in process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `map'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:254:in `process_all'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/parser-2.0.0.beta9/lib/parser/ast/processor.rb:6:in `process_regular_node'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cop/cop.rb:67:in `inspect'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cli.rb:102:in `block in inspect_file'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `each'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `reduce'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `inspect_file'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cli.rb:55:in `block in run'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cli.rb:49:in `each'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/lib/rubocop/cli.rb:49:in `run'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/bin/rubocop:14:in `block in <top (required)>'
/Users/yaauie/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/gems/rubocop-0.9.0/bin/rubocop:13:in `<top (required)>'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/bin/rubocop:23:in `load'
/Users/yaauie/.rbenv/versions/1.9.3-p194/gemsets/scrubbed/bin/rubocop:23:in `<main>'
@edzhelyov
Copy link
Collaborator

Can you provide the content of scrubbed.rb file. This will allow me to reproduce the issue you have.

@yaauie
Copy link
Contributor Author

yaauie commented Jul 2, 2013

I cannot. I will further attempt to provide a reproduction when I get a chance later today.

@yaauie
Copy link
Contributor Author

yaauie commented Jul 2, 2013

Ok. I have a repro. This one is brought to you by "FOR THE LOVE OF ALL THAT IS HOLY, WHY!?"

# encoding: utf-8
condition_one = true
condition_two = false

if condition_two
  # do something
end unless condition_one

@bbatsov bbatsov closed this as completed in bd03881 Jul 2, 2013
bbatsov added a commit that referenced this issue Jul 2, 2013
Fix multiline if special case with postfix unless #316
edzhelyov added a commit that referenced this issue Jul 2, 2013
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

2 participants