Skip to content

Files

Latest commit

 

History

History
38 lines (25 loc) · 941 Bytes

Style-PercentLiteralDelimiters.md

File metadata and controls

38 lines (25 loc) · 941 Bytes

Pattern: Malformed %-literal delimiter

Issue: -

Description

This rule enforces the consistent usage of %-literal delimiters.

Specify the default key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Examples

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Default configuration

Attribute Value
PreferredDelimiters {"default"=>"()", "%i"=>"[]", "%I"=>"[]", "%r"=>"{}", "%w"=>"[]", "%W"=>"[]"}

Further Reading