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

multiline method chaining with leading dots #104

Open
glennr opened this issue Aug 31, 2016 · 1 comment
Open

multiline method chaining with leading dots #104

glennr opened this issue Aug 31, 2016 · 1 comment

Comments

@glennr
Copy link

glennr commented Aug 31, 2016

Hi, just wondering if/how we could get support for the alternative style of method chaining i.e. 'leading dots' - see Option A in the Ruby Style Guide

This project supports trailing dots (Option B) quite well (i.e. . on preceding lines). However if you are using the leading dot notation, it doesnt recognize the block and removes any indentation you might have

           User.where(status: ...).
-            .order('updated_at DESC')
+          .order('updated_at DESC')

The spec could look like this;

- name: should indent alternative style multiline method call chains
  input: |
    def method_with_multiline_method_call_chain
    multiline_method_call
    .foo
    .bar
    another_method_call
    end
  output: |
    def method_with_multiline_method_call_chain
      multiline_method_call
        .foo
        .bar
      another_method_call
    end
@gouthamvel
Copy link

I wrote a hack to get this to work master...gouthamvel:master

Was trying to find a good solution but was hard to find one within the implemented framework. Will see if I can do something better.

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

No branches or pull requests

2 participants