Skip to content

multiline method chaining with leading dots #104

@glennr

Description

@glennr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions