codeclimate/codeclimate-rubocop

View on GitHub
config/contents/layout/case_indentation.md

Summary

Maintainability
Test Coverage
This cop checks how the *when*s of a *case* expression
are indented in relation to its *case* or *end* keyword.

It will register a separate offense for each misaligned *when*.

### Example:
    # If Layout/EndAlignment is set to keyword style (default)
    # *case* and *end* should always be aligned to same depth,
    # and therefore *when* should always be aligned to both -
    # regardless of configuration.

    # bad for all styles
    case n
      when 0
        x * 2
      else
        y / 3
    end

    # good for all styles
    case n
    when 0
      x * 2
    else
      y / 3
    end

### Example: EnforcedStyle: case (default)
    # if EndAlignment is set to other style such as
    # start_of_line (as shown below), then *when* alignment
    # configuration does have an effect.

    # bad
    a = case n
    when 0
      x * 2
    else
      y / 3
    end

    # good
    a = case n
        when 0
          x * 2
        else
          y / 3
    end

### Example: EnforcedStyle: end
    # bad
    a = case n
        when 0
          x * 2
        else
          y / 3
    end

    # good
    a = case n
    when 0
      x * 2
    else
      y / 3
    end