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

Problem With Layout/HashAlignment #9871

Closed
jherdman opened this issue Jun 11, 2021 · 1 comment
Closed

Problem With Layout/HashAlignment #9871

jherdman opened this issue Jun 11, 2021 · 1 comment

Comments

@jherdman
Copy link

jherdman commented Jun 11, 2021

Expected behavior

The Layout/HasAlignment cop works.

Actual behavior

Scanning /home/james/DEV/PN/eternal-sledgehammer/app/controllers/subscriptions_controller.rb
An error occurred while Layout/HashAlignment cop was inspecting /home/james/DEV/PN/eternal-sledgehammer/app/controllers/subscriptions_controller.rb:96:28.
undefined method `loc' for nil:NilClass
/home/james/DEV/PN/eternal-sledgehammer/vendor/cache/ruby/2.6.0/gems/rubocop-1.16.1/lib/rubocop/cop/layout/hash_alignment.rb:221:in `autocorrect_incompatible_with_other_cops?'
/home/james/DEV/PN/eternal-sledgehammer/vendor/cache/ruby/2.6.0/gems/rubocop-1.16.1/lib/rubocop/cop/layout/hash_alignment.rb:206:in `on_hash'
/home/james/DEV/PN/eternal-sledgehammer/vendor/cache/ruby/2.6.0/gems/rubocop-1.16.1/lib/rubocop/cop/commissioner.rb:100:in `public_send'

Offending code:

params
  .some_method
  .fetch(:foo, {})
  .more
  .another

We see an enormous number of these problems. This cop has no such issues using 1.16.0.

Steps to reproduce the problem

Simply run the cop.

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:

1.16.1 (using Parser 3.0.1.1, rubocop-ast 1.7.0, running on ruby 2.6.6 x86_64-linux)
  - rubocop-performance 1.11.3
  - rubocop-rails 2.10.1
  - rubocop-rspec 2.4.0
@dvandersluis
Copy link
Member

This was fixed in #9862 and will be released soon. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants