class Ameba::Rule::Lint::UnusedArgument
- Ameba::Rule::Lint::UnusedArgument
- Ameba::Rule::Base
- Reference
- Object
Overview
A rule that reports unused arguments. For example, this is considered invalid:
def method(a, b, c)
a + b
end
and should be written as:
def method(a, b)
a + b
end
YAML configuration example:
Lint/UnusedArgument:
Enabled: true
IgnoreDefs: true
IgnoreBlocks: false
IgnoreProcs: false
Included Modules
- YAML::Serializable
- YAML::Serializable::Strict
Defined in:
ameba/rule/lint/unused_argument.crConstant Summary
-
MSG =
"Unused argument `%s`. If it's necessary, use `%s` as an argument name to indicate that it won't be used."
Constructors
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
-
.new(config = nil)
A rule that reports unused arguments.
Class Method Summary
-
.parsed_doc : String?
Returns documentation for this rule, if there is any.
Instance Method Summary
- #description : String
- #description=(description : String)
- #enabled : Bool
- #enabled=(enabled : Bool)
- #excluded : Array(String)?
- #excluded=(excluded : Array(String)?)
- #ignore_blocks : Bool
- #ignore_blocks=(ignore_blocks : Bool)
- #ignore_defs : Bool
- #ignore_defs=(ignore_defs : Bool)
- #ignore_procs : Bool
- #ignore_procs=(ignore_procs : Bool)
- #severity : Ameba::Severity
- #severity=(severity : Ameba::Severity)
- #test(source, node : Crystal::ProcLiteral, scope : AST::Scope)
- #test(source, node : Crystal::Block, scope : AST::Scope)
- #test(source, node : Crystal::Def, scope : AST::Scope)
- #test(source)
Instance methods inherited from class 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 Detail
def self.new(config = nil)
#
A rule that reports unused arguments. For example, this is considered invalid:
def method(a, b, c)
a + b
end
and should be written as:
def method(a, b)
a + b
end
YAML configuration example:
Lint/UnusedArgument:
Enabled: true
IgnoreDefs: true
IgnoreBlocks: false
IgnoreProcs: false
Class Method Detail
def self.parsed_doc : String?
#
Returns documentation for this rule, if there is any.
module Ameba
# This is a test rule.
# Does nothing.
class MyRule < Ameba::Rule::Base
def test(source)
end
end
end
MyRule.parsed_doc # => "This is a test rule.\nDoes nothing."