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

Layout/FirstMethodArgumentLineBreak is broken #8444

Closed
furuhama opened this issue Aug 3, 2020 · 0 comments · Fixed by #8445
Closed

Layout/FirstMethodArgumentLineBreak is broken #8444

furuhama opened this issue Aug 3, 2020 · 0 comments · Fixed by #8445
Labels

Comments

@furuhama
Copy link

furuhama commented Aug 3, 2020

Expected behavior

no offenses detected without any errors

Actual behavior

no offenses detected, but an error occured

Steps to reproduce the problem

Gemfile

# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem 'rubocop'
gem 'rubocop-ast', '0.3.0'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    ast (2.4.1)
    parallel (1.19.2)
    parser (2.7.1.4)
      ast (~> 2.4.1)
    rainbow (3.0.0)
    regexp_parser (1.7.1)
    rexml (3.2.4)
    rubocop (0.88.0)
      parallel (~> 1.10)
      parser (>= 2.7.1.1)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 1.7)
      rexml
      rubocop-ast (>= 0.1.0, < 1.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 1.4.0, < 2.0)
    rubocop-ast (0.3.0)
      parser (>= 2.7.1.4)
    ruby-progressbar (1.10.1)
    unicode-display_width (1.7.0)

PLATFORMS
  ruby

DEPENDENCIES
  rubocop
  rubocop-ast (= 0.3.0)

BUNDLED WITH
   2.0.2

repro.rb

def meow
  super(
    kw: 42
  )
end

And run

$ bundle exec rubocop --only Layout/FirstMethodArgumentLineBreak repro.rb -d

this causes an error like below

$ bundle exec rubocop --only Layout/FirstMethodArgumentLineBreak repro.rb -d
For /Users/furuhama.yusuke/repro_rubocop: Default configuration from /Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/config/default.yml
Inspecting 1 file
Scanning /Users/furuhama.yusuke/repro_rubocop/repro.rb
An error occurred while Layout/FirstMethodArgumentLineBreak cop was inspecting /Users/furuhama.yusuke/repro_rubocop/repro.rb:2:2.
can't modify frozen Array
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/layout/first_method_argument_line_break.rb:39:in `pop'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/layout/first_method_argument_line_break.rb:39:in `on_send'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:91:in `block (2 levels) in trigger_responding_cops'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:113:in `with_cop_error_handling'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:90:in `block in trigger_responding_cops'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:89:in `each'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:89:in `trigger_responding_cops'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:61:in `block (2 levels) in <class:Commissioner>'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:109:in `on_def'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:62:in `block (2 levels) in <class:Commissioner>'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:14:in `walk'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:74:in `investigate'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/team.rb:151:in `investigate_partial'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cop/team.rb:83:in `investigate'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:295:in `inspect_file'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:245:in `block in do_inspection_loop'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:277:in `block in iterate_until_no_changes'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:270:in `loop'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:270:in `iterate_until_no_changes'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:241:in `do_inspection_loop'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:121:in `block in file_offenses'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:146:in `file_offense_cache'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:120:in `file_offenses'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:111:in `process_file'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:90:in `block in each_inspected_file'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:89:in `each'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:89:in `reduce'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:89:in `each_inspected_file'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:78:in `inspect_files'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/runner.rb:39:in `run'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cli/command/execute_runner.rb:21:in `execute_runner'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cli/command/execute_runner.rb:13:in `run'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cli/command.rb:10:in `run'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cli/environment.rb:17:in `run'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cli.rb:65:in `run_command'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/lib/rubocop/cli.rb:41:in `run'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/exe/rubocop:13:in `block in <top (required)>'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/gems/rubocop-0.88.0/exe/rubocop:12:in `<top (required)>'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/bin/rubocop:23:in `load'
/Users/furuhama.yusuke/repro_rubocop/vendor/bundle/bin/rubocop:23:in `<top (required)>'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `load'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:28:in `run'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli.rb:465:in `exec'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli.rb:27:in `dispatch'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli.rb:18:in `start'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/exe/bundle:30:in `block in <top (required)>'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/exe/bundle:22:in `<top (required)>'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/bin/bundle:23:in `load'
/Users/furuhama.yusuke/.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'
.

1 file inspected, no offenses detected

1 error occurred:
An error occurred while Layout/FirstMethodArgumentLineBreak cop was inspecting /Users/furuhama.yusuke/repro_rubocop/repro.rb:2:2.
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.88.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.6.6 x86_64-darwin19)
Finished in 0.1443899999721907 seconds

RuboCop version

0.88.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.6.6 x86_64-darwin19)

@koic koic added the bug label Aug 3, 2020
koic added a commit to koic/rubocop that referenced this issue Aug 3, 2020
Fixes rubocop#8444.

This PR fixes an error for `Layout/FirstMethodArgumentLineBreak`
when using kwargs in `super`
@koic koic closed this as completed in #8445 Aug 3, 2020
koic added a commit that referenced this issue Aug 3, 2020
…t_line_break

[Fix #8444] Fix an error for `Layout/FirstMethodArgumentLineBreak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants