You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a conflict between Layout/ArgumentAlignment, Layout/HashAlignment, and Style/LambdaCall.
In one of my apps, I have Style/LambdaCall disabled and Layout/ArgumentAlignment using with_fixed_indentation as its enforced style. When I run Rubocop, it reports an error when evaluating the following line:
proc.(key: value)
An error occurred while Layout/HashAlignment cop was inspecting /.../rubocop-example/example.rb:4:8.
undefined method `line' for nil:NilClass
I do not see the error if I use .call( instead of just .(, nor do I see it if either Layout/ArgumentAlignment or Style/LambdaCall are unconfigured.
The full stack trace is below, along with the sample file for reproducing. I believe this issue has only existed since 1.18.1 (but maybe 1.18.0 as well), and continues to occur in 1.18.2. Rubocop does not find any offences, the files pass, but the error occurs reliably.
Expected behavior
I expect the code to pass without any errors :)
Actual behavior
bundle exec rubocop -d example.rb
For /Users/pat/Code/readings/tmp/rubocop-example: configuration from /Users/pat/.../rubocop-example/.rubocop.yml
Default configuration from /Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/config/default.yml
Inspecting 1 file
Scanning /Users/pat/.../rubocop-example/example.rb
An error occurred while Layout/HashAlignment cop was inspecting /Users/pat/.../rubocop-example/example.rb:3:6.
undefined method `line' for nil:NilClass
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/layout/hash_alignment.rb:223:in `autocorrect_incompatible_with_other_cops?'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/layout/hash_alignment.rb:207:in `on_hash'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:100:in `public_send'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:100:in `block (2 levels) in trigger_responding_cops'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:160:in `with_cop_error_handling'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:99:in `block in trigger_responding_cops'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:98:in `each'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:98:in `trigger_responding_cops'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:69:in `on_hash'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:159:in `block in on_send'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:156:in `each'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:156:in `each_with_index'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:156:in `on_send'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:71:in `on_send'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-ast-1.7.0/lib/rubocop/ast/traversal.rb:20:in `walk'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/commissioner.rb:86:in `investigate'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/team.rb:155:in `investigate_partial'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cop/team.rb:83:in `investigate'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:310:in `inspect_file'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:254:in `block in do_inspection_loop'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:288:in `block in iterate_until_no_changes'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:281:in `loop'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:281:in `iterate_until_no_changes'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:250:in `do_inspection_loop'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:130:in `block in file_offenses'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:155:in `file_offense_cache'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:129:in `file_offenses'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:120:in `process_file'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:100:in `each'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:100:in `reduce'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:100:in `each_inspected_file'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:86:in `inspect_files'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/runner.rb:47:in `run'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli/command.rb:11:in `run'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli/environment.rb:18:in `run'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli.rb:65:in `run_command'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/lib/rubocop/cli.rb:41:in `run'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/exe/rubocop:12:in `block in <top (required)>'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/benchmark.rb:308:in `realtime'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.18.2/exe/rubocop:12:in `<top (required)>'
/Users/pat/.asdf/installs/ruby/3.0.1/bin/rubocop:23:in `load'
/Users/pat/.asdf/installs/ruby/3.0.1/bin/rubocop:23:in `<top (required)>'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/cli.rb:494:in `exec'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.2.15/libexec/bundle:49:in `block in <top (required)>'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/3.0.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
/Users/pat/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.2.15/libexec/bundle:37:in `<top (required)>'
/Users/pat/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `load'
/Users/pat/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `<main>'
.
1 file inspected, no offenses detected
1 error occurred:
An error occurred while Layout/HashAlignment cop was inspecting /Users/pat/.../rubocop-example/example.rb:3:6.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop/rubocop/issues
Mention the following information in the issue report:
1.18.2 (using Parser 3.0.1.1, rubocop-ast 1.7.0, running on ruby 3.0.1 x86_64-darwin20)
Finished in 0.23595299990847707 seconds
There seems to be a conflict between
Layout/ArgumentAlignment
,Layout/HashAlignment
, andStyle/LambdaCall
.In one of my apps, I have
Style/LambdaCall
disabled andLayout/ArgumentAlignment
usingwith_fixed_indentation
as its enforced style. When I run Rubocop, it reports an error when evaluating the following line:I do not see the error if I use
.call(
instead of just.(
, nor do I see it if eitherLayout/ArgumentAlignment
orStyle/LambdaCall
are unconfigured.The full stack trace is below, along with the sample file for reproducing. I believe this issue has only existed since 1.18.1 (but maybe 1.18.0 as well), and continues to occur in 1.18.2. Rubocop does not find any offences, the files pass, but the error occurs reliably.
Expected behavior
I expect the code to pass without any errors :)
Actual behavior
Steps to reproduce the problem
This simple file reproduces the issue for me:
With the following configuration:
RuboCop version
The text was updated successfully, but these errors were encountered: