struct Ameba::Rule::Lint::LiteralInInterpolation
- Ameba::Rule::Lint::LiteralInInterpolation
- Ameba::Rule::Base
- Struct
- Value
- Object
Overview
A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.
For example:
"Hello, #{:Ary}"
"There are #{4} cats"
YAML configuration example:
Lint/LiteralInInterpolation
Enabled: true
Included Modules
- Ameba::AST::Util
- YAML::Serializable
- YAML::Serializable::Strict
Defined in:
Constant Summary
-
MSG =
"Literal value found in interpolation"
Constructors
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
-
.new(config = nil)
A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.
Instance Method Summary
- #description : String
- #description=(description : String)
- #enabled : Bool
- #enabled=(enabled)
- #excluded : Array(String)?
- #excluded=(excluded : Array(String)?)
- #severity : Ameba::Severity
- #severity=(severity)
- #test(source, node : Crystal::StringInterpolation)
Instance methods inherited from module Ameba::AST::Util
abort?(node)
abort?,
exit?(node)
exit?,
flow_command?(node, in_loop)
flow_command?,
flow_expression?(node, in_loop = false)
flow_expression?,
literal?(node)
literal?,
loop?(node)
loop?,
node_source(node, code_lines)
node_source,
raise?(node)
raise?
Instance methods inherited from struct Ameba::Rule::Base
==(other)
==,
catch(source : Source)
catch,
excluded?(source)
excluded?,
group
group,
hash
hash,
name
name,
special?
special?,
test(source : Source, node : Crystal::ASTNode, *opts)test(source : Source) test
Constructor methods inherited from struct Ameba::Rule::Base
new
new
Class methods inherited from struct Ameba::Rule::Base
parsed_doc
parsed_doc
Constructor Detail
def self.new(config = nil)
#
A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.
For example:
"Hello, #{:Ary}"
"There are #{4} cats"
YAML configuration example:
Lint/LiteralInInterpolation
Enabled: true