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

Error in Layout/EmptyLineAfterMultilineCondition #8674

Closed
zhuravel opened this issue Sep 9, 2020 · 0 comments · Fixed by #8675
Closed

Error in Layout/EmptyLineAfterMultilineCondition #8674

zhuravel opened this issue Sep 9, 2020 · 0 comments · Fixed by #8675

Comments

@zhuravel
Copy link
Contributor

zhuravel commented Sep 9, 2020

Layout/EmptyLineAfterMultilineCondition cop fails while inspecting such code:

Rails.backtrace_cleaner.remove_silencers! if ENV['CI']

cc @fatkodima


Expected behavior

No error.

Actual behavior

$ be rubocop -d --only Layout/EmptyLineAfterMultilineCondition backtrace_silencers.rb
For /Users/bohdan/Projects/talkable-style: configuration from /Users/bohdan/Projects/talkable-style/.rubocop.yml
Inheriting configuration from /Users/bohdan/Projects/talkable-style/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-performance-1.8.0/config/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-performance-1.8.0/config/default.yml
Default configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/config/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rails-2.8.0/config/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rails-2.8.0/config/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rake-0.5.1/config/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rake-0.5.1/config/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rspec-1.43.2/config/default.yml
configuration from /Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rspec-1.43.2/config/default.yml
Inspecting 1 file
Scanning /Users/bohdan/Projects/talkable-style/backtrace_silencers.rb
An error occurred while Layout/EmptyLineAfterMultilineCondition cop was inspecting /Users/bohdan/Projects/talkable-style/backtrace_silencers.rb:1:0.
undefined method `children' for nil:NilClass
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb:120:in `next_sibling_empty?'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb:65:in `on_if'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/commissioner.rb:99:in `block (2 levels) in trigger_responding_cops'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/commissioner.rb:152:in `with_cop_error_handling'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/commissioner.rb:98:in `block in trigger_responding_cops'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/commissioner.rb:97:in `each'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/commissioner.rb:97:in `trigger_responding_cops'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/commissioner.rb:70:in `on_if'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:14:in `walk'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/commissioner.rb:85:in `investigate'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/team.rb:152:in `investigate_partial'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cop/team.rb:83:in `investigate'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:296:in `inspect_file'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:246:in `block in do_inspection_loop'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:278:in `block in iterate_until_no_changes'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:271:in `loop'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:271:in `iterate_until_no_changes'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:242:in `do_inspection_loop'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:122:in `block in file_offenses'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:147:in `file_offense_cache'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:121:in `file_offenses'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:112:in `process_file'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:91:in `block in each_inspected_file'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:90:in `each'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:90:in `reduce'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:90:in `each_inspected_file'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:79:in `inspect_files'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/runner.rb:40:in `run'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cli/command/execute_runner.rb:22:in `execute_runner'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cli/command/execute_runner.rb:14:in `run'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cli/command.rb:11:in `run'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cli/environment.rb:18:in `run'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cli.rb:65:in `run_command'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/lib/rubocop/cli.rb:41:in `run'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/exe/rubocop:13:in `block in <top (required)>'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.90.0/exe/rubocop:12:in `<top (required)>'
/Users/bohdan/.rbenv/versions/2.7.1/bin/rubocop:23:in `load'
/Users/bohdan/.rbenv/versions/2.7.1/bin/rubocop:23:in `<top (required)>'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/Users/bohdan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/Users/bohdan/.rbenv/versions/2.7.1/bin/bundle:23:in `load'
/Users/bohdan/.rbenv/versions/2.7.1/bin/bundle:23:in `<main>'
.

1 file inspected, no offenses detected

1 error occurred:
An error occurred while Layout/EmptyLineAfterMultilineCondition cop was inspecting /Users/bohdan/Projects/talkable-style/backtrace_silencers.rb:1:0.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop-hq/rubocop/issues

Mention the following information in the issue report:
0.90.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.7.1 x86_64-darwin19)
Finished in 0.4698310000003403 seconds

Steps to reproduce the problem

Create backtrace_silencers.rb with the following content:

Rails.backtrace_cleaner.remove_silencers! if ENV['CI']

Run:

$ bundle exec rubocop -d --only Layout/EmptyLineAfterMultilineCondition backtrace_silencers.rb

RuboCop version

$ [bundle exec] rubocop -V
0.90.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.7.1 x86_64-darwin19)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant