Skip to content

Files

Latest commit

 

History

History
75 lines (54 loc) · 1.26 KB

Layout-SpaceInsideReferenceBrackets.md

File metadata and controls

75 lines (54 loc) · 1.26 KB

Pattern: Malformed space inside reference brackets

Issue: -

Description

Checks that reference brackets have or don't have surrounding space depending on configuration.

Examples

EnforcedStyle: no_space (default)

# The `no_space` style enforces that reference brackets have
# no surrounding space.

# bad
hash[ :key ]
array[ index ]

# good
hash[:key]
array[index]

EnforcedStyle: space

# The `space` style enforces that reference brackets have
# surrounding space.

# bad
hash[:key]
array[index]

# good
hash[ :key ]
array[ index ]

EnforcedStyleForEmptyBrackets: no_space (default)

# The `no_space` EnforcedStyleForEmptyBrackets style enforces that
# empty reference brackets do not contain spaces.

# bad
foo[ ]
foo[     ]

# good
foo[]

EnforcedStyleForEmptyBrackets: space

# The `space` EnforcedStyleForEmptyBrackets style enforces that
# empty reference brackets contain exactly one space.

# bad
foo[]
foo[    ]

# good
foo[ ]

Default configuration

Attribute Value
EnforcedStyle no_space
EnforcedStyleForEmptyBrackets no_space

Further Reading