Skip to content

Files

Latest commit

 

History

History
53 lines (45 loc) · 1.12 KB

bracket_spacing.md

File metadata and controls

53 lines (45 loc) · 1.12 KB

Pattern: Malformed bracket spacing

Issue: -

Description

This rule checks to see that there is the proper spacing inside square brackets. The spacing amount is specified by spaces. The spacing amount for empty arrays is specified by empty_array_spaces. The spacing amount for arrays containing a single item is specified by mono_array_spaces. Specified characters will be ignored if listed in exceptions.

Examples

# Spaces is 0
[a, b]     # Good
[a, b ]    # Bad
[ a, b]    # Bad
[ a, b ]   # Bad
# Except brackets
[ [a, b] ] # Good
[[ a, b ]] # Bad
# Spaces is 1
[a, b]     # Bad
[a, b ]    # Bad
[ a, b]    # Bad
[ a, b ]   # Good
[ a, b  ]  # Bad
[  a, b ]  # Bad
[  a, b  ] # Bad
# Except braces
[{ a: b }] # Good
[ {a: b} ] # Bad
# Empty Array Spaces is 0
[]         # Good
[ ]        # Bad
# Empty Array Spaces is 1
[]         # Bad
[ ]        # Good
# Mono Array Spaces is 0
[a]        # Good
[ a ]      # Bad
# Mono Array Spaces is 1
[a]        # Bad
[ a ]      # Good

This rule is disabled by default.

Further Reading