Ameba::Rule::Style::PercentLiteralDelimiters
Inherits YAML::Serializable < Ameba::Rule::Base < Ameba::Config::RuleConfig < Reference < Object
A rule that enforces the consistent usage of %-literal delimiters.
Specifying DefaultDelimiters option will set all preferred delimiters at once. You
can continue to specify individual preferred delimiters via PreferredDelimiters
setting to override the default. In both cases the delimiters should be specified
as a string of two characters, or nil to ignore a particular %-literal / default.
Setting IgnoreLiteralsContainingDelimiters to true will ignore %-literals that
contain one or both delimiters.
YAML configuration example:
Style/PercentLiteralDelimiters:
Enabled: true
DefaultDelimiters: '()'
PreferredDelimiters:
'%w': '[]'
'%i': '[]'
'%r': '{}'
IgnoreLiteralsContainingDelimiters: false
Constants
Constructors
A rule that enforces the consistent usage of %-literal delimiters.
Specifying DefaultDelimiters option will set all preferred delimiters at once. You
can continue to specify individual preferred delimiters via PreferredDelimiters
setting to override the default. In both cases the delimiters should be specified
as a string of two characters, or nil to ignore a particular %-literal / default.
Setting IgnoreLiteralsContainingDelimiters to true will ignore %-literals that
contain one or both delimiters.
YAML configuration example:
Style/PercentLiteralDelimiters:
Enabled: true
DefaultDelimiters: '()'
PreferredDelimiters:
'%w': '[]'
'%i': '[]'
'%r': '{}'
IgnoreLiteralsContainingDelimiters: false
Class methods
Returns true if this rule is deprecated, false otherwise.
Returns the deprecation reason for this rule, if there is any.
Returns the documentation URL for this rule.
Ameba::Rule::Lint::Syntax.documentation_url
# => "https://crystal-ameba.org/api/master/Ameba/Rule/Lint/Syntax.html"
Returns the documentation for this rule, if there is any.
module Ameba
# This is a test rule.
# Does nothing.
class Rule::MyRule < Rule::Base
def test(source)
end
end
end
Ameba::Rule::MyRule.parsed_doc # => "This is a test rule.\nDoes nothing."