Skip to content

Files

Latest commit

 

History

History
63 lines (43 loc) · 1.14 KB

Lint-EndAlignment.md

File metadata and controls

63 lines (43 loc) · 1.14 KB

Pattern: Misaligned end

Issue: -

Description

This rule checks whether the end keywords are aligned properly.

Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

If it's set to keyword (which is the default), the end shall be aligned with the start of the keyword (if, class, etc.).

If it's set to variable the end shall be aligned with the left-hand-side of the variable assignment, if there is one.

If it's set to start_of_line, the end shall be aligned with the start of the line where the matching keyword appears.

Examples

# bad

variable = if true
    end
# EnforcedStyleAlignWith: keyword (default)

# good

variable = if true
           end
# EnforcedStyleAlignWith: variable

# good

variable = if true
end
# EnforcedStyleAlignWith: start_of_line

# good

puts(if true
end)

Default configuration

Attribute Value
EnforcedStyleAlignWith keyword
SupportedStylesAlignWith keyword, variable, start_of_line

Further Reading