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

AlignHash deletes parts of code #1214

Closed
andreaseger opened this issue Jul 16, 2014 · 1 comment
Closed

AlignHash deletes parts of code #1214

andreaseger opened this issue Jul 16, 2014 · 1 comment
Assignees
Labels

Comments

@andreaseger
Copy link
Contributor

just have a look at this short example

before

class FooController
  def update
    output=b_logic('AccountNote::Update', {:account_note_id => params[:id],
                                           :account_note_attributes => params[:model]})
    if @account_note
      render :json => @account_note.to_json
    else
      render :json => {:errors => format_errors(output.error_messages,
                                                :format => :for_json)}, :status => 404
    end
  end
end

after running rubocop --only AlignHash --auto-correct aligh_hash_bug.rb

class FooController
  def update
    output=b_logic('AccountNote::Update', {:account_note_id => params[:id],
                                           :account_note_attributes => params[:model]})
    if @account_note
      render :json => @account_note.to_json
    else
      render :json => {:errors => format_errors(output.error_messages,
             :status => 404
    end
  end
end

It correctly sees that :status should be aligned with :json but just deletes the rest of the line.

@jonas054
Copy link
Collaborator

Ouch! I'll take a look.

@jonas054 jonas054 added the bug label Jul 16, 2014
@jonas054 jonas054 self-assigned this Jul 16, 2014
bbatsov added a commit that referenced this issue Jul 18, 2014
[Fix #1214] Require one key per line for inspection in AlignHash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants