commit 783b1f165865e678e980691646ed107f5c22b12f Author: Deployment Bot (from Travis CI) Date: Mon Jan 11 14:49:07 2021 +0000 Deploy ameba to github.com/crystal-ameba/ameba.git:gh-pages diff --git a/Ameba.html b/Ameba.html new file mode 100644 index 00000000..18dcba0f --- /dev/null +++ b/Ameba.html @@ -0,0 +1,726 @@ + + + + + + + + + + + + + + + + Ameba - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba + +

+ + + + + +

+ + + + Overview +

+ +

Ameba's entry module.

+ +

To run the linter with default parameters:

+ +
Ameba.run
+ +

To configure and run it:

+ +
config = Ameba::Config.load
+config.formatter = formatter
+config.files = file_paths
+
+Ameba.run config
+ + + + + + + +

+ + + + Extended Modules +

+ + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ VERSION = {{ (`shards version \"/home/travis/build/crystal-ameba/ameba/src\"`).chomp.stringify }} +
+ + +
+ + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def run(config = Config.load) + + # +
+ +
+ +

Initializes Ameba::Runner and runs it. +Can be configured via config parameter.

+ +

Examples:

+ +
Ameba.run
+Ameba.run config
+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST.html b/Ameba/AST.html new file mode 100644 index 00000000..ce3f481b --- /dev/null +++ b/Ameba/AST.html @@ -0,0 +1,650 @@ + + + + + + + + + + + + + + + + Ameba::AST - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::AST + +

+ + + + + +

+ + + + Overview +

+ +

A module that helps to traverse Crystal AST using Crystal::Visitor.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ NODES = [Alias, IsA, Assign, Call, Block, Case, ClassDef, ClassVar, Def, EnumDef, ExceptionHandler, Expressions, HashLiteral, If, InstanceVar, LibDef, ModuleDef, NilLiteral, StringInterpolation, Unless, Var, When, While, Until] +
+ +
+

List of nodes to be visited by Ameba's rules.

+
+ + +
+ + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Ameba/AST/Argument.html b/Ameba/AST/Argument.html new file mode 100644 index 00000000..9386910e --- /dev/null +++ b/Ameba/AST/Argument.html @@ -0,0 +1,949 @@ + + + + + + + + + + + + + + + + Ameba::AST::Argument - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::Argument + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents the argument of some node. +Holds the reference to the variable, thus to scope.

+ +

For example, all these vars are arguments:

+ +
def method(a, b, c = 10, &block)
+  3.times do |i|
+  end
+
+  ->(x : Int32) {}
+end
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node, variable) + + # +
+ +
+ +

Creates a new argument.

+ +
Argument.new(node, variable)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def ignored? + + # +
+ +
+ +

Returns true if the name starts with '_', false if not.

+
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def name + + # +
+ +
+ +

Name of the argument.

+
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::Var | Crystal::Arg + + # +
+ +
+ +

The actual node.

+
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def variable : Variable + + # +
+ +
+ +

Variable of this argument (may be the same node)

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/Assignment.html b/Ameba/AST/Assignment.html new file mode 100644 index 00000000..b709123f --- /dev/null +++ b/Ameba/AST/Assignment.html @@ -0,0 +1,1120 @@ + + + + + + + + + + + + + + + + Ameba::AST::Assignment - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::Assignment + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents the assignment to the variable. +Holds the assign node and the variable.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node, variable, scope) + + # +
+ +
+ +

Creates a new assignment.

+ +
Assignment.new(node, variable, scope)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def branch : Branch? + + # +
+ +
+ +

Branch of this assignment.

+
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def in_branch? + + # +
+ +
+ +

Returns true if this assignment is in a branch, false if not. +For example, this assignment is in a branch:

+ +
a = 1 if a.nil?
+
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::ASTNode + + # +
+ +
+ +

The actual assignment node.

+
+ +
+
+ +
+
+ +
+
+ + def op_assign? + + # +
+ +
+ +

Returns true if this assignment is an op assign, false if not. +For example, this is an op assign:

+ +
a ||= 1
+
+ +
+
+ +
+
+ +
+
+ + def referenced=(referenced) + + # +
+ +
+
+ +
+
+ +
+
+ + def referenced? : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def referenced_in_loop? + + # +
+ +
+
+ +
+
+ +
+
+ + def scope : Scope + + # +
+ +
+ +

A scope assignment belongs to

+
+ +
+
+ +
+
+ +
+
+ + def target_node + + # +
+ +
+ +

Returns the target node of the variable in this assignment.

+
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def transformed? + + # +
+ +
+ +

Indicates whether the node is a transformed assignment by the compiler. +i.e.

+ +
collection.each do |(a, b)|
+  puts b
+end
+ +

is transformed to:

+ +
collection.each do |__arg0|
+  a = __arg0[0]
+  b = __arg0[1]
+  puts(b)
+end
+
+ +
+
+ +
+
+ +
+
+ + def variable : Variable + + # +
+ +
+ +

Variable of this assignment.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/BaseVisitor.html b/Ameba/AST/BaseVisitor.html new file mode 100644 index 00000000..e506f007 --- /dev/null +++ b/Ameba/AST/BaseVisitor.html @@ -0,0 +1,776 @@ + + + + + + + + + + + + + + + + Ameba::AST::BaseVisitor - ameba 0.13.3-dev + + + + + + + + +
+

+ + abstract class Ameba::AST::BaseVisitor + +

+ + + + + + + +

+ + + + Overview +

+ +

An abstract base visitor that utilizes general logic for all visitors.

+ + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(rule, source) + + # +
+ +
+ +

Creates instance of this visitor.

+ +
visitor = Ameba::AST::NodeVisitor.new(rule, source)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def visit(node : Crystal::ASTNode) + + # +
+ +
+ +

A main visit method that accepts Crystal::ASTNode. +Returns true meaning all child nodes will be traversed.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/Branch.html b/Ameba/AST/Branch.html new file mode 100644 index 00000000..313036a2 --- /dev/null +++ b/Ameba/AST/Branch.html @@ -0,0 +1,1068 @@ + + + + + + + + + + + + + + + + Ameba::AST::Branch - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::Branch + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents the branch in Crystal code. +Branch is a part of a branchable statement. +For example, the branchable if statement contains 3 branches:

+ +
if a = something # --> Branch A
+  a = 1          # --> Branch B
+  put a if out   # --> Branch C
+else
+  do_something a # --> Branch D
+end
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node, parent) + + # +
+ +
+ +

Creates a new branch.

+ +
Branch.new(if_node)
+
+ +
+
+ +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.of(node : Crystal::ASTNode, parent_node : Crystal::ASTNode) + + # +
+ +
+ +

Constructs a new branch based on the node some parent scope.

+ +
Branch.of(assign_node, def_node)
+
+ +
+
+ +
+
+ +
+
+ + def self.of(node : Crystal::ASTNode, scope : Scope) + + # +
+ +
+ +

Constructs a new branch based on the node in scope.

+ +
Branch.of(assign_node, scope)
+
+ +
+
+ +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def ==(other : self) + + # +
+ +
+ +
+ Description copied from class Reference +
+ +

Returns true if this reference is the same as other. Invokes same?.

+
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def hash(hasher) + + # +
+ +
+ +
+ Description copied from class Reference +
+ +

See Object#hash(hasher)

+
+ +
+
+ +
+
+ +
+
+ + def in_loop? + + # +
+ +
+ +

Returns true if current branch is in a loop, false - otherwise. +For example, this branch is in a loop:

+ +
while true
+  handle_input # this branch is in a loop
+  if wrong_input
+    show_message # this branch is also in a loop.
+  end
+end
+
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::ASTNode + + # +
+ +
+ +

The actual branch node.

+
+ +
+
+ +
+
+ +
+
+ + def parent : Branchable + + # +
+ +
+ +

The parent branchable.

+
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/Branchable.html b/Ameba/AST/Branchable.html new file mode 100644 index 00000000..710217a1 --- /dev/null +++ b/Ameba/AST/Branchable.html @@ -0,0 +1,1008 @@ + + + + + + + + + + + + + + + + Ameba::AST::Branchable - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::Branchable + +

+ + + + + + + +

+ + + + Overview +

+ +

A generic entity to represent a branchable Crystal node. +For example, Crystal::If, Crystal::Unless, Crystal::While +are branchables.

+ +
white a > 100 # Branchable A
+  if b > 2    # Branchable B
+    a += 1
+  end
+end
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node, parent = nil) + + # +
+ +
+ +

Creates a new branchable

+ +
Branchable.new(node, parent_branchable)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def branches : Array(Crystal::ASTNode) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def loop? + + # +
+ +
+ +

Returns true if this node or one of the parent branchables is a loop, false otherwise.

+
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::ASTNode + + # +
+ +
+ +

The actual Crystal node.

+
+ +
+
+ +
+
+ +
+
+ + def parent : Branchable? + + # +
+ +
+ +

Parent branchable (if any)

+
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/CountingVisitor.html b/Ameba/AST/CountingVisitor.html new file mode 100644 index 00000000..5850b6ce --- /dev/null +++ b/Ameba/AST/CountingVisitor.html @@ -0,0 +1,812 @@ + + + + + + + + + + + + + + + + Ameba::AST::CountingVisitor - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::CountingVisitor + +

+ + + + + + + +

+ + + + Overview +

+ +

AST Visitor that counts occurrences of certain keywords

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DEFAULT_COMPLEXITY = 1 +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(scope : Crystal::ASTNode) + + # +
+ +
+ +

Creates a new counting visitor

+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def count + + # +
+ +
+ +

Returns the number of keywords that were found in the node

+
+ +
+
+ +
+
+ +
+
+ + def macro_condition : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::MacroIf | Crystal::MacroFor) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/FlowExpression.html b/Ameba/AST/FlowExpression.html new file mode 100644 index 00000000..7538c8bb --- /dev/null +++ b/Ameba/AST/FlowExpression.html @@ -0,0 +1,1000 @@ + + + + + + + + + + + + + + + + Ameba::AST::FlowExpression - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::FlowExpression + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents a flow expression in Crystal code. +For example,

+ +
def foobar
+  a = 3
+  return 42 # => flow expression
+  a + 1
+end
+ +

Flow expression contains an actual node of a control expression and +a parent node, which allows easily search through the related statement +(i.e. find unreachable code)

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node, in_loop) + + # +
+ +
+ +

Creates a new flow expression.

+ +
FlowExpression.new(node, parent_node)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def in_loop? : Bool + + # +
+ +
+ +

Is true only if some of the nodes parents is a loop.

+
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::ASTNode + + # +
+ +
+ +

The actual node of the flow expression.

+
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def unreachable_nodes + + # +
+ +
+ +

Returns nodes which can't be reached because of a flow command inside. +For example:

+ +
def foobar
+  a = 1
+  return 42
+
+  a + 2 # => unreachable assign node
+end
+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/FlowExpressionVisitor.html b/Ameba/AST/FlowExpressionVisitor.html new file mode 100644 index 00000000..2fee6df1 --- /dev/null +++ b/Ameba/AST/FlowExpressionVisitor.html @@ -0,0 +1,803 @@ + + + + + + + + + + + + + + + + Ameba::AST::FlowExpressionVisitor - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::FlowExpressionVisitor + +

+ + + + + + + +

+ + + + Overview +

+ +

AST Visitor that traverses all the flow expressions.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + +

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 class Ameba::AST::BaseVisitor

+ + + + visit(node : Crystal::ASTNode) + visit + + + + + + +

Constructor methods inherited from class Ameba::AST::BaseVisitor

+ + + + new(rule, source) + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(rule, source) + + # +
+ +
+ +

Creates a new flow expression visitor.

+
+ +
+
+ +
+
+ + + + + + + + + +
+ + + diff --git a/Ameba/AST/InstanceVariable.html b/Ameba/AST/InstanceVariable.html new file mode 100644 index 00000000..7b403081 --- /dev/null +++ b/Ameba/AST/InstanceVariable.html @@ -0,0 +1,872 @@ + + + + + + + + + + + + + + + + Ameba::AST::InstanceVariable - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::InstanceVariable + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node) + + # +
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def name(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def name(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::InstanceVar + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/NodeVisitor.html b/Ameba/AST/NodeVisitor.html new file mode 100644 index 00000000..0bab3f5c --- /dev/null +++ b/Ameba/AST/NodeVisitor.html @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + Ameba::AST::NodeVisitor - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::NodeVisitor + +

+ + + + + + + +

+ + + + Overview +

+ +

An AST Visitor that traverses the source and allows all nodes +to be inspected by rules.

+ +
visitor = Ameba::AST::NodeVisitor.new(rule, source)
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

Instance methods inherited from class Ameba::AST::BaseVisitor

+ + + + visit(node : Crystal::ASTNode) + visit + + + + + + +

Constructor methods inherited from class Ameba::AST::BaseVisitor

+ + + + new(rule, source) + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(rule, source, skip = nil) + + # +
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def visit(node : Crystal::Alias) + + # +
+ +
+ +

A visit callback for Crystal::Alias node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Until) + + # +
+ +
+ +

A visit callback for Crystal::Until node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::While) + + # +
+ +
+ +

A visit callback for Crystal::While node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::When) + + # +
+ +
+ +

A visit callback for Crystal::When node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Var) + + # +
+ +
+ +

A visit callback for Crystal::Var node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Unless) + + # +
+ +
+ +

A visit callback for Crystal::Unless node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::StringInterpolation) + + # +
+ +
+ +

A visit callback for Crystal::StringInterpolation node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::NilLiteral) + + # +
+ +
+ +

A visit callback for Crystal::NilLiteral node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::ModuleDef) + + # +
+ +
+ +

A visit callback for Crystal::ModuleDef node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::LibDef) + + # +
+ +
+ +

A visit callback for Crystal::LibDef node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::InstanceVar) + + # +
+ +
+ +

A visit callback for Crystal::InstanceVar node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::If) + + # +
+ +
+ +

A visit callback for Crystal::If node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::HashLiteral) + + # +
+ +
+ +

A visit callback for Crystal::HashLiteral node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Expressions) + + # +
+ +
+ +

A visit callback for Crystal::Expressions node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::ExceptionHandler) + + # +
+ +
+ +

A visit callback for Crystal::ExceptionHandler node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::EnumDef) + + # +
+ +
+ +

A visit callback for Crystal::EnumDef node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Def) + + # +
+ +
+ +

A visit callback for Crystal::Def node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::ClassVar) + + # +
+ +
+ +

A visit callback for Crystal::ClassVar node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::ClassDef) + + # +
+ +
+ +

A visit callback for Crystal::ClassDef node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Case) + + # +
+ +
+ +

A visit callback for Crystal::Case node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Block) + + # +
+ +
+ +

A visit callback for Crystal::Block node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Call) + + # +
+ +
+ +

A visit callback for Crystal::Call node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::Assign) + + # +
+ +
+ +

A visit callback for Crystal::Assign node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node : Crystal::IsA) + + # +
+ +
+ +

A visit callback for Crystal::IsA node. +Returns true meaning that child nodes will be traversed as well.

+
+ +
+
+ +
+
+ +
+
+ + def visit(node) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/RedundantControlExpressionVisitor.html b/Ameba/AST/RedundantControlExpressionVisitor.html new file mode 100644 index 00000000..da5c9576 --- /dev/null +++ b/Ameba/AST/RedundantControlExpressionVisitor.html @@ -0,0 +1,792 @@ + + + + + + + + + + + + + + + + Ameba::AST::RedundantControlExpressionVisitor - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::RedundantControlExpressionVisitor + +

+ + + + + + + +

+ + + + Overview +

+ +

A class that utilizes a logic to traverse AST nodes and +fire a source test callback if a redundant Crystal::ControlExpression +is reached.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(rule, source, node) + + # +
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def node : Crystal::ASTNode + + # +
+ +
+ +

A node to run traversal on.

+
+ +
+
+ +
+
+ +
+
+ + def rule : Rule::Base + + # +
+ +
+ +

A corresponding rule that uses this visitor.

+
+ +
+
+ +
+
+ +
+
+ + def source : Source + + # +
+ +
+ +

A source that needs to be traversed.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/Reference.html b/Ameba/AST/Reference.html new file mode 100644 index 00000000..1a22a626 --- /dev/null +++ b/Ameba/AST/Reference.html @@ -0,0 +1,834 @@ + + + + + + + + + + + + + + + + Ameba::AST::Reference - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::Reference + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents a reference to the variable. +It behaves like a variable is used to distinguish a +the variable from its reference.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def explicit=(explicit) + + # +
+ +
+
+ +
+
+ +
+
+ + def explicit? : Bool + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/Scope.html b/Ameba/AST/Scope.html new file mode 100644 index 00000000..4c1a2b22 --- /dev/null +++ b/Ameba/AST/Scope.html @@ -0,0 +1,1491 @@ + + + + + + + + + + + + + + + + Ameba::AST::Scope - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::Scope + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents a context of the local variable visibility. +This is where the local variables belong to.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node, outer_scope = nil) + + # +
+ +
+ +

Creates a new scope. Accepts the AST node and the outer scope.

+ +
scope = Scope.new(class_node, nil)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def ==(other : self) + + # +
+ +
+ +
+ Description copied from class Reference +
+ +

Returns true if this reference is the same as other. Invokes same?.

+
+ +
+
+ +
+
+ +
+
+ + def add_argument(node) + + # +
+ +
+ +

Creates a new argument in the current scope.

+ +
scope = Scope.new(class_node, nil)
+scope.add_argument(arg_node)
+
+ +
+
+ +
+
+ +
+
+ + def add_ivariable(node) + + # +
+ +
+ +

Adds a new instance variable to the current scope.

+ +
scope = Scope.new(class_node, nil)
+scope.add_ivariable(ivar_node)
+
+ +
+
+ +
+
+ +
+
+ + def add_variable(node) + + # +
+ +
+ +

Creates a new variable in the current scope.

+ +
scope = Scope.new(class_node, nil)
+scope.add_variable(var_node)
+
+ +
+
+ +
+
+ +
+
+ + def arg?(var) + + # +
+ +
+ +

Returns true if var is an argument in current scope, false if not.

+
+ +
+
+ +
+
+ +
+
+ + def arguments : Array(Ameba::AST::Argument) + + # +
+ +
+ +

Link to the arguments in current scope

+
+ +
+
+ +
+
+ +
+
+ + def assign_variable(name, node) + + # +
+ +
+ +

Creates a new assignment for the variable.

+ +
scope = Scope.new(class_node, nil)
+scope.assign_variable(var_name, assign_node)
+
+ +
+
+ +
+
+ +
+
+ + def assigns_ivar?(name) + + # +
+ +
+ +

Returns true instance variable assinged in this scope.

+
+ +
+
+ +
+
+ +
+
+ + def block? + + # +
+ +
+ +

Returns true if current scope represents a block (or proc), +false if not.

+
+ +
+
+ +
+
+ +
+
+ + def def? + + # +
+ +
+ +

Returns true if current scope is a def, false if not.

+
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def eql?(node) + + # +
+ +
+ +

Returns true if the #node represents exactly +the same Crystal node as @node.

+
+ +
+
+ +
+
+ +
+
+ + def find_variable(name : String) + + # +
+ +
+ +

Returns variable by its name or nil if it does not exist.

+ +
scope = Scope.new(class_node, nil)
+scope.find_variable("foo")
+
+ +
+
+ +
+
+ +
+
+ + def hash(hasher) + + # +
+ +
+ +
+ Description copied from class Reference +
+ +

See Object#hash(hasher)

+
+ +
+
+ +
+
+ +
+
+ + def in_macro? + + # +
+ +
+ +

Returns true if current scope sits inside a macro.

+
+ +
+
+ +
+
+ +
+
+ + def inner_scopes : Array(Ameba::AST::Scope) + + # +
+ +
+ +

List of inner scopes

+
+ +
+
+ +
+
+ +
+
+ + def ivariables : Array(Ameba::AST::InstanceVariable) + + # +
+ +
+ +

Link to the instance variables used in current scope

+
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::ASTNode + + # +
+ +
+ +

The actual AST node that represents a current scope.

+
+ +
+
+ +
+
+ +
+
+ + def outer_scope : Scope? + + # +
+ +
+ +

Link to the outer scope

+
+ +
+
+ +
+
+ +
+
+ + def references : Array(Ameba::AST::Reference) + + # +
+ +
+ +

Link to all variable references in currency scope

+
+ +
+
+ +
+
+ +
+
+ + def references?(variable : Variable) + + # +
+ +
+ +

Returns true if current scope (or any of inner scopes) references variable, +false if not.

+
+ +
+
+ +
+
+ +
+
+ + def spawn_block? + + # +
+ +
+ +

Returns true if current scope represents a spawn block, e. g.

+ +
spawn do
+  # ...
+end
+
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def top_level? + + # +
+ +
+ +

Returns true if this scope is a top level scope, false if not.

+
+ +
+
+ +
+
+ +
+
+ + def type_definition? + + # +
+ +
+ +

Returns true if and only if current scope represents some +type definition, for example a class.

+
+ +
+
+ +
+
+ +
+
+ + def variables : Array(Ameba::AST::Variable) + + # +
+ +
+ +

Link to local variables

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/ScopeVisitor.html b/Ameba/AST/ScopeVisitor.html new file mode 100644 index 00000000..cf87f9e9 --- /dev/null +++ b/Ameba/AST/ScopeVisitor.html @@ -0,0 +1,752 @@ + + + + + + + + + + + + + + + + Ameba::AST::ScopeVisitor - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::ScopeVisitor + +

+ + + + + + + +

+ + + + Overview +

+ +

AST Visitor that traverses the source and constructs scopes.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ RECORD_NODE_NAME = "record" +
+ + +
+ SUPER_NODE_NAME = "super" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + +

Instance methods inherited from class Ameba::AST::BaseVisitor

+ + + + visit(node : Crystal::ASTNode) + visit + + + + + + +

Constructor methods inherited from class Ameba::AST::BaseVisitor

+ + + + new(rule, source) + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(rule, source) + + # +
+ +
+
+ +
+
+ + + + + + + + + +
+ + + diff --git a/Ameba/AST/Util.html b/Ameba/AST/Util.html new file mode 100644 index 00000000..000c50bf --- /dev/null +++ b/Ameba/AST/Util.html @@ -0,0 +1,913 @@ + + + + + + + + + + + + + + + + Ameba::AST::Util - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::AST::Util + +

+ + + + + +

+ + + + Overview +

+ +

Utility module for Ameba's rules.

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def abort?(node) + + # +
+ +
+ +

Returns true if node represents abort method call.

+
+ +
+
+ +
+
+ +
+
+ + def exit?(node) + + # +
+ +
+ +

Returns true if node represents exit method call.

+
+ +
+
+ +
+
+ +
+
+ + def flow_command?(node, in_loop) + + # +
+ +
+ +

Returns true if node is a flow command, false - otherwise. +Node represents a flow command if it is a control expression, +or special call node that interrupts execution (i.e. raise, exit, abort).

+
+ +
+
+ +
+
+ +
+
+ + def flow_expression?(node, in_loop = false) + + # +
+ +
+ +

Returns true if node is a flow expression, false if not. +Node represents a flow expression if it is full-filled by a flow command.

+ +

For example, this node is a flow expression, because each branch contains +a flow command return:

+ +
if a > 0
+  return :positive
+elsif a < 0
+  return :negative
+else
+  return :zero
+end
+ +

This node is a not a flow expression:

+ +
if a > 0
+  return :positive
+end
+ +

That's because not all branches return(i.e. else is missing).

+
+ +
+
+ +
+
+ +
+
+ + def literal?(node) + + # +
+ +
+ +

Returns true if current node is a literal, false otherwise.

+
+ +
+
+ +
+
+ +
+
+ + def loop?(node) + + # +
+ +
+ +

Returns true if node represents a loop.

+
+ +
+
+ +
+
+ +
+
+ + def node_source(node, code_lines) + + # +
+ +
+ +

Returns a source code for the current node. +This method uses node.location and node.end_location +to determine and cut a piece of source of the node.

+
+ +
+
+ +
+
+ +
+
+ + def raise?(node) + + # +
+ +
+ +

Returns true if node represents raise method call.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/AST/Variable.html b/Ameba/AST/Variable.html new file mode 100644 index 00000000..f9e3ee3a --- /dev/null +++ b/Ameba/AST/Variable.html @@ -0,0 +1,1334 @@ + + + + + + + + + + + + + + + + Ameba::AST::Variable - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::AST::Variable + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents the existence of the local variable. +Holds the var node and variable assigments.

+ + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(node, scope) + + # +
+ +
+ +

Creates a new variable(in the scope).

+ +
Variable.new(node, scope)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def assign(node, scope) + + # +
+ +
+ +

Assigns the variable (creates a new assignment). +Variable may have multiple assignments.

+ +
variable = Variable.new(node, scope)
+variable.assign(node1)
+variable.assign(node2)
+variable.assignment.size # => 2
+
+ +
+
+ +
+
+ +
+
+ + def assign_before_reference : Crystal::ASTNode? + + # +
+ +
+ +

Node of the first assignment which can be available before any reference.

+
+ +
+
+ +
+
+ +
+
+ + def assignments : Array(Ameba::AST::Assignment) + + # +
+ +
+ +

List of the assigments of this variable.

+
+ +
+
+ +
+
+ +
+
+ + def captured_by_block?(scope = @scope) + + # +
+ +
+ +

Returns true if the current var is referenced in +in the block. For example this variable is captured +by block:

+ +
a = 1
+3.times { |i| a = a + i }
+ +

And this variable is not captured by block.

+ +
i = 1
+3.times { |i| i + 1 }
+
+ +
+
+ +
+
+ +
+
+ + def declared_before?(node) + + # +
+ +
+ +

Returns true if the variable is delcared before the #node.

+
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def eql?(node) + + # +
+ +
+ +

Returns true if the #node represents exactly +the same Crystal node as @node.

+
+ +
+
+ +
+
+ +
+
+ + def ignored? + + # +
+ +
+ +

Returns true if the name starts with '_', false if not.

+
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def location(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def name(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def name(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def node : Crystal::Var + + # +
+ +
+ +

The actual var node.

+
+ +
+
+ +
+
+ +
+
+ + def reference(node : Crystal::Var, scope : Scope) + + # +
+ +
+ +

Creates a reference to this variable in some scope.

+ +
variable = Variable.new(node, scope)
+variable.reference(var_node, some_scope)
+
+ +
+
+ +
+
+ +
+
+ + def reference_assignments! + + # +
+ +
+ +

Reference variable's assignments.

+ +
variable = Variable.new(node, scope)
+variable.assign(assign_node)
+variable.reference_assignments!
+
+ +
+
+ +
+
+ +
+
+ + def referenced? + + # +
+ +
+ +

Returns true if variable has any reference.

+ +
variable = Variable.new(node, scope)
+variable.reference(var_node)
+variable.referenced? # => true
+
+ +
+
+ +
+
+ +
+
+ + def references : Array(Ameba::AST::Reference) + + # +
+ +
+ +

List of the references of this variable.

+
+ +
+
+ +
+
+ +
+
+ + def scope : Scope + + # +
+ +
+ +

Scope of this variable.

+
+ +
+
+ +
+
+ +
+
+ + def special? + + # +
+ +
+ +

Returns true if it is a special variable, i.e $?.

+
+ +
+
+ +
+
+ +
+
+ + def target_of?(assign) + + # +
+ +
+ +

Returns true if the variable is a target (on the left) of the assignment, +false otherwise.

+
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def used_in_macro?(scope = @scope) + + # +
+ +
+ +

Returns true if current variable potentially referenced in a macro literal, +false if not.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Config.html b/Ameba/Config.html new file mode 100644 index 00000000..94285eb4 --- /dev/null +++ b/Ameba/Config.html @@ -0,0 +1,1168 @@ + + + + + + + + + + + + + + + + Ameba::Config - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Config + +

+ + + + + + + +

+ + + + Overview +

+ +

A configuration entry for Ameba::Runner.

+ +

Config can be loaded from configuration YAML file and adjusted.

+ +
config = Config.load
+config.formatter = my_formatter
+ +

By default config loads .ameba.yml file in a current directory.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ AVAILABLE_FORMATTERS = {progress: Formatter::DotFormatter, todo: Formatter::TODOFormatter, flycheck: Formatter::FlycheckFormatter, silent: Formatter::BaseFormatter, disabled: Formatter::DisabledFormatter, json: Formatter::JSONFormatter} +
+ + +
+ DEFAULT_GLOBS = ["**/*.cr", "!lib"] of ::String +
+ + +
+ PATH = ".ameba.yml" +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

Instance methods inherited from module Ameba::GlobUtils

+ + + + expand(globs) + expand, + + + + find_files_by_globs(globs) + find_files_by_globs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.formatter_names + + # +
+ +
+
+ +
+
+ +
+
+ + def self.load(path = PATH, colors = true) + + # +
+ +
+ +

Loads YAML configuration file by path.

+ +
config = Ameba::Config.load
+
+ +
+
+ +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def excluded : Array(String) + + # +
+ +
+ +

Represents a list of paths to exclude from globs. +Can have wildcards.

+ +
config = Ameba::Config.load
+config.excluded = ["spec", "src/server/*.cr"]
+
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)) + + # +
+ +
+ +

Represents a list of paths to exclude from globs. +Can have wildcards.

+ +
config = Ameba::Config.load
+config.excluded = ["spec", "src/server/*.cr"]
+
+ +
+
+ +
+
+ +
+
+ + def formatter + + # +
+ +
+ +

Returns a formatter to be used while inspecting files. +If formatter is not set, it will return default formatter.

+ +
config = Ameba::Config.load
+config.formatter = custom_formatter
+config.formatter
+
+ +
+
+ +
+
+ +
+
+ + def formatter=(formatter : Formatter::BaseFormatter?) + + # +
+ +
+
+ +
+
+ +
+
+ + def formatter=(name : String | Symbol) + + # +
+ +
+ +

Sets formatter by name.

+ +
config = Ameba::Config.load
+config.formatter = :progress
+
+ +
+
+ +
+
+ +
+
+ + def globs : Array(String) + + # +
+ +
+ +

Returns a list of paths (with wildcards) to files. +Represents a list of sources to be inspected. +If globs are not set, it will return default list of files.

+ +
config = Ameba::Config.load
+config.globs = ["**/*.cr"]
+config.globs
+
+ +
+
+ +
+
+ +
+
+ + def globs=(globs : Array(String)) + + # +
+ +
+ +

Returns a list of paths (with wildcards) to files. +Represents a list of sources to be inspected. +If globs are not set, it will return default list of files.

+ +
config = Ameba::Config.load
+config.globs = ["**/*.cr"]
+config.globs
+
+ +
+
+ +
+
+ +
+
+ + def rules : Array(Rule::Base) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def sources + + # +
+ +
+ +

Returns a list of sources matching globs and excluded sections.

+ +
config = Ameba::Config.load
+config.sources # => list of default sources
+config.globs = ["**/*.cr"]
+config.excluded = ["spec"]
+config.sources # => list of sources pointing to files found by the wildcards
+
+ +
+
+ +
+
+ +
+
+ + def update_rule(name, enabled = true, excluded = nil) + + # +
+ +
+ +

Updates rule properties.

+ +
config = Ameba::Config.load
+config.update_rule "MyRuleName", enabled: false
+
+ +
+
+ +
+
+ +
+
+ + def update_rules(names, **args) + + # +
+ +
+ +

Updates rules properties.

+ +
config = Ameba::Config.load
+config.update_rules %w(Rule1 Rule2), enabled: true
+ +

also it allows to update groups of rules:

+ +
config.update_rules %w(Group1 Group2), enabled: true
+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter.html b/Ameba/Formatter.html new file mode 100644 index 00000000..8904d8f9 --- /dev/null +++ b/Ameba/Formatter.html @@ -0,0 +1,627 @@ + + + + + + + + + + + + + + + + Ameba::Formatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Formatter + +

+ + + + + +

+ + + + Overview +

+ +

A module that utilizes Ameba's formatters.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Ameba/Formatter/BaseFormatter.html b/Ameba/Formatter/BaseFormatter.html new file mode 100644 index 00000000..b870812d --- /dev/null +++ b/Ameba/Formatter/BaseFormatter.html @@ -0,0 +1,887 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::BaseFormatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Formatter::BaseFormatter + +

+ + + + + + + +

+ + + + Overview +

+ +

A base formatter for all formatters. It uses #output IO +to report results and also implements stub methods for +callbacks in Ameba::Runner#run method.

+ + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(output = STDOUT) + + # +
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def config : Hash(Symbol, Bool | String) + + # +
+ +
+
+ +
+
+ +
+
+ + def finished(sources) + + # +
+ +
+ +

Callback that indicates when inspection is finished. +A list of inspected sources is passed as an argument.

+
+ +
+
+ +
+
+ +
+
+ + def output : IO::FileDescriptor | IO::Memory + + # +
+ +
+ +

TODO allow other IOs

+
+ +
+
+ +
+
+ +
+
+ + def source_finished(source : Source) + + # +
+ +
+ +

Callback that indicates when source inspection is finished. +A corresponding source is passed as an argument.

+
+ +
+
+ +
+
+ +
+
+ + def source_started(source : Source) + + # +
+ +
+ +

Callback that indicates when source inspection is finished. +A corresponding source is passed as an argument.

+
+ +
+
+ +
+
+ +
+
+ + def started(sources) + + # +
+ +
+ +

Callback that indicates when inspecting is started. +A list of sources to inspect is passed as an argument.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter/DisabledFormatter.html b/Ameba/Formatter/DisabledFormatter.html new file mode 100644 index 00000000..eb5cd3d6 --- /dev/null +++ b/Ameba/Formatter/DisabledFormatter.html @@ -0,0 +1,755 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::DisabledFormatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Formatter::DisabledFormatter + +

+ + + + + + + +

+ + + + Overview +

+ +

A formatter that shows all disabled lines by inline directives.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def finished(sources) + + # +
+ +
+ +
+ Description copied from class Ameba::Formatter::BaseFormatter +
+ +

Callback that indicates when inspection is finished. +A list of inspected sources is passed as an argument.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter/DotFormatter.html b/Ameba/Formatter/DotFormatter.html new file mode 100644 index 00000000..cde14a56 --- /dev/null +++ b/Ameba/Formatter/DotFormatter.html @@ -0,0 +1,850 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::DotFormatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Formatter::DotFormatter + +

+ + + + + + + +

+ + + + Overview +

+ +

A formatter that shows a progress of inspection in a terminal using dots. +It is similar to Crystal's dot formatter for specs.

+ + + + + +

+ + + + Included Modules +

+ + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def finished(sources) + + # +
+ +
+ +

Reports a message when inspection is finished.

+
+ +
+
+ +
+
+ +
+
+ + def source_finished(source : Source) + + # +
+ +
+ +

Reports a result of the inspection of a corresponding source.

+
+ +
+
+ +
+
+ +
+
+ + def started(sources) + + # +
+ +
+ +

Reports a message when inspection is started.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter/ExplainFormatter.html b/Ameba/Formatter/ExplainFormatter.html new file mode 100644 index 00000000..add13bc8 --- /dev/null +++ b/Ameba/Formatter/ExplainFormatter.html @@ -0,0 +1,851 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::ExplainFormatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Formatter::ExplainFormatter + +

+ + + + + + + +

+ + + + Overview +

+ +

A formatter that shows the detailed explanation of the issue at +a specific location.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HEADING = "## " +
+ + +
+ LINE_BREAK = "\n" +
+ + +
+ PREFIX = " " +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

Instance methods inherited from module Ameba::Formatter::Util

+ + + + affected_code(source, location, max_length = 100, placeholder = " ...", prompt = "> ") + affected_code + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(output, loc) + + # +
+ +
+ +

Creates a new instance of ExplainFormatter. +Accepts output which indicates the io where the explanation will be wrtitten to. +Second argument is location which indicates the location to explain.

+ +
ExplainFormatter.new output,
+  {file: path, line: line_number, column: column_number}
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def finished(sources) + + # +
+ +
+ +

Reports the explainations at the @location.

+
+ +
+
+ +
+
+ +
+
+ + def location : Crystal::Location + + # +
+ +
+
+ +
+
+ +
+
+ + def output : IO::FileDescriptor | IO::Memory + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter/FlycheckFormatter.html b/Ameba/Formatter/FlycheckFormatter.html new file mode 100644 index 00000000..9c28d11f --- /dev/null +++ b/Ameba/Formatter/FlycheckFormatter.html @@ -0,0 +1,744 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::FlycheckFormatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Formatter::FlycheckFormatter + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def source_finished(source : Source) + + # +
+ +
+ +
+ Description copied from class Ameba::Formatter::BaseFormatter +
+ +

Callback that indicates when source inspection is finished. +A corresponding source is passed as an argument.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter/JSONFormatter.html b/Ameba/Formatter/JSONFormatter.html new file mode 100644 index 00000000..6b217729 --- /dev/null +++ b/Ameba/Formatter/JSONFormatter.html @@ -0,0 +1,916 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::JSONFormatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Formatter::JSONFormatter + +

+ + + + + + + +

+ + + + Overview +

+ +

A formatter that produces the result in a json format.

+ +

Example:

+ +
{
+  "metadata": {
+    "ameba_version":   "x.x.x",
+    "crystal_version": "x.x.x",
+  },
+  "sources": [
+    {
+      "issues": [
+        {
+          "location": {
+            "column": 7,
+            "line":   17,
+          },
+          "end_location": {
+            "column": 20,
+            "line":   17,
+          },
+          "message":   "Useless assignment to variable `a`",
+          "rule_name": "UselessAssign",
+          "severity":  "Convention",
+        },
+        {
+          "location": {
+            "column": 7,
+            "line":   18,
+          },
+          "end_location": {
+            "column": 8,
+            "line":   18,
+          },
+          "message":   "Useless assignment to variable `a`",
+          "rule_name": "UselessAssign",
+        },
+        {
+          "location": {
+            "column": 7,
+            "line":   19,
+          },
+          "end_location": {
+            "column": 9,
+            "line":   19,
+          },
+          "message":   "Useless assignment to variable `a`",
+          "rule_name": "UselessAssign",
+          "severity":  "Convention",
+        },
+      ],
+      "path": "src/ameba/formatter/json_formatter.cr",
+    },
+  ],
+  "summary": {
+    "issues_count":         3,
+    "target_sources_count": 1,
+  },
+}
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(output = STDOUT) + + # +
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def finished(sources) + + # +
+ +
+ +
+ Description copied from class Ameba::Formatter::BaseFormatter +
+ +

Callback that indicates when inspection is finished. +A list of inspected sources is passed as an argument.

+
+ +
+
+ +
+
+ +
+
+ + def source_finished(source : Source) + + # +
+ +
+ +
+ Description copied from class Ameba::Formatter::BaseFormatter +
+ +

Callback that indicates when source inspection is finished. +A corresponding source is passed as an argument.

+
+ +
+
+ +
+
+ +
+
+ + def started(sources) + + # +
+ +
+ +
+ Description copied from class Ameba::Formatter::BaseFormatter +
+ +

Callback that indicates when inspecting is started. +A list of sources to inspect is passed as an argument.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter/TODOFormatter.html b/Ameba/Formatter/TODOFormatter.html new file mode 100644 index 00000000..d041a342 --- /dev/null +++ b/Ameba/Formatter/TODOFormatter.html @@ -0,0 +1,845 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::TODOFormatter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Formatter::TODOFormatter + +

+ + + + + + + +

+ + + + Overview +

+ +

A formatter that creates a todo config. +Basically, it takes all issues reported and disables corresponding rules +or excludes failed sources from these rules.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(output = STDOUT) + + # +
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def finished(sources) + + # +
+ +
+ +
+ Description copied from class Ameba::Formatter::DotFormatter +
+ +

Reports a message when inspection is finished.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Formatter/Util.html b/Ameba/Formatter/Util.html new file mode 100644 index 00000000..b3248529 --- /dev/null +++ b/Ameba/Formatter/Util.html @@ -0,0 +1,673 @@ + + + + + + + + + + + + + + + + Ameba::Formatter::Util - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Formatter::Util + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def affected_code(source, location, max_length = 100, placeholder = " ...", prompt = "> ") + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/GlobUtils.html b/Ameba/GlobUtils.html new file mode 100644 index 00000000..5b2bcdc7 --- /dev/null +++ b/Ameba/GlobUtils.html @@ -0,0 +1,720 @@ + + + + + + + + + + + + + + + + Ameba::GlobUtils - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::GlobUtils + +

+ + + + + +

+ + + + Overview +

+ +

Helper module that is utilizes helpers for working with globs.

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def expand(globs) + + # +
+ +
+ +

Expands globs. Globs can point to files or even directories.

+ +
expand(["spec/*.cr", "src"]) # => all files in src folder + first level specs
+
+ +
+
+ +
+
+ +
+
+ + def find_files_by_globs(globs) + + # +
+ +
+ +

Returns all files that match specified globs. +Globs can have wildcards or be rejected:

+ +
find_files_by_globs(["**/*.cr", "!lib"])
+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/InlineComments.html b/Ameba/InlineComments.html new file mode 100644 index 00000000..7d898b62 --- /dev/null +++ b/Ameba/InlineComments.html @@ -0,0 +1,793 @@ + + + + + + + + + + + + + + + + Ameba::InlineComments - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::InlineComments + +

+ + + + + +

+ + + + Overview +

+ +

A module that utilizes inline comments parsing and processing logic.

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ COMMENT_DIRECTIVE_REGEX = /# ameba:(?<action>\w+) (?<rules>\w+(?:\/\w+)?(?:,? \w+(?:\/\w+)?)*)/ +
+ + +
+ + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def comment?(line_number : Int32) + + # +
+ +
+ +

Returns true if the line at the given line_number is a comment.

+
+ +
+
+ +
+
+ +
+
+ + def location_disabled?(location, rule) + + # +
+ +
+ +

Returns true if current location is disabled for a particular rule, +false otherwise.

+ +

Location is disabled in two cases:

+ +
  1. The line of the location ends with a comment directive.
  2. The line above the location is a comment directive.
+ +

For example, here are two examples of disabled location:

+ +
# ameba:disable Style/LargeNumbers
+Time.epoch(1483859302)
+
+Time.epoch(1483859302) # ameba:disable Style/LargeNumbers
+ +

But here are examples which are not considered as disabled location:

+ +
# ameba:disable Style/LargeNumbers
+#
+Time.epoch(1483859302)
+
+if use_epoch? # ameba:disable Style/LargeNumbers
+  Time.epoch(1483859302)
+end
+
+ +
+
+ +
+
+ +
+
+ + def parse_inline_directive(line) + + # +
+ +
+ +

Parses inline comment directive. Returns a tuple that consists of +an action and parsed rules if directive found, nil otherwise.

+ +
line = "# ameba:disable Rule1, Rule2"
+directive = parse_inline_directive(line)
+directive[:action] # => "disable"
+directive[:rules]  # => ["Rule1", "Rule2"]
+ +

It ignores the directive if it is commented out.

+ +
line = "# # ameba:disable Rule1, Rule2"
+parse_inline_directive(line) # => nil
+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/InlineComments/Action.html b/Ameba/InlineComments/Action.html new file mode 100644 index 00000000..10cc59e3 --- /dev/null +++ b/Ameba/InlineComments/Action.html @@ -0,0 +1,751 @@ + + + + + + + + + + + + + + + + Ameba::InlineComments::Action - ameba 0.13.3-dev + + + + + + + + +
+

+ + enum Ameba::InlineComments::Action + +

+ + + + + +

+ + + + Overview +

+ +

Available actions in the inline comments

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Enum Members +

+ +
+ +
+ Disable = 0 +
+ + +
+ Enable = 1 +
+ + +
+ + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def disable? + + # +
+ +
+
+ +
+
+ +
+
+ + def enable? + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Issue.html b/Ameba/Issue.html new file mode 100644 index 00000000..610042c1 --- /dev/null +++ b/Ameba/Issue.html @@ -0,0 +1,893 @@ + + + + + + + + + + + + + + + + Ameba::Issue - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Issue + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents an issue reported by Ameba.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(rule : Rule::Base, location : Crystal::Location?, end_location : Crystal::Location?, message : String, status : Symbol?) + + # +
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clone + + # +
+ +
+
+ +
+
+ +
+
+ + def copy_with(rule _rule = @rule, location _location = @location, end_location _end_location = @end_location, message _message = @message, status _status = @status) + + # +
+ +
+
+ +
+
+ +
+
+ + def disabled? + + # +
+ +
+
+ +
+
+ +
+
+ + def end_location : Crystal::Location? + + # +
+ +
+
+ +
+
+ +
+
+ + def location : Crystal::Location? + + # +
+ +
+
+ +
+
+ +
+
+ + def message : String + + # +
+ +
+
+ +
+
+ +
+
+ + def rule : Rule::Base + + # +
+ +
+
+ +
+
+ +
+
+ + def status : Symbol? + + # +
+ +
+
+ +
+
+ +
+
+ + def syntax? + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Reportable.html b/Ameba/Reportable.html new file mode 100644 index 00000000..e5c3d8f1 --- /dev/null +++ b/Ameba/Reportable.html @@ -0,0 +1,845 @@ + + + + + + + + + + + + + + + + Ameba::Reportable - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Reportable + +

+ + + + + +

+ + + + Overview +

+ +

Represents a module used to report issues.

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def add_issue(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, **args) + + # +
+ +
+ +

Adds a new issue for location and end_location defined by line and column numbers.

+
+ +
+
+ +
+
+ +
+
+ + def add_issue(rule, location, end_location, message, status = nil) + + # +
+ +
+ +

Adds a new issue to the list of issues.

+
+ +
+
+ +
+
+ +
+
+ + def add_issue(rule, location : Tuple(Int32, Int32), message, **args) + + # +
+ +
+ +

Adds a new issue for location defined by line and column numbers.

+
+ +
+
+ +
+
+ +
+
+ + def add_issue(rule, node : Crystal::ASTNode, message, **args) + + # +
+ +
+ +

Adds a new issue for AST node.

+
+ +
+
+ +
+
+ +
+
+ + def add_issue(rule, token : Crystal::Token, message, **args) + + # +
+ +
+ +

Adds a new issue for Crystal token.

+
+ +
+
+ +
+
+ +
+
+ + def issues + + # +
+ +
+ +

List of reported issues.

+
+ +
+
+ +
+
+ +
+
+ + def valid? + + # +
+ +
+ +

Returns true if the list of not disabled issues is empty, false otherwise.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule.html b/Ameba/Rule.html new file mode 100644 index 00000000..62cfe727 --- /dev/null +++ b/Ameba/Rule.html @@ -0,0 +1,690 @@ + + + + + + + + + + + + + + + + Ameba::Rule - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Rule + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECIAL = [Lint::Syntax.rule_name, Lint::UnneededDisableDirective.rule_name] +
+ +
+

List of names of the special rules, which +behave differently than usual rules.

+
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.rules + + # +
+ +
+ +

Returns a list of all available rules.

+ +
Ameba::Rule.rules # => [Rule1, Rule2, ....]
+
+ +
+
+ +
+
+ + + + + + + +
+ + + diff --git a/Ameba/Rule/Base.html b/Ameba/Rule/Base.html new file mode 100644 index 00000000..950019ec --- /dev/null +++ b/Ameba/Rule/Base.html @@ -0,0 +1,1251 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Base - ameba 0.13.3-dev + + + + + + + + +
+

+ + abstract struct Ameba::Rule::Base + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents a base of all rules. In other words, all rules +inherits from this struct:

+ +
struct MyRule < Ameba::Rule::Base
+  def test(source)
+    if invalid?(source)
+      issue_for line, column, "Something wrong."
+    end
+  end
+
+  private def invalid?(source)
+    # ...
+  end
+end
+ +

Enforces rules to implement an abstract #test method which +is designed to test the source passed in. If source has issues +that are tested by this rule, it should add an issue.

+ + + + + +

+ + + + Included Modules +

+ + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +

+ + + + Macro Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new + + # +
+ +
+
+ +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.parsed_doc + + # +
+ +
+ +

Returns documentation for this rule if any.

+ +
module Ameba
+  # This is a test rule.
+  # Does nothing.
+  struct MyRule < Ameba::Rule::Base
+    def test(source)
+    end
+  end
+end
+
+MyRule.parsed_doc # => "This is a test rule.\nDoes nothing."
+
+ +
+
+ +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def ==(other) + + # +
+ +
+ +
+ Description copied from struct Struct +
+ +

Returns true if this struct is equal to other.

+ +

Both structs' instance vars are compared to each other. Thus, two +structs are considered equal if each of their instance variables are +equal. Subclasses should override this method to provide specific +equality semantics.

+ +
struct Point
+  def initialize(@x : Int32, @y : Int32)
+  end
+end
+
+p1 = Point.new 1, 2
+p2 = Point.new 1, 2
+p3 = Point.new 3, 4
+
+p1 == p2 # => true
+p1 == p3 # => false
+
+ +
+
+ +
+
+ +
+
+ + def catch(source : Source) + + # +
+ +
+ +

A convenient addition to #test method that does the same +but returns a passed in source as an addition.

+ +
source = MyRule.new.catch(source)
+source.valid?
+
+ +
+
+ +
+
+ +
+
+ + def excluded?(source) + + # +
+ +
+ +

Checks whether the source is excluded from this rule. +It searches for a path in excluded property which matches +the one of the given source.

+ +
my_rule.excluded?(source) # => true or false
+
+ +
+
+ +
+
+ +
+
+ + def group + + # +
+ +
+ +

Returns a group this rule belong to.

+ +
struct MyGroup::MyRule < Ameba::Rule::Base
+  # ...
+end
+
+MyGroup::MyRule.new.group # => "MyGroup"
+
+ +
+
+ +
+
+ +
+
+ + def hash + + # +
+ +
+ +
+ Description copied from class Object +
+ +

Generates an UInt64 hash value for this object.

+ +

This method must have the property that a == b implies a.hash == b.hash.

+ +

The hash value is used along with #== by the Hash class to determine if two objects +reference the same hash key.

+ +

Subclasses must not override this method. Instead, they must define hash(hasher), +though usually the macro def_hash can be used to generate this method.

+
+ +
+
+ +
+
+ +
+
+ + def name + + # +
+ +
+ +

Returns a name of this rule, which is basically a class name.

+ +
struct MyRule < Ameba::Rule::Base
+  def test(source)
+  end
+end
+
+MyRule.new.name # => "MyRule"
+
+ +
+
+ +
+
+ +
+
+ + def special? + + # +
+ +
+ +

Returns true if this rule is special and behaves differently than +usual rules.

+ +
my_rule.special? # => true or false
+
+ +
+
+ +
+
+ +
+
+ + def test(source : Source, node : Crystal::ASTNode, *opts) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source : Source) + + # +
+ +
+ +

This method is designed to test the source passed in. If source has issues +that are tested by this rule, it should add an issue.

+ +

Be default it uses a node visitor to traverse all the nodes in the source. +Must be overriten for other type of rules.

+
+ +
+
+ +
+
+ + + + +

+ + + + Macro Detail +

+ +
+
+ + macro issue_for(*args) + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Ameba/Rule/Layout.html b/Ameba/Rule/Layout.html new file mode 100644 index 00000000..b16e545d --- /dev/null +++ b/Ameba/Rule/Layout.html @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Layout - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Rule::Layout + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Ameba/Rule/Layout/LineLength.html b/Ameba/Rule/Layout/LineLength.html new file mode 100644 index 00000000..2109971a --- /dev/null +++ b/Ameba/Rule/Layout/LineLength.html @@ -0,0 +1,1106 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Layout::LineLength - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Layout::LineLength + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows lines longer than #max_length number of symbols.

+ +

YAML configuration example:

+ +
Layout/LineLength:
+  Enabled: true
+  MaxLength: 100
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Line too long" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows lines longer than #max_length number of symbols.

+ +

YAML configuration example:

+ +
Layout/LineLength:
+  Enabled: true
+  MaxLength: 100
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def max_length : Int32 + + # +
+ +
+
+ +
+
+ +
+
+ + def max_length=(max_length : Int32) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Layout/TrailingBlankLines.html b/Ameba/Rule/Layout/TrailingBlankLines.html new file mode 100644 index 00000000..ac211a85 --- /dev/null +++ b/Ameba/Rule/Layout/TrailingBlankLines.html @@ -0,0 +1,1071 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Layout::TrailingBlankLines - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Layout::TrailingBlankLines + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows trailing blank lines at the end of the source file.

+ +

YAML configuration example:

+ +
Layout/TrailingBlankLines:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Excessive trailing newline detected" +
+ + +
+ MSG_FINAL_NEWLINE = "Trailing newline missing" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows trailing blank lines at the end of the source file.

+ +

YAML configuration example:

+ +
Layout/TrailingBlankLines:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Layout/TrailingWhitespace.html b/Ameba/Rule/Layout/TrailingWhitespace.html new file mode 100644 index 00000000..45760feb --- /dev/null +++ b/Ameba/Rule/Layout/TrailingWhitespace.html @@ -0,0 +1,1066 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Layout::TrailingWhitespace - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Layout::TrailingWhitespace + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows trailing whitespaces.

+ +

YAML configuration example:

+ +
Layout/TrailingWhitespace:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Trailing whitespace detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows trailing whitespaces.

+ +

YAML configuration example:

+ +
Layout/TrailingWhitespace:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint.html b/Ameba/Rule/Lint.html new file mode 100644 index 00000000..0767454d --- /dev/null +++ b/Ameba/Rule/Lint.html @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Rule::Lint + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Ameba/Rule/Lint/BadDirective.html b/Ameba/Rule/Lint/BadDirective.html new file mode 100644 index 00000000..83687d9a --- /dev/null +++ b/Ameba/Rule/Lint/BadDirective.html @@ -0,0 +1,1092 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::BadDirective - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::BadDirective + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that reports incorrect comment directives for Ameba.

+ +

For example, the user can mistakenly add a directive +to disable a rule that even doesn't exist:

+ +
# ameba:disable BadRuleName
+def foo
+  :bar
+end
+ +

YAML configuration example:

+ +
Lint/BadDirective:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ ALL_GROUP_NAMES = Rule.rules.map(&.group_name).uniq! +
+ + +
+ ALL_RULE_NAMES = Rule.rules.map(&.rule_name) +
+ + +
+ AVAILABLE_ACTIONS = InlineComments::Action.names.map(&.downcase) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that reports incorrect comment directives for Ameba.

+ +

For example, the user can mistakenly add a directive +to disable a rule that even doesn't exist:

+ +
# ameba:disable BadRuleName
+def foo
+  :bar
+end
+ +

YAML configuration example:

+ +
Lint/BadDirective:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/ComparisonToBoolean.html b/Ameba/Rule/Lint/ComparisonToBoolean.html new file mode 100644 index 00000000..7e5f9295 --- /dev/null +++ b/Ameba/Rule/Lint/ComparisonToBoolean.html @@ -0,0 +1,1086 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::ComparisonToBoolean - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::ComparisonToBoolean + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows comparison to booleans.

+ +

For example, these are considered invalid:

+ +
foo == true
+bar != false
+false === baz
+ +

This is because these expressions evaluate to true or false, so you +could get the same result by using either the variable directly, +or negating the variable.

+ +

YAML configuration example:

+ +
Lint/ComparisonToBoolean:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Comparison to a boolean is pointless" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows comparison to booleans.

+ +

For example, these are considered invalid:

+ +
foo == true
+bar != false
+false === baz
+ +

This is because these expressions evaluate to true or false, so you +could get the same result by using either the variable directly, +or negating the variable.

+ +

YAML configuration example:

+ +
Lint/ComparisonToBoolean:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/DebuggerStatement.html b/Ameba/Rule/Lint/DebuggerStatement.html new file mode 100644 index 00000000..f1160908 --- /dev/null +++ b/Ameba/Rule/Lint/DebuggerStatement.html @@ -0,0 +1,1072 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::DebuggerStatement - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::DebuggerStatement + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows calls to debugger.

+ +

This is because we don't want debugger breakpoints accidentally being +committed into our codebase.

+ +

YAML configuration example:

+ +
Lint/DebuggerStatement:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Possible forgotten debugger statement detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows calls to debugger.

+ +

This is because we don't want debugger breakpoints accidentally being +committed into our codebase.

+ +

YAML configuration example:

+ +
Lint/DebuggerStatement:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/EmptyEnsure.html b/Ameba/Rule/Lint/EmptyEnsure.html new file mode 100644 index 00000000..1bf29cc9 --- /dev/null +++ b/Ameba/Rule/Lint/EmptyEnsure.html @@ -0,0 +1,1118 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::EmptyEnsure - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::EmptyEnsure + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows empty ensure statement.

+ +

For example, this is considered invalid:

+ +
def some_method
+  do_some_stuff
+ensure
+end
+
+begin
+  do_some_stuff
+ensure
+end
+ +

And it should be written as this:

+ +
def some_method
+  do_some_stuff
+ensure
+  do_something_else
+end
+
+begin
+  do_some_stuff
+ensure
+  do_something_else
+end
+ +

YAML configuration example:

+ +
Lint/EmptyEnsure
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Empty `ensure` block detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows empty ensure statement.

+ +

For example, this is considered invalid:

+ +
def some_method
+  do_some_stuff
+ensure
+end
+
+begin
+  do_some_stuff
+ensure
+end
+ +

And it should be written as this:

+ +
def some_method
+  do_some_stuff
+ensure
+  do_something_else
+end
+
+begin
+  do_some_stuff
+ensure
+  do_something_else
+end
+ +

YAML configuration example:

+ +
Lint/EmptyEnsure
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::ExceptionHandler) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/EmptyExpression.html b/Ameba/Rule/Lint/EmptyExpression.html new file mode 100644 index 00000000..c76f9b27 --- /dev/null +++ b/Ameba/Rule/Lint/EmptyExpression.html @@ -0,0 +1,1178 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::EmptyExpression - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::EmptyExpression + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows empty expressions.

+ +

This is considered invalid:

+ +
foo = ()
+
+if ()
+  bar
+end
+ +

And this is valid:

+ +
foo = (some_expression)
+
+if (some_expression)
+  bar
+end
+ +

YAML configuration example:

+ +
Lint/EmptyExpression:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Avoid empty expression %s" +
+ + +
+ MSG_EXRS = "Avoid empty expressions" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows empty expressions.

+ +

This is considered invalid:

+ +
foo = ()
+
+if ()
+  bar
+end
+ +

And this is valid:

+ +
foo = (some_expression)
+
+if (some_expression)
+  bar
+end
+ +

YAML configuration example:

+ +
Lint/EmptyExpression:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::NilLiteral) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Expressions) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/EmptyLoop.html b/Ameba/Rule/Lint/EmptyLoop.html new file mode 100644 index 00000000..3a8f9953 --- /dev/null +++ b/Ameba/Rule/Lint/EmptyLoop.html @@ -0,0 +1,1212 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::EmptyLoop - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::EmptyLoop + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows empty loops.

+ +

This is considered invalid:

+ +
while false
+end
+
+until 10
+end
+
+loop do
+  # nothing here
+end
+ +

And this is valid:

+ +
a = 1
+while a < 10
+  a += 1
+end
+
+until socket_opened?
+end
+
+loop do
+  do_something_here
+end
+ +

YAML configuration example:

+ +
Lint/EmptyLoop:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Empty loop detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows empty loops.

+ +

This is considered invalid:

+ +
while false
+end
+
+until 10
+end
+
+loop do
+  # nothing here
+end
+ +

And this is valid:

+ +
a = 1
+while a < 10
+  a += 1
+end
+
+until socket_opened?
+end
+
+loop do
+  do_something_here
+end
+ +

YAML configuration example:

+ +
Lint/EmptyLoop:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::While) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Until) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/HashDuplicatedKey.html b/Ameba/Rule/Lint/HashDuplicatedKey.html new file mode 100644 index 00000000..98cf82fc --- /dev/null +++ b/Ameba/Rule/Lint/HashDuplicatedKey.html @@ -0,0 +1,1082 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::HashDuplicatedKey - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::HashDuplicatedKey + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows duplicated keys in hash literals.

+ +

This is considered invalid:

+ +
h = {"foo" => 1, "bar" => 2, "foo" => 3}
+ +

And it has to written as this instead:

+ +
h = {"foo" => 1, "bar" => 2}
+ +

YAML configuration example:

+ +
Lint/HashDuplicatedKey:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Duplicated keys in hash literal: %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows duplicated keys in hash literals.

+ +

This is considered invalid:

+ +
h = {"foo" => 1, "bar" => 2, "foo" => 3}
+ +

And it has to written as this instead:

+ +
h = {"foo" => 1, "bar" => 2}
+ +

YAML configuration example:

+ +
Lint/HashDuplicatedKey:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::HashLiteral) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/LiteralInCondition.html b/Ameba/Rule/Lint/LiteralInCondition.html new file mode 100644 index 00000000..fc8ef2eb --- /dev/null +++ b/Ameba/Rule/Lint/LiteralInCondition.html @@ -0,0 +1,1201 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::LiteralInCondition - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::LiteralInCondition + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows useless conditional statements that contain a literal +in place of a variable or predicate function.

+ +

This is because a conditional construct with a literal predicate will +always result in the same behaviour at run time, meaning it can be +replaced with either the body of the construct, or deleted entirely.

+ +

This is considered invalid:

+ +
if "something"
+  :ok
+end
+ +

YAML configuration example:

+ +
Lint/LiteralInCondition:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Literal value found in conditional" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows useless conditional statements that contain a literal +in place of a variable or predicate function.

+ +

This is because a conditional construct with a literal predicate will +always result in the same behaviour at run time, meaning it can be +replaced with either the body of the construct, or deleted entirely.

+ +

This is considered invalid:

+ +
if "something"
+  :ok
+end
+ +

YAML configuration example:

+ +
Lint/LiteralInCondition:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def check_node(source, node) + + # +
+ +
+
+ +
+
+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::If) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Unless) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Case) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/LiteralInInterpolation.html b/Ameba/Rule/Lint/LiteralInInterpolation.html new file mode 100644 index 00000000..e30046d1 --- /dev/null +++ b/Ameba/Rule/Lint/LiteralInInterpolation.html @@ -0,0 +1,1134 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::LiteralInInterpolation - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::LiteralInInterpolation + +

+ + + + + + + +

+ + + + 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 +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Literal value found in interpolation" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + 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
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::StringInterpolation) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/PercentArrays.html b/Ameba/Rule/Lint/PercentArrays.html new file mode 100644 index 00000000..6ca8a5bc --- /dev/null +++ b/Ameba/Rule/Lint/PercentArrays.html @@ -0,0 +1,1166 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::PercentArrays - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::PercentArrays + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows some unwanted symbols in percent array literals.

+ +

For example, this is usually written by mistake:

+ +
%i(:one, :two)
+%w("one", "two")
+ +

And the expected example is:

+ +
%i(one two)
+%w(one two)
+ +

YAML configuration example:

+ +
Lint/PercentArrays:
+  Enabled: true
+  StringArrayUnwantedSymbols: ',"'
+  SymbolArrayUnwantedSymbols: ',:'
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Symbols `%s` may be unwanted in %s array literals" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows some unwanted symbols in percent array literals.

+ +

For example, this is usually written by mistake:

+ +
%i(:one, :two)
+%w("one", "two")
+ +

And the expected example is:

+ +
%i(one two)
+%w(one two)
+ +

YAML configuration example:

+ +
Lint/PercentArrays:
+  Enabled: true
+  StringArrayUnwantedSymbols: ',"'
+  SymbolArrayUnwantedSymbols: ',:'
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def string_array_unwanted_symbols : String + + # +
+ +
+
+ +
+
+ +
+
+ + def string_array_unwanted_symbols=(string_array_unwanted_symbols : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def symbol_array_unwanted_symbols : String + + # +
+ +
+
+ +
+
+ +
+
+ + def symbol_array_unwanted_symbols=(symbol_array_unwanted_symbols : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/RandZero.html b/Ameba/Rule/Lint/RandZero.html new file mode 100644 index 00000000..642dd0e6 --- /dev/null +++ b/Ameba/Rule/Lint/RandZero.html @@ -0,0 +1,1088 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::RandZero - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::RandZero + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows rand(0) and rand(1) calls. +Such calls always return 0.

+ +

For example:

+ +
rand(1)
+ +

Should be written as:

+ +
rand
+# or
+rand(2)
+ +

YAML configuration example:

+ +
Lint/RandZero:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "%s always returns 0" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows rand(0) and rand(1) calls. +Such calls always return 0.

+ +

For example:

+ +
rand(1)
+ +

Should be written as:

+ +
rand
+# or
+rand(2)
+ +

YAML configuration example:

+ +
Lint/RandZero:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/RedundantStringCoercion.html b/Ameba/Rule/Lint/RedundantStringCoercion.html new file mode 100644 index 00000000..e236d0da --- /dev/null +++ b/Ameba/Rule/Lint/RedundantStringCoercion.html @@ -0,0 +1,1140 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::RedundantStringCoercion - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::RedundantStringCoercion + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows string conversion in string interpolation, +which is redundant.

+ +

For example, this is considered invalid:

+ +
"Hello, #{name.to_s}"
+ +

And this is valid:

+ +
"Hello, #{name}"
+ +

YAML configuration example:

+ +
Lint/RedundantStringCoersion
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Redundant use of `Object#to_s` in interpolation" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows string conversion in string interpolation, +which is redundant.

+ +

For example, this is considered invalid:

+ +
"Hello, #{name.to_s}"
+ +

And this is valid:

+ +
"Hello, #{name}"
+ +

YAML configuration example:

+ +
Lint/RedundantStringCoersion
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::StringInterpolation) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/RedundantWithIndex.html b/Ameba/Rule/Lint/RedundantWithIndex.html new file mode 100644 index 00000000..4495997f --- /dev/null +++ b/Ameba/Rule/Lint/RedundantWithIndex.html @@ -0,0 +1,1079 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::RedundantWithIndex - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::RedundantWithIndex + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows redundant with_index calls.

+ +

For example, this is considered invalid:

+ +
collection.each.with_index do |e|
+  # ...
+end
+
+collection.each_with_index do |e, _|
+  # ...
+end
+ +

and it should be written as follows:

+ +
collection.each do |e|
+  # ...
+end
+ +

YAML configuration example:

+ +
Lint/RedundantWithIndex:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows redundant with_index calls.

+ +

For example, this is considered invalid:

+ +
collection.each.with_index do |e|
+  # ...
+end
+
+collection.each_with_index do |e, _|
+  # ...
+end
+ +

and it should be written as follows:

+ +
collection.each do |e|
+  # ...
+end
+ +

YAML configuration example:

+ +
Lint/RedundantWithIndex:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/RedundantWithObject.html b/Ameba/Rule/Lint/RedundantWithObject.html new file mode 100644 index 00000000..46d00113 --- /dev/null +++ b/Ameba/Rule/Lint/RedundantWithObject.html @@ -0,0 +1,1079 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::RedundantWithObject - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::RedundantWithObject + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows redundant each_with_object calls.

+ +

For example, this is considered invalid:

+ +
collection.each_with_object(0) do |e|
+  # ...
+end
+
+collection.each_with_object(0) do |e, _|
+  # ...
+end
+ +

and it should be written as follows:

+ +
collection.each do |e|
+  # ...
+end
+ +

YAML configuration example:

+ +
Lint/RedundantWithObject:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows redundant each_with_object calls.

+ +

For example, this is considered invalid:

+ +
collection.each_with_object(0) do |e|
+  # ...
+end
+
+collection.each_with_object(0) do |e, _|
+  # ...
+end
+ +

and it should be written as follows:

+ +
collection.each do |e|
+  # ...
+end
+ +

YAML configuration example:

+ +
Lint/RedundantWithObject:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/ShadowedArgument.html b/Ameba/Rule/Lint/ShadowedArgument.html new file mode 100644 index 00000000..cdc8e6ec --- /dev/null +++ b/Ameba/Rule/Lint/ShadowedArgument.html @@ -0,0 +1,1133 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::ShadowedArgument - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::ShadowedArgument + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows shadowed arguments.

+ +

For example, this is considered invalid:

+ +
do_something do |foo|
+  foo = 1 # shadows block argument
+  foo
+end
+
+def do_something(foo)
+  foo = 1 # shadows method argument
+  foo
+end
+ +

and it should be written as follows:

+ +
do_something do |foo|
+  foo = foo + 42
+  foo
+end
+
+def do_something(foo)
+  foo = foo + 42
+  foo
+end
+ +

YAML configuration example:

+ +
Lint/ShadowedArgument:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Argument `%s` is assigned before it is used" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows shadowed arguments.

+ +

For example, this is considered invalid:

+ +
do_something do |foo|
+  foo = 1 # shadows block argument
+  foo
+end
+
+def do_something(foo)
+  foo = 1 # shadows method argument
+  foo
+end
+ +

and it should be written as follows:

+ +
do_something do |foo|
+  foo = foo + 42
+  foo
+end
+
+def do_something(foo)
+  foo = foo + 42
+  foo
+end
+ +

YAML configuration example:

+ +
Lint/ShadowedArgument:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/ShadowedException.html b/Ameba/Rule/Lint/ShadowedException.html new file mode 100644 index 00000000..bb959686 --- /dev/null +++ b/Ameba/Rule/Lint/ShadowedException.html @@ -0,0 +1,1110 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::ShadowedException - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::ShadowedException + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows a rescued exception that get shadowed by a +less specific exception being rescued before a more specific +exception is rescued.

+ +

For example, this is invalid:

+ +
begin
+  do_something
+rescue Exception
+  handle_exception
+rescue ArgumentError
+  handle_argument_error_exception
+end
+ +

And it has to be written as follows:

+ +
begin
+  do_something
+rescue ArgumentError
+  handle_argument_error_exception
+rescue Exception
+  handle_exception
+end
+ +

YAML configuration example:

+ +
Lint/ShadowedException:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Exception handler has shadowed exceptions: %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows a rescued exception that get shadowed by a +less specific exception being rescued before a more specific +exception is rescued.

+ +

For example, this is invalid:

+ +
begin
+  do_something
+rescue Exception
+  handle_exception
+rescue ArgumentError
+  handle_argument_error_exception
+end
+ +

And it has to be written as follows:

+ +
begin
+  do_something
+rescue ArgumentError
+  handle_argument_error_exception
+rescue Exception
+  handle_exception
+end
+ +

YAML configuration example:

+ +
Lint/ShadowedException:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::ExceptionHandler) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/ShadowingOuterLocalVar.html b/Ameba/Rule/Lint/ShadowingOuterLocalVar.html new file mode 100644 index 00000000..2f4cbeab --- /dev/null +++ b/Ameba/Rule/Lint/ShadowingOuterLocalVar.html @@ -0,0 +1,1142 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::ShadowingOuterLocalVar - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::ShadowingOuterLocalVar + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows the usage of the same name as outer local variables +for block or proc arguments.

+ +

For example, this is considered incorrect:

+ +
def some_method
+  foo = 1
+
+  3.times do |foo| # shadowing outer `foo`
+  end
+end
+ +

and should be written as:

+ +
def some_method
+  foo = 1
+
+  3.times do |bar|
+  end
+end
+ +

YAML configuration example:

+ +
Lint/ShadowingOuterLocalVar:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Shadowing outer local variable `%s`" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows the usage of the same name as outer local variables +for block or proc arguments.

+ +

For example, this is considered incorrect:

+ +
def some_method
+  foo = 1
+
+  3.times do |foo| # shadowing outer `foo`
+  end
+end
+ +

and should be written as:

+ +
def some_method
+  foo = 1
+
+  3.times do |bar|
+  end
+end
+ +

YAML configuration example:

+ +
Lint/ShadowingOuterLocalVar:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::ProcLiteral, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Block, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/SharedVarInFiber.html b/Ameba/Rule/Lint/SharedVarInFiber.html new file mode 100644 index 00000000..a028e385 --- /dev/null +++ b/Ameba/Rule/Lint/SharedVarInFiber.html @@ -0,0 +1,1161 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::SharedVarInFiber - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::SharedVarInFiber + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows using shared variables in fibers, +which are mutated during iterations.

+ +

In most cases it leads to unexpected behaviour and is undesired.

+ +

For example, having this example:

+ +
n = 0
+channel = Channel(Int32).new
+
+while n < 3
+  n = n + 1
+  spawn { channel.send n }
+end
+
+3.times { puts channel.receive } # => # 3, 3, 3
+ +

The problem is there is only one shared between fibers variable n +and when channel.receive is executed its value is 3.

+ +

To solve this, the code above needs to be rewritten to the following:

+ +
n = 0
+channel = Channel(Int32).new
+
+while n < 3
+  n = n + 1
+  m = n
+  spawn do { channel.send m }
+end
+
+3.times { puts channel.receive } # => # 1, 2, 3
+ +

This rule is able to find the shared variables between fibers, which are mutated +during iterations. So it reports the issue on the first sample and passes on +the second one.

+ +

There are also other technics to solve the problem above which are +officially documented

+ +

YAML configuration example:

+ +
Lint/SharedVarInFiber:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Shared variable `%s` is used in fiber" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows using shared variables in fibers, +which are mutated during iterations.

+ +

In most cases it leads to unexpected behaviour and is undesired.

+ +

For example, having this example:

+ +
n = 0
+channel = Channel(Int32).new
+
+while n < 3
+  n = n + 1
+  spawn { channel.send n }
+end
+
+3.times { puts channel.receive } # => # 3, 3, 3
+ +

The problem is there is only one shared between fibers variable n +and when channel.receive is executed its value is 3.

+ +

To solve this, the code above needs to be rewritten to the following:

+ +
n = 0
+channel = Channel(Int32).new
+
+while n < 3
+  n = n + 1
+  m = n
+  spawn do { channel.send m }
+end
+
+3.times { puts channel.receive } # => # 1, 2, 3
+ +

This rule is able to find the shared variables between fibers, which are mutated +during iterations. So it reports the issue on the first sample and passes on +the second one.

+ +

There are also other technics to solve the problem above which are +officially documented

+ +

YAML configuration example:

+ +
Lint/SharedVarInFiber:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/Syntax.html b/Ameba/Rule/Lint/Syntax.html new file mode 100644 index 00000000..fe0e900a --- /dev/null +++ b/Ameba/Rule/Lint/Syntax.html @@ -0,0 +1,1065 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::Syntax - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::Syntax + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that reports invalid Crystal syntax.

+ +

For example, this syntax is invalid:

+ +
def hello
+  do_something
+rescue Exception => e
+end
+ +

And should be properly written:

+ +
def hello
+  do_something
+rescue e : Exception
+end
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that reports invalid Crystal syntax.

+ +

For example, this syntax is invalid:

+ +
def hello
+  do_something
+rescue Exception => e
+end
+ +

And should be properly written:

+ +
def hello
+  do_something
+rescue e : Exception
+end
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity : Ameba::Severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/UnneededDisableDirective.html b/Ameba/Rule/Lint/UnneededDisableDirective.html new file mode 100644 index 00000000..80cc7f41 --- /dev/null +++ b/Ameba/Rule/Lint/UnneededDisableDirective.html @@ -0,0 +1,1092 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::UnneededDisableDirective - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::UnneededDisableDirective + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that reports unneeded disable directives. +For example, this is considered invalid:

+ +
# ameba:disable Style/PredicateName
+def comment?
+  do_something
+end
+ +

as the predicate name is correct and the comment directive does not +have any effect, the snippet should be written as the following:

+ +
def comment?
+  do_something
+end
+ +

YAML configuration example:

+ +
Lint/UnneededDisableDirective
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Unnecessary disabling of %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that reports unneeded disable directives. +For example, this is considered invalid:

+ +
# ameba:disable Style/PredicateName
+def comment?
+  do_something
+end
+ +

as the predicate name is correct and the comment directive does not +have any effect, the snippet should be written as the following:

+ +
def comment?
+  do_something
+end
+ +

YAML configuration example:

+ +
Lint/UnneededDisableDirective
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/UnreachableCode.html b/Ameba/Rule/Lint/UnreachableCode.html new file mode 100644 index 00000000..73e77059 --- /dev/null +++ b/Ameba/Rule/Lint/UnreachableCode.html @@ -0,0 +1,1193 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::UnreachableCode - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::UnreachableCode + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that reports unreachable code.

+ +

For example, this is considered invalid:

+ +
def method(a)
+  return 42
+  a + 1
+end
+ +
a = 1
+loop do
+  break
+  a += 1
+end
+ +

And has to be written as the following:

+ +
def method(a)
+  return 42 if a == 0
+  a + 1
+end
+ +
a = 1
+loop do
+  break a > 3
+  a += 1
+end
+ +

YAML configuration example:

+ +
Lint/UnreachableCode:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Unreachable code detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that reports unreachable code.

+ +

For example, this is considered invalid:

+ +
def method(a)
+  return 42
+  a + 1
+end
+ +
a = 1
+loop do
+  break
+  a += 1
+end
+ +

And has to be written as the following:

+ +
def method(a)
+  return 42 if a == 0
+  a + 1
+end
+ +
a = 1
+loop do
+  break a > 3
+  a += 1
+end
+ +

YAML configuration example:

+ +
Lint/UnreachableCode:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node, flow_expression : AST::FlowExpression) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/UnusedArgument.html b/Ameba/Rule/Lint/UnusedArgument.html new file mode 100644 index 00000000..13457d56 --- /dev/null +++ b/Ameba/Rule/Lint/UnusedArgument.html @@ -0,0 +1,1265 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::UnusedArgument - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::UnusedArgument + +

+ + + + + + + +

+ + + + 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 +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Unused argument `%s`. If it's necessary, use `%s` as an argument name to indicate that it won't be used." +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + 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
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def ignore_blocks : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def ignore_blocks=(ignore_blocks : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def ignore_defs : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def ignore_defs=(ignore_defs : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def ignore_procs : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def ignore_procs=(ignore_procs : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::ProcLiteral, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Block, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Def, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/UselessAssign.html b/Ameba/Rule/Lint/UselessAssign.html new file mode 100644 index 00000000..a6e6921c --- /dev/null +++ b/Ameba/Rule/Lint/UselessAssign.html @@ -0,0 +1,1113 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::UselessAssign - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::UselessAssign + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows useless assignments.

+ +

For example, this is considered invalid:

+ +
def method
+  var = 1
+  do_something
+end
+ +

And has to be written as the following:

+ +
def method
+  var = 1
+  do_something(var)
+end
+ +

YAML configuration example:

+ +
Lint/UselessAssign:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Useless assignment to variable `%s`" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows useless assignments.

+ +

For example, this is considered invalid:

+ +
def method
+  var = 1
+  do_something
+end
+ +

And has to be written as the following:

+ +
def method
+  var = 1
+  do_something(var)
+end
+ +

YAML configuration example:

+ +
Lint/UselessAssign:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node, scope : AST::Scope) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Lint/UselessConditionInWhen.html b/Ameba/Rule/Lint/UselessConditionInWhen.html new file mode 100644 index 00000000..f355eb7d --- /dev/null +++ b/Ameba/Rule/Lint/UselessConditionInWhen.html @@ -0,0 +1,1104 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Lint::UselessConditionInWhen - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Lint::UselessConditionInWhen + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows useless conditions in when clause +where it is guaranteed to always return the same result.

+ +

For example, this is considered invalid:

+ +
case
+when utc?
+  io << " UTC"
+when local?
+  Format.new(" %:z").format(self, io) if local?
+end
+ +

And has to be written as the following:

+ +
case
+when utc?
+  io << " UTC"
+when local?
+  Format.new(" %:z").format(self, io)
+end
+ +

YAML configuration example:

+ +
Lint/UselessConditionInWhen:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Useless condition in when detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows useless conditions in when clause +where it is guaranteed to always return the same result.

+ +

For example, this is considered invalid:

+ +
case
+when utc?
+  io << " UTC"
+when local?
+  Format.new(" %:z").format(self, io) if local?
+end
+ +

And has to be written as the following:

+ +
case
+when utc?
+  io << " UTC"
+when local?
+  Format.new(" %:z").format(self, io)
+end
+ +

YAML configuration example:

+ +
Lint/UselessConditionInWhen:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::When) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Metrics.html b/Ameba/Rule/Metrics.html new file mode 100644 index 00000000..c3d104b5 --- /dev/null +++ b/Ameba/Rule/Metrics.html @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Metrics - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Rule::Metrics + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Ameba/Rule/Metrics/CyclomaticComplexity.html b/Ameba/Rule/Metrics/CyclomaticComplexity.html new file mode 100644 index 00000000..9661df0b --- /dev/null +++ b/Ameba/Rule/Metrics/CyclomaticComplexity.html @@ -0,0 +1,1106 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Metrics::CyclomaticComplexity - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Metrics::CyclomaticComplexity + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity

+ +

YAML configuration example:

+ +
Metrics/CyclomaticComplexity:
+  Enabled: true
+  MaxComplexity: 10
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Cyclomatic complexity too high [%d/%d]" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity

+ +

YAML configuration example:

+ +
Metrics/CyclomaticComplexity:
+  Enabled: true
+  MaxComplexity: 10
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def max_complexity : Int32 + + # +
+ +
+
+ +
+
+ +
+
+ + def max_complexity=(max_complexity : Int32) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Def) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Performance.html b/Ameba/Rule/Performance.html new file mode 100644 index 00000000..77a3f94a --- /dev/null +++ b/Ameba/Rule/Performance.html @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Performance - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Rule::Performance + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Ameba/Rule/Performance/AnyAfterFilter.html b/Ameba/Rule/Performance/AnyAfterFilter.html new file mode 100644 index 00000000..3a461bb1 --- /dev/null +++ b/Ameba/Rule/Performance/AnyAfterFilter.html @@ -0,0 +1,1135 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Performance::AnyAfterFilter - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Performance::AnyAfterFilter + +

+ + + + + + + +

+ + + + Overview +

+ +

This rule is used to identify usage of any? calls that follow filters.

+ +

For example, this is considered invalid:

+ +
[1, 2, 3].select { |e| e > 2 }.any?
+[1, 2, 3].reject { |e| e >= 2 }.any?
+ +

And it should be written as this:

+ +
[1, 2, 3].any? { |e| e > 2 }
+[1, 2, 3].any? { |e| e < 2 }
+ +

YAML configuration example:

+ +
Performance/AnyAfterFilter:
+  Enabled: true
+  FilterNames:
+    - select
+    - reject
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ ANY_NAME = "any?" +
+ + +
+ MSG = "Use `#{ANY_NAME} {...}` instead of `%s {...}.#{ANY_NAME}`" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

This rule is used to identify usage of any? calls that follow filters.

+ +

For example, this is considered invalid:

+ +
[1, 2, 3].select { |e| e > 2 }.any?
+[1, 2, 3].reject { |e| e >= 2 }.any?
+ +

And it should be written as this:

+ +
[1, 2, 3].any? { |e| e > 2 }
+[1, 2, 3].any? { |e| e < 2 }
+ +

YAML configuration example:

+ +
Performance/AnyAfterFilter:
+  Enabled: true
+  FilterNames:
+    - select
+    - reject
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def filter_names : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def filter_names=(filter_names : Array(String)) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Performance/FirstLastAfterFilter.html b/Ameba/Rule/Performance/FirstLastAfterFilter.html new file mode 100644 index 00000000..8c651ebc --- /dev/null +++ b/Ameba/Rule/Performance/FirstLastAfterFilter.html @@ -0,0 +1,1157 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Performance::FirstLastAfterFilter - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Performance::FirstLastAfterFilter + +

+ + + + + + + +

+ + + + Overview +

+ +

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

+ +

For example, this is considered inefficient:

+ +
[-1, 0, 1, 2].select { |e| e > 0 }.first?
+[-1, 0, 1, 2].select { |e| e > 0 }.last?
+ +

And can be written as this:

+ +
[-1, 0, 1, 2].find { |e| e > 0 }
+[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }
+ +

YAML configuration example:

+ +
Performance/FirstLastAfterFilter
+  Enabled: true
+  FilterNames:
+    - select
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ CALL_NAMES = ["first", "last", "first?", "last?"] of ::String +
+ + +
+ MSG = "Use `find {...}` instead of `%s {...}.%s`" +
+ + +
+ MSG_REVERSE = "Use `reverse_each.find {...}` instead of `%s {...}.%s`" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

+ +

For example, this is considered inefficient:

+ +
[-1, 0, 1, 2].select { |e| e > 0 }.first?
+[-1, 0, 1, 2].select { |e| e > 0 }.last?
+ +

And can be written as this:

+ +
[-1, 0, 1, 2].find { |e| e > 0 }
+[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }
+ +

YAML configuration example:

+ +
Performance/FirstLastAfterFilter
+  Enabled: true
+  FilterNames:
+    - select
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def filter_names : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def filter_names=(filter_names : Array(String)) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Performance/SizeAfterFilter.html b/Ameba/Rule/Performance/SizeAfterFilter.html new file mode 100644 index 00000000..7620cacd --- /dev/null +++ b/Ameba/Rule/Performance/SizeAfterFilter.html @@ -0,0 +1,1166 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Performance::SizeAfterFilter - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Performance::SizeAfterFilter + +

+ + + + + + + +

+ + + + Overview +

+ +

This rule is used to identify usage of size calls that follow filter.

+ +

For example, this is considered invalid:

+ +
[1, 2, 3].select { |e| e > 2 }.size
+[1, 2, 3].reject { |e| e < 2 }.size
+[1, 2, 3].select(&.< 2).size
+[0, 1, 2].select(&.zero?).size
+[0, 1, 2].reject(&.zero?).size
+ +

And it should be written as this:

+ +
[1, 2, 3].count { |e| e > 2 }
+[1, 2, 3].count { |e| e >= 2 }
+[1, 2, 3].count(&.< 2)
+[0, 1, 2].count(&.zero?)
+[0, 1, 2].count(&.!= 0)
+ +

YAML configuration example:

+ +
Performance/SizeAfterFilter:
+  Enabled: true
+  FilterNames:
+    - select
+    - reject
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Use `count {...}` instead of `%s {...}.#{SIZE_NAME}`." +
+ + +
+ SIZE_NAME = "size" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

This rule is used to identify usage of size calls that follow filter.

+ +

For example, this is considered invalid:

+ +
[1, 2, 3].select { |e| e > 2 }.size
+[1, 2, 3].reject { |e| e < 2 }.size
+[1, 2, 3].select(&.< 2).size
+[0, 1, 2].select(&.zero?).size
+[0, 1, 2].reject(&.zero?).size
+ +

And it should be written as this:

+ +
[1, 2, 3].count { |e| e > 2 }
+[1, 2, 3].count { |e| e >= 2 }
+[1, 2, 3].count(&.< 2)
+[0, 1, 2].count(&.zero?)
+[0, 1, 2].count(&.!= 0)
+ +

YAML configuration example:

+ +
Performance/SizeAfterFilter:
+  Enabled: true
+  FilterNames:
+    - select
+    - reject
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def filter_names : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def filter_names=(filter_names : Array(String)) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Call) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style.html b/Ameba/Rule/Style.html new file mode 100644 index 00000000..3c46ff19 --- /dev/null +++ b/Ameba/Rule/Style.html @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style - ameba 0.13.3-dev + + + + + + + + +
+

+ + module Ameba::Rule::Style + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Ameba/Rule/Style/ConstantNames.html b/Ameba/Rule/Style/ConstantNames.html new file mode 100644 index 00000000..fec4e4bc --- /dev/null +++ b/Ameba/Rule/Style/ConstantNames.html @@ -0,0 +1,1086 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::ConstantNames - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::ConstantNames + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that enforces constant names to be in screaming case.

+ +

For example, these constant names are considered valid:

+ +
LUCKY_NUMBERS     = [3, 7, 11]
+DOCUMENTATION_URL = "http://crystal-lang.org/docs"
+ +

And these are invalid names:

+ +
myBadConstant = 1
+Wrong_NAME = 2
+ +

YAML configuration example:

+ +
Style/ConstantNames:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Constant name should be screaming-cased: %s, not %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that enforces constant names to be in screaming case.

+ +

For example, these constant names are considered valid:

+ +
LUCKY_NUMBERS     = [3, 7, 11]
+DOCUMENTATION_URL = "http://crystal-lang.org/docs"
+ +

And these are invalid names:

+ +
myBadConstant = 1
+Wrong_NAME = 2
+ +

YAML configuration example:

+ +
Style/ConstantNames:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Assign) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/IsANil.html b/Ameba/Rule/Style/IsANil.html new file mode 100644 index 00000000..da5e8e70 --- /dev/null +++ b/Ameba/Rule/Style/IsANil.html @@ -0,0 +1,1087 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::IsANil - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::IsANil + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows calls to is_a?(Nil) in favor of nil?.

+ +

This is considered bad:

+ +
var.is_a? Nil
+ +

And needs to be written as:

+ +
var.nil?
+ +

YAML configuration example:

+ +
Style/IsANil:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Use `nil?` instead of `is_a?(Nil)`" +
+ + +
+ PATH_NIL_NAMES = ["Nil"] of ::String +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows calls to is_a?(Nil) in favor of nil?.

+ +

This is considered bad:

+ +
var.is_a? Nil
+ +

And needs to be written as:

+ +
var.nil?
+ +

YAML configuration example:

+ +
Style/IsANil:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::IsA) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/LargeNumbers.html b/Ameba/Rule/Style/LargeNumbers.html new file mode 100644 index 00000000..12521f4c --- /dev/null +++ b/Ameba/Rule/Style/LargeNumbers.html @@ -0,0 +1,1134 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::LargeNumbers - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::LargeNumbers + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows usage of large numbers without underscore. +These do not affect the value of the number, but can help read +large numbers more easily.

+ +

For example, these are considered invalid:

+ +
10000
+141592654
+5.12345
+ +

And has to be rewritten as the following:

+ +
10_000
+141_592_654
+5.123_45
+ +

YAML configuration example:

+ +
Style/LargeNumbers:
+  Enabled: true
+  IntMinDigits: 5 # i.e. integers higher than 9999
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Large numbers should be written with underscores: %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows usage of large numbers without underscore. +These do not affect the value of the number, but can help read +large numbers more easily.

+ +

For example, these are considered invalid:

+ +
10000
+141592654
+5.12345
+ +

And has to be rewritten as the following:

+ +
10_000
+141_592_654
+5.123_45
+ +

YAML configuration example:

+ +
Style/LargeNumbers:
+  Enabled: true
+  IntMinDigits: 5 # i.e. integers higher than 9999
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def int_min_digits : Int32 + + # +
+ +
+
+ +
+
+ +
+
+ + def int_min_digits=(int_min_digits : Int32) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/MethodNames.html b/Ameba/Rule/Style/MethodNames.html new file mode 100644 index 00000000..2fa4b96f --- /dev/null +++ b/Ameba/Rule/Style/MethodNames.html @@ -0,0 +1,1118 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::MethodNames - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::MethodNames + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that enforces method names to be in underscored case.

+ +

For example, these are considered valid:

+ +
class Person
+  def first_name
+  end
+
+  def date_of_birth
+  end
+
+  def homepage_url
+  end
+end
+ +

And these are invalid method names:

+ +
class Person
+  def firstName
+  end
+
+  def date_of_Birth
+  end
+
+  def homepageURL
+  end
+end
+ +

YAML configuration example:

+ +
Style/MethodNames:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Method name should be underscore-cased: %s, not %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that enforces method names to be in underscored case.

+ +

For example, these are considered valid:

+ +
class Person
+  def first_name
+  end
+
+  def date_of_birth
+  end
+
+  def homepage_url
+  end
+end
+ +

And these are invalid method names:

+ +
class Person
+  def firstName
+  end
+
+  def date_of_Birth
+  end
+
+  def homepageURL
+  end
+end
+ +

YAML configuration example:

+ +
Style/MethodNames:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Def) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/NegatedConditionsInUnless.html b/Ameba/Rule/Style/NegatedConditionsInUnless.html new file mode 100644 index 00000000..589cb741 --- /dev/null +++ b/Ameba/Rule/Style/NegatedConditionsInUnless.html @@ -0,0 +1,1096 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::NegatedConditionsInUnless - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::NegatedConditionsInUnless + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows negated conditions in unless.

+ +

For example, this is considered invalid:

+ +
unless !s.empty?
+  :ok
+end
+ +

And should be rewritten to the following:

+ +
if s.emtpy?
+  :ok
+end
+ +

It is pretty difficult to wrap your head around a block of code +that is executed if a negated condition is NOT met.

+ +

YAML configuration example:

+ +
Style/NegatedConditionsInUnless:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Avoid negated conditions in unless blocks" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows negated conditions in unless.

+ +

For example, this is considered invalid:

+ +
unless !s.empty?
+  :ok
+end
+ +

And should be rewritten to the following:

+ +
if s.emtpy?
+  :ok
+end
+ +

It is pretty difficult to wrap your head around a block of code +that is executed if a negated condition is NOT met.

+ +

YAML configuration example:

+ +
Style/NegatedConditionsInUnless:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Unless) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/PredicateName.html b/Ameba/Rule/Style/PredicateName.html new file mode 100644 index 00000000..05a23daa --- /dev/null +++ b/Ameba/Rule/Style/PredicateName.html @@ -0,0 +1,1100 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::PredicateName - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::PredicateName + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows tautological predicate names, meaning those that +start with the prefix has_ or the prefix is_. Ignores if the alternative isn't valid Crystal code (e.g. is_404?).

+ +

Favour these:

+ +
def valid?(x)
+end
+
+def picture?(x)
+end
+ +

Over these:

+ +
def is_valid?(x)
+end
+
+def has_picture?(x)
+end
+ +

YAML configuration example:

+ +
Style/PredicateName:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Favour method name '%s?' over '%s'" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows tautological predicate names, meaning those that +start with the prefix has_ or the prefix is_. Ignores if the alternative isn't valid Crystal code (e.g. is_404?).

+ +

Favour these:

+ +
def valid?(x)
+end
+
+def picture?(x)
+end
+ +

Over these:

+ +
def is_valid?(x)
+end
+
+def has_picture?(x)
+end
+ +

YAML configuration example:

+ +
Style/PredicateName:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Def) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/RedundantBegin.html b/Ameba/Rule/Style/RedundantBegin.html new file mode 100644 index 00000000..61f5936b --- /dev/null +++ b/Ameba/Rule/Style/RedundantBegin.html @@ -0,0 +1,1202 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::RedundantBegin - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::RedundantBegin + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows redundant begin blocks.

+ +

Currently it is able to detect:

+ +
  1. Exception handler block that can be used as a part of the method.
+ +

For example, this:

+ +
def method
+  begin
+    read_content
+  rescue
+    close_file
+  end
+end
+ +

should be rewritten as:

+ +
def method
+  read_content
+rescue
+  close_file
+end
+ +
  1. begin..end block as a top level block in a method.
+ +

For example this is considered invalid:

+ +
def method
+  begin
+    a = 1
+    b = 2
+  end
+end
+ +

and has to be written as the following:

+ +
def method
+  a = 1
+  b = 2
+end
+ +

YAML configuration example:

+ +
Style/RedundantBegin:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Redundant `begin` block detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows redundant begin blocks.

+ +

Currently it is able to detect:

+ +
  1. Exception handler block that can be used as a part of the method.
+ +

For example, this:

+ +
def method
+  begin
+    read_content
+  rescue
+    close_file
+  end
+end
+ +

should be rewritten as:

+ +
def method
+  read_content
+rescue
+  close_file
+end
+ +
  1. begin..end block as a top level block in a method.
+ +

For example this is considered invalid:

+ +
def method
+  begin
+    a = 1
+    b = 2
+  end
+end
+ +

and has to be written as the following:

+ +
def method
+  a = 1
+  b = 2
+end
+ +

YAML configuration example:

+ +
Style/RedundantBegin:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Def) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/RedundantNext.html b/Ameba/Rule/Style/RedundantNext.html new file mode 100644 index 00000000..fa24f21d --- /dev/null +++ b/Ameba/Rule/Style/RedundantNext.html @@ -0,0 +1,1323 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::RedundantNext - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::RedundantNext + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows redundant next expressions. A next keyword allows +a block to skip to the next iteration early, however, it is considered +redundant in cases where it is the last expression in a block or combines +into the node which is the last in a block.

+ +

For example, this is considered invalid:

+ +
block do |v|
+  next v + 1
+end
+ +
block do |v|
+  case v
+  when .nil?
+    next "nil"
+  when .blank?
+    next "blank"
+  else
+    next "empty"
+  end
+end
+ +

And has to be written as the following:

+ +
block do |v|
+  v + 1
+end
+ +
block do |v|
+  case arg
+  when .nil?
+    "nil"
+  when .blank?
+    "blank"
+  else
+    "empty"
+  end
+end
+ +

+ +Configuration params

+ +
  1. allow_multi_next, default: true
+ +

Allows end-user to configure whether to report or not the next statements +which yield tuple literals i.e.

+ +
block do
+  next a, b
+end
+ +

If this param equals to false, the block above will be forced to be written as:

+ +
block do
+  {a, b}
+end
+ +
  1. allow_empty_next, default: true
+ +

Allows end-user to configure whether to report or not the next statements +without arguments. Sometimes such statements are used to yild the nil value explicitly.

+ +
block do
+  @foo = :empty
+  next
+end
+ +

If this param equals to false, the block above will be forced to be written as:

+ +
block do
+  @foo = :empty
+  nil
+end
+ +

+ +YAML config example

+ +
Style/RedundantNext:
+  Enabled: true
+  AllowMultiNext: true
+  AllowEmptyNext: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Redundant `next` detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows redundant next expressions. A next keyword allows +a block to skip to the next iteration early, however, it is considered +redundant in cases where it is the last expression in a block or combines +into the node which is the last in a block.

+ +

For example, this is considered invalid:

+ +
block do |v|
+  next v + 1
+end
+ +
block do |v|
+  case v
+  when .nil?
+    next "nil"
+  when .blank?
+    next "blank"
+  else
+    next "empty"
+  end
+end
+ +

And has to be written as the following:

+ +
block do |v|
+  v + 1
+end
+ +
block do |v|
+  case arg
+  when .nil?
+    "nil"
+  when .blank?
+    "blank"
+  else
+    "empty"
+  end
+end
+ +

+ +Configuration params

+ +
  1. allow_multi_next, default: true
+ +

Allows end-user to configure whether to report or not the next statements +which yield tuple literals i.e.

+ +
block do
+  next a, b
+end
+ +

If this param equals to false, the block above will be forced to be written as:

+ +
block do
+  {a, b}
+end
+ +
  1. allow_empty_next, default: true
+ +

Allows end-user to configure whether to report or not the next statements +without arguments. Sometimes such statements are used to yild the nil value explicitly.

+ +
block do
+  @foo = :empty
+  next
+end
+ +

If this param equals to false, the block above will be forced to be written as:

+ +
block do
+  @foo = :empty
+  nil
+end
+ +

+ +YAML config example

+ +
Style/RedundantNext:
+  Enabled: true
+  AllowMultiNext: true
+  AllowEmptyNext: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def allow_empty_next : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def allow_empty_next=(allow_empty_next : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def allow_multi_next : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def allow_multi_next=(allow_multi_next : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Next, visitor : AST::RedundantControlExpressionVisitor) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Block) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/RedundantReturn.html b/Ameba/Rule/Style/RedundantReturn.html new file mode 100644 index 00000000..af3b46ba --- /dev/null +++ b/Ameba/Rule/Style/RedundantReturn.html @@ -0,0 +1,1317 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::RedundantReturn - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::RedundantReturn + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows redundant return expressions.

+ +

For example, this is considered invalid:

+ +
def foo
+  return :bar
+end
+ +
def bar(arg)
+  case arg
+  when .nil?
+    return "nil"
+  when .blank?
+    return "blank"
+  else
+    return "empty"
+  end
+end
+ +

And has to be written as the following:

+ +
def foo
+  :bar
+end
+ +
def bar(arg)
+  case arg
+  when .nil?
+    "nil"
+  when .blank?
+    "blank"
+  else
+    "empty"
+  end
+end
+ +

+ +Configuration params

+ +
  1. allow_multi_return, default: true
+ +

Allows end-user to configure whether to report or not the return statements +which return tuple literals i.e.

+ +
def method(a, b)
+  return a, b
+end
+ +

If this param equals to false, the method above has to be written as:

+ +
def method(a, b)
+  {a, b}
+end
+ +
  1. allow_empty_return, default: true
+ +

Allows end-user to configure whether to report or not the return statements +without arguments. Sometimes such returns are used to return the nil value explicitly.

+ +
def method
+  @foo = :empty
+  return
+end
+ +

If this param equals to false, the method above has to be written as:

+ +
def method
+  @foo = :empty
+  nil
+end
+ +

+ +YAML config example

+ +
Style/RedundantReturn:
+  Enabled: true
+  AllowMutliReturn: true
+  AllowEmptyReturn: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Redundant `return` detected" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows redundant return expressions.

+ +

For example, this is considered invalid:

+ +
def foo
+  return :bar
+end
+ +
def bar(arg)
+  case arg
+  when .nil?
+    return "nil"
+  when .blank?
+    return "blank"
+  else
+    return "empty"
+  end
+end
+ +

And has to be written as the following:

+ +
def foo
+  :bar
+end
+ +
def bar(arg)
+  case arg
+  when .nil?
+    "nil"
+  when .blank?
+    "blank"
+  else
+    "empty"
+  end
+end
+ +

+ +Configuration params

+ +
  1. allow_multi_return, default: true
+ +

Allows end-user to configure whether to report or not the return statements +which return tuple literals i.e.

+ +
def method(a, b)
+  return a, b
+end
+ +

If this param equals to false, the method above has to be written as:

+ +
def method(a, b)
+  {a, b}
+end
+ +
  1. allow_empty_return, default: true
+ +

Allows end-user to configure whether to report or not the return statements +without arguments. Sometimes such returns are used to return the nil value explicitly.

+ +
def method
+  @foo = :empty
+  return
+end
+ +

If this param equals to false, the method above has to be written as:

+ +
def method
+  @foo = :empty
+  nil
+end
+ +

+ +YAML config example

+ +
Style/RedundantReturn:
+  Enabled: true
+  AllowMutliReturn: true
+  AllowEmptyReturn: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def allow_empty_return : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def allow_empty_return=(allow_empty_return : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def allow_multi_return : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def allow_multi_return=(allow_multi_return : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Return, visitor : AST::RedundantControlExpressionVisitor) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Def) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/TypeNames.html b/Ameba/Rule/Style/TypeNames.html new file mode 100644 index 00000000..e9994c7a --- /dev/null +++ b/Ameba/Rule/Style/TypeNames.html @@ -0,0 +1,1222 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::TypeNames - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::TypeNames + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that enforces type names in camelcase manner.

+ +

For example, these are considered valid:

+ +
class ParseError < Exception
+end
+
+module HTTP
+  class RequestHandler
+  end
+end
+
+alias NumericValue = Float32 | Float64 | Int32 | Int64
+
+lib LibYAML
+end
+
+struct TagDirective
+end
+
+enum Time::DayOfWeek
+end
+ +

And these are invalid type names

+ +
class My_class
+end
+
+module HTT_p
+end
+
+alias Numeric_value = Int32
+
+lib Lib_YAML
+end
+
+struct Tag_directive
+end
+
+enum Time_enum::Day_of_week
+end
+ +

YAML configuration example:

+ +
Style/TypeNames:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Type name should be camelcased: %s, but it was %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that enforces type names in camelcase manner.

+ +

For example, these are considered valid:

+ +
class ParseError < Exception
+end
+
+module HTTP
+  class RequestHandler
+  end
+end
+
+alias NumericValue = Float32 | Float64 | Int32 | Int64
+
+lib LibYAML
+end
+
+struct TagDirective
+end
+
+enum Time::DayOfWeek
+end
+ +

And these are invalid type names

+ +
class My_class
+end
+
+module HTT_p
+end
+
+alias Numeric_value = Int32
+
+lib Lib_YAML
+end
+
+struct Tag_directive
+end
+
+enum Time_enum::Day_of_week
+end
+ +

YAML configuration example:

+ +
Style/TypeNames:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::ClassDef) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Alias) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::LibDef) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::EnumDef) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::ModuleDef) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/UnlessElse.html b/Ameba/Rule/Style/UnlessElse.html new file mode 100644 index 00000000..30f667d9 --- /dev/null +++ b/Ameba/Rule/Style/UnlessElse.html @@ -0,0 +1,1124 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::UnlessElse - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::UnlessElse + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows the use of an else block with the unless.

+ +

For example, the rule considers these valid:

+ +
unless something
+  :ok
+end
+
+if something
+  :one
+else
+  :two
+end
+ +

But it considers this one invalid as it is an unless with an else:

+ +
unless something
+  :one
+else
+  :two
+end
+ +

The solution is to swap the order of the blocks, and change the unless to +an if, so the previous invalid example would become this:

+ +
if something
+  :two
+else
+  :one
+end
+ +

YAML configuration example:

+ +
Style/UnlessElse:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Favour if over unless with else" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows the use of an else block with the unless.

+ +

For example, the rule considers these valid:

+ +
unless something
+  :ok
+end
+
+if something
+  :one
+else
+  :two
+end
+ +

But it considers this one invalid as it is an unless with an else:

+ +
unless something
+  :one
+else
+  :two
+end
+ +

The solution is to swap the order of the blocks, and change the unless to +an if, so the previous invalid example would become this:

+ +
if something
+  :two
+else
+  :one
+end
+ +

YAML configuration example:

+ +
Style/UnlessElse:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Unless) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/VariableNames.html b/Ameba/Rule/Style/VariableNames.html new file mode 100644 index 00000000..2d63e9a5 --- /dev/null +++ b/Ameba/Rule/Style/VariableNames.html @@ -0,0 +1,1126 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::VariableNames - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::VariableNames + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that enforces variable names to be in underscored case.

+ +

For example, these variable names are considered valid:

+ +
var_name = 1
+name = 2
+_another_good_name = 3
+ +

And these are invalid variable names:

+ +
myBadNamedVar = 1
+wrong_Name = 2
+ +

YAML configuration example:

+ +
Style/VariableNames:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "Var name should be underscore-cased: %s, not %s" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that enforces variable names to be in underscored case.

+ +

For example, these variable names are considered valid:

+ +
var_name = 1
+name = 2
+_another_good_name = 3
+ +

And these are invalid variable names:

+ +
myBadNamedVar = 1
+wrong_Name = 2
+ +

YAML configuration example:

+ +
Style/VariableNames:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::Var) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::InstanceVar) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::ClassVar) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Rule/Style/WhileTrue.html b/Ameba/Rule/Style/WhileTrue.html new file mode 100644 index 00000000..b363bb01 --- /dev/null +++ b/Ameba/Rule/Style/WhileTrue.html @@ -0,0 +1,1094 @@ + + + + + + + + + + + + + + + + Ameba::Rule::Style::WhileTrue - ameba 0.13.3-dev + + + + + + + + +
+

+ + struct Ameba::Rule::Style::WhileTrue + +

+ + + + + + + +

+ + + + Overview +

+ +

A rule that disallows the use of while true instead of using the idiomatic loop

+ +

For example, this is considered invalid:

+ +
while true
+  do_something
+  break if some_condition
+end
+ +

And should be replaced by the following:

+ +
loop do
+  do_something
+  break if some_condition
+end
+ +

YAML configuration example:

+ +
Style/WhileTrue:
+  Enabled: true
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ MSG = "While statement using true literal as condition" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

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(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(config = nil) + + # +
+ +
+ +

A rule that disallows the use of while true instead of using the idiomatic loop

+ +

For example, this is considered invalid:

+ +
while true
+  do_something
+  break if some_condition
+end
+ +

And should be replaced by the following:

+ +
loop do
+  do_something
+  break if some_condition
+end
+ +

YAML configuration example:

+ +
Style/WhileTrue:
+  Enabled: true
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def description : String + + # +
+ +
+
+ +
+
+ +
+
+ + def description=(description : String) + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def enabled=(enabled) + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded : Array(String)? + + # +
+ +
+
+ +
+
+ +
+
+ + def excluded=(excluded : Array(String)?) + + # +
+ +
+
+ +
+
+ +
+
+ + def severity : Ameba::Severity + + # +
+ +
+
+ +
+
+ +
+
+ + def severity=(severity) + + # +
+ +
+
+ +
+
+ +
+
+ + def test(source, node : Crystal::While) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Runner.html b/Ameba/Runner.html new file mode 100644 index 00000000..7ab211d2 --- /dev/null +++ b/Ameba/Runner.html @@ -0,0 +1,856 @@ + + + + + + + + + + + + + + + + Ameba::Runner - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Runner + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents a runner for inspecting sources files. +Holds a list of rules to do inspection based on, +list of sources to run inspection on and a formatter +to prepare a report.

+ +
config = Ameba::Config.load
+runner = Ameba::Runner.new config
+runner.run.success? # => true or false
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(config : Config) + + # +
+ +
+ +

Instantiates a runner using a config.

+ +
config = Ameba::Config.load
+config.files = files
+config.formatter = formatter
+
+Ameba::Runner.new config
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def explain(location, output = STDOUT) + + # +
+ +
+ +

Explains an issue at a specified location.

+ +

Runner should perform inspection before doing the explain. +This is necessary to be able to find the issue at a specified location.

+ +
runner = Ameba::Runner.new config
+runner.run
+runner.explain({file: file, line: l, column: c})
+
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +

Performs the inspection. Iterates through all sources and test it using +list of rules. If a specific rule fails on a specific source, it adds +an issue to that source.

+ +

This action also notifies formatter when inspection is started/finished, +and when a specific source started/finished to be inspected.

+ +
runner = Ameba::Runner.new config
+runner.run # => returns runner again
+
+ +
+
+ +
+
+ +
+
+ + def sources : Array(Source) + + # +
+ +
+ +

A list of sources to run inspection on.

+
+ +
+
+ +
+
+ +
+
+ + def success? + + # +
+ +
+ +

Indicates whether the last inspection successful or not. +It returns true if no issues matching severity in sources found, false otherwise.

+ +
runner = Ameba::Runner.new config
+runner.run
+runner.success? # => true or false
+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Severity.html b/Ameba/Severity.html new file mode 100644 index 00000000..664b0486 --- /dev/null +++ b/Ameba/Severity.html @@ -0,0 +1,843 @@ + + + + + + + + + + + + + + + + Ameba::Severity - ameba 0.13.3-dev + + + + + + + + +
+

+ + enum Ameba::Severity + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Enum Members +

+ +
+ +
+ Error = 0 +
+ + +
+ Warning = 1 +
+ + +
+ Convention = 2 +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.parse(name : String) + + # +
+ +
+ +

Creates Severity by the name.

+ +
Severity.parse("convention") # => Severity::Convention
+Severity.parse("foo-bar")    # => Exception: Incorrect severity name
+
+ +
+
+ +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def convention? + + # +
+ +
+
+ +
+
+ +
+
+ + def error? + + # +
+ +
+
+ +
+
+ +
+
+ + def symbol + + # +
+ +
+ +

Returns a symbol uniquely indicating severity.

+ +
Severity::Warning.symbol # => 'W'
+
+ +
+
+ +
+
+ +
+
+ + def warning? + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/SeverityYamlConverter.html b/Ameba/SeverityYamlConverter.html new file mode 100644 index 00000000..434247b0 --- /dev/null +++ b/Ameba/SeverityYamlConverter.html @@ -0,0 +1,709 @@ + + + + + + + + + + + + + + + + Ameba::SeverityYamlConverter - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::SeverityYamlConverter + +

+ + + + + + + +

+ + + + Overview +

+ +

Converter for YAML.mapping which converts severity enum to and from YAML.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.to_yaml(value : Severity, yaml : YAML::Nodes::Builder) + + # +
+ +
+
+ +
+
+ + + + + + + +
+ + + diff --git a/Ameba/Source.html b/Ameba/Source.html new file mode 100644 index 00000000..ca58fb97 --- /dev/null +++ b/Ameba/Source.html @@ -0,0 +1,958 @@ + + + + + + + + + + + + + + + + Ameba::Source - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Source + +

+ + + + + + + +

+ + + + Overview +

+ +

An entity that represents a Crystal source file. +Has path, lines of code and issues reported by rules.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(code : String, path = "") + + # +
+ +
+ +

Creates a new source by #code and #path.

+ +

For example:

+ +
path = "./src/source.cr"
+Ameba::Source.new File.read(path), path
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def ast + + # +
+ +
+ +

Returns AST nodes constructed by Crystal::Parser.

+ +
source = Ameba::Source.new code, path
+source.ast
+
+ +
+
+ +
+
+ +
+
+ + def code : String + + # +
+ +
+ +

Crystal code (content of a source file).

+
+ +
+
+ +
+
+ +
+
+ + def fullpath + + # +
+ +
+
+ +
+
+ +
+
+ + def lines + + # +
+ +
+ +

Returns lines of code splitted by new line character. +Since #code is immutable and can't be changed, this +method caches lines in an instance variable, so calling +it second time will not perform a split, but will return +lines instantly.

+ +
source = Ameba::Source.new "a = 1\nb = 2", path
+source.lines # => ["a = 1", "b = 2"]
+
+ +
+
+ +
+
+ +
+
+ + def matches_path?(filepath) + + # +
+ +
+ +

Returns true if filepath matches the source's path, false if it does not.

+
+ +
+
+ +
+
+ +
+
+ + def path : String + + # +
+ +
+ +

Path to the source file.

+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Ameba/Tokenizer.html b/Ameba/Tokenizer.html new file mode 100644 index 00000000..1234e6f1 --- /dev/null +++ b/Ameba/Tokenizer.html @@ -0,0 +1,787 @@ + + + + + + + + + + + + + + + + Ameba::Tokenizer - ameba 0.13.3-dev + + + + + + + + +
+

+ + class Ameba::Tokenizer + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents Crystal syntax tokenizer based on Crystal::Lexer.

+ +
source = Ameba::Source.new code, path
+tokenizer = Ameba::Tokenizer.new(source)
+tokenizer.run do |token|
+  puts token
+end
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(lexer : Crystal::Lexer) + + # +
+ +
+ +

Instantiates Tokenizer using a lexer.

+ +
lexer = Crystal::Lexer.new(code)
+Ameba::Tokenizer.new(lexer)
+
+ +
+
+ +
+
+ +
+
+ + def self.new(source) + + # +
+ +
+ +

Instantiates Tokenizer using a source.

+ +
source = Ameba::Source.new code, path
+Ameba::Tokenizer.new(source)
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def run(&block : Crystal::Token -> _) + + # +
+ +
+ +

Runs the tokenizer and yields each token as a block argument.

+ +
Ameba::Tokenizer.new(source).run do |token|
+  puts token
+end
+
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/css/style.css b/css/style.css new file mode 100644 index 00000000..20bb0840 --- /dev/null +++ b/css/style.css @@ -0,0 +1,726 @@ +html, body { + background: #FFFFFF; + position: relative; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; +} + +body { + font-family: "Avenir", "Tahoma", "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + color: #333; + line-height: 1.5; +} + +a { + color: #263F6C; +} + +a:visited { + color: #112750; +} + +h1, h2, h3, h4, h5, h6 { + margin: 35px 0 25px; + color: #444444; +} + +h1.type-name { + color: #47266E; + margin: 20px 0 30px; + background-color: #F8F8F8; + padding: 10px 12px; + border: 1px solid #EBEBEB; + border-radius: 2px; +} + +h2 { + border-bottom: 1px solid #E6E6E6; + padding-bottom: 5px; +} + +body { + display: flex; +} + +.sidebar, .main-content { + overflow: auto; +} + +.sidebar { + width: 30em; + color: #F8F4FD; + background-color: #2E1052; + padding: 0 0 30px; + box-shadow: inset -3px 0 4px rgba(0,0,0,.35); + line-height: 1.2; + z-index: 0; +} + +.sidebar .search-box { + padding: 13px 9px; +} + +.sidebar input { + display: block; + box-sizing: border-box; + margin: 0; + padding: 5px; + font: inherit; + font-family: inherit; + line-height: 1.2; + width: 100%; + border: 0; + outline: 0; + border-radius: 2px; + box-shadow: 0px 3px 5px rgba(0,0,0,.25); + transition: box-shadow .12s; +} + +.sidebar input:focus { + box-shadow: 0px 5px 6px rgba(0,0,0,.5); +} + +.sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input::-moz-placeholder { /* Firefox 19+ */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-ms-input-placeholder { /* IE 10+ */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-moz-placeholder { /* Firefox 18- */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.project-summary { + padding: 9px 15px 30px 30px; +} + +.project-name { + font-size: 1.4rem; + margin: 0; + color: #f4f4f4; + font-weight: 600; +} + +.project-version { + margin-top: 5px; + display: inline-block; + position: relative; +} + +.project-version > form::after { + position: absolute; + right: 0; + top: 0; + content: "\25BC"; + font-size: .6em; + line-height: 1.2rem; + z-index: -1; +} + +.project-versions-nav { + cursor: pointer; + margin: 0; + padding: 0 .9em 0 0; + border: none; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: transparent; + color: inherit; + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +.project-versions-nav:focus { + outline: none; +} + +.project-versions-nav > option { + color: initial; +} + +.sidebar ul { + margin: 0; + padding: 0; + list-style: none outside; +} + +.sidebar li { + display: block; + position: relative; +} + +.types-list li.hide { + display: none; +} + +.sidebar a { + text-decoration: none; + color: inherit; + transition: color .14s; +} +.types-list a { + display: block; + padding: 5px 15px 5px 30px; +} + +.types-list { + display: block; +} + +.sidebar a:focus { + outline: 1px solid #D1B7F1; +} + +.types-list a { + padding: 5px 15px 5px 30px; +} + +.sidebar .current > a, +.sidebar a:hover { + color: #866BA6; +} + +.types-list li ul { + overflow: hidden; + height: 0; + max-height: 0; + transition: 1s ease-in-out; +} + +.types-list li.parent { + padding-left: 30px; +} + +.types-list li.parent::before { + box-sizing: border-box; + content: "â–¼"; + display: block; + width: 30px; + height: 30px; + position: absolute; + top: 0; + left: 0; + text-align: center; + color: white; + font-size: 8px; + line-height: 30px; + transform: rotateZ(-90deg); + cursor: pointer; + transition: .2s linear; +} + + +.types-list li.parent > a { + padding-left: 0; +} + +.types-list li.parent.open::before { + transform: rotateZ(0); +} + +.types-list li.open > ul { + height: auto; + max-height: 1000em; +} + +.main-content { + padding: 0 30px 30px 30px; + width: 100%; +} + +.kind { + font-size: 60%; + color: #866BA6; +} + +.superclass-hierarchy { + margin: -15px 0 30px 0; + padding: 0; + list-style: none outside; + font-size: 80%; +} + +.superclass-hierarchy .superclass { + display: inline-block; + margin: 0 7px 0 0; + padding: 0; +} + +.superclass-hierarchy .superclass + .superclass::before { + content: "<"; + margin-right: 7px; +} + +.other-types-list li { + display: inline-block; +} + +.other-types-list, +.list-summary { + margin: 0 0 30px 0; + padding: 0; + list-style: none outside; +} + +.entry-const { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +.entry-const code { + white-space: pre-wrap; +} + +.entry-summary { + padding-bottom: 4px; +} + +.superclass-hierarchy .superclass a, +.other-type a, +.entry-summary .signature { + padding: 4px 8px; + margin-bottom: 4px; + display: inline-block; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + text-decoration: none; + border-radius: 3px; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: background .15s, border-color .15s; +} + +.superclass-hierarchy .superclass a:hover, +.other-type a:hover, +.entry-summary .signature:hover { + background: #D5CAE3; + border-color: #624288; +} + +.entry-summary .summary { + padding-left: 32px; +} + +.entry-summary .summary p { + margin: 12px 0 16px; +} + +.entry-summary a { + text-decoration: none; +} + +.entry-detail { + padding: 30px 0; +} + +.entry-detail .signature { + position: relative; + padding: 5px 15px; + margin-bottom: 10px; + display: block; + border-radius: 5px; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: .2s ease-in-out; +} + +.entry-detail:target .signature { + background-color: #D5CAE3; + border: 1px solid #624288; +} + +.entry-detail .signature .method-permalink { + position: absolute; + top: 0; + left: -35px; + padding: 5px 15px; + text-decoration: none; + font-weight: bold; + color: #624288; + opacity: .4; + transition: opacity .2s; +} + +.entry-detail .signature .method-permalink:hover { + opacity: 1; +} + +.entry-detail:target .signature .method-permalink { + opacity: 1; +} + +.methods-inherited { + padding-right: 10%; + line-height: 1.5em; +} + +.methods-inherited h3 { + margin-bottom: 4px; +} + +.methods-inherited a { + display: inline-block; + text-decoration: none; + color: #47266E; +} + +.methods-inherited a:hover { + text-decoration: underline; + color: #6C518B; +} + +.methods-inherited .tooltip>span { + background: #D5CAE3; + padding: 4px 8px; + border-radius: 3px; + margin: -4px -8px; +} + +.methods-inherited .tooltip * { + color: #47266E; +} + +pre { + padding: 10px 20px; + margin-top: 4px; + border-radius: 3px; + line-height: 1.45; + overflow: auto; + color: #333; + background: #fdfdfd; + font-size: 14px; + border: 1px solid #eee; +} + +code { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +:not(pre) > code { + background-color: rgba(40,35,30,0.05); + padding: 0.2em 0.4em; + font-size: 85%; + border-radius: 3px; +} + +span.flag { + padding: 2px 4px 1px; + border-radius: 3px; + margin-right: 3px; + font-size: 11px; + border: 1px solid transparent; +} + +span.flag.orange { + background-color: #EE8737; + color: #FCEBDD; + border-color: #EB7317; +} + +span.flag.yellow { + background-color: #E4B91C; + color: #FCF8E8; + border-color: #B69115; +} + +span.flag.green { + background-color: #469C14; + color: #E2F9D3; + border-color: #34700E; +} + +span.flag.red { + background-color: #BF1919; + color: #F9ECEC; + border-color: #822C2C; +} + +span.flag.purple { + background-color: #2E1052; + color: #ECE1F9; + border-color: #1F0B37; +} + +span.flag.lime { + background-color: #a3ff00; + color: #222222; + border-color: #00ff1e; +} + +.tooltip>span { + position: absolute; + opacity: 0; + display: none; + pointer-events: none; +} + +.tooltip:hover>span { + display: inline-block; + opacity: 1; +} + +.c { + color: #969896; +} + +.n { + color: #0086b3; +} + +.t { + color: #0086b3; +} + +.s { + color: #183691; +} + +.i { + color: #7f5030; +} + +.k { + color: #a71d5d; +} + +.o { + color: #a71d5d; +} + +.m { + color: #795da3; +} + +.hidden { + display: none; +} +.search-results { + font-size: 90%; + line-height: 1.3; +} + +.search-results mark { + color: inherit; + background: transparent; + font-weight: bold; +} +.search-result { + padding: 5px 8px 5px 5px; + cursor: pointer; + border-left: 5px solid transparent; + transform: translateX(-3px); + transition: all .2s, background-color 0s, border .02s; + min-height: 3.2em; +} +.search-result.current { + border-left-color: #ddd; + background-color: rgba(200,200,200,0.4); + transform: translateX(0); + transition: all .2s, background-color .5s, border 0s; +} +.search-result.current:hover, +.search-result.current:focus { + border-left-color: #866BA6; +} +.search-result:not(.current):nth-child(2n) { + background-color: rgba(255,255,255,.06); +} +.search-result__title { + font-size: 105%; + word-break: break-all; + line-height: 1.1; + padding: 3px 0; +} +.search-result__title strong { + font-weight: normal; +} +.search-results .search-result__title > a { + padding: 0; + display: block; +} +.search-result__title > a > .args { + color: #dddddd; + font-weight: 300; + transition: inherit; + font-size: 88%; + line-height: 1.2; + letter-spacing: -.02em; +} +.search-result__title > a > .args * { + color: inherit; +} + +.search-result a, +.search-result a:hover { + color: inherit; +} +.search-result:not(.current):hover .search-result__title > a, +.search-result:not(.current):focus .search-result__title > a, +.search-result__title > a:focus { + color: #866BA6; +} +.search-result:not(.current):hover .args, +.search-result:not(.current):focus .args { + color: #6a5a7d; +} + +.search-result__type { + color: #e8e8e8; + font-weight: 300; +} +.search-result__doc { + color: #bbbbbb; + font-size: 90%; +} +.search-result__doc p { + margin: 0; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + line-height: 1.2em; + max-height: 2.4em; +} + +.js-modal-visible .modal-background { + display: flex; +} +.main-content { + position: relative; +} +.modal-background { + position: absolute; + display: none; + height: 100%; + width: 100%; + background: rgba(120,120,120,.4); + z-index: 100; + align-items: center; + justify-content: center; +} +.usage-modal { + max-width: 90%; + background: #fff; + border: 2px solid #ccc; + border-radius: 9px; + padding: 5px 15px 20px; + min-width: 50%; + color: #555; + position: relative; + transform: scale(.5); + transition: transform 200ms; +} +.js-modal-visible .usage-modal { + transform: scale(1); +} +.usage-modal > .close-button { + position: absolute; + right: 15px; + top: 8px; + color: #aaa; + font-size: 27px; + cursor: pointer; +} +.usage-modal > .close-button:hover { + text-shadow: 2px 2px 2px #ccc; + color: #999; +} +.modal-title { + margin: 0; + text-align: center; + font-weight: normal; + color: #666; + border-bottom: 2px solid #ddd; + padding: 10px; +} +.usage-list { + padding: 0; + margin: 13px; +} +.usage-list > li { + padding: 5px 2px; + overflow: auto; + padding-left: 100px; + min-width: 12em; +} +.usage-modal kbd { + background: #eee; + border: 1px solid #ccc; + border-bottom-width: 2px; + border-radius: 3px; + padding: 3px 8px; + font-family: monospace; + margin-right: 2px; + display: inline-block; +} +.usage-key { + float: left; + clear: left; + margin-left: -100px; + margin-right: 12px; +} +.doc-inherited { + font-weight: bold; +} + +.anchor { + float: left; + padding-right: 4px; + margin-left: -20px; +} + +.main-content .anchor .octicon-link { + width: 16px; + height: 16px; +} + +.main-content .anchor:focus { + outline: none +} + +.main-content h1:hover .anchor, +.main-content h2:hover .anchor, +.main-content h3:hover .anchor, +.main-content h4:hover .anchor, +.main-content h5:hover .anchor, +.main-content h6:hover .anchor { + text-decoration: none +} + +.main-content h1 .octicon-link, +.main-content h2 .octicon-link, +.main-content h3 .octicon-link, +.main-content h4 .octicon-link, +.main-content h5 .octicon-link, +.main-content h6 .octicon-link { + visibility: hidden +} + +.main-content h1:hover .anchor .octicon-link, +.main-content h2:hover .anchor .octicon-link, +.main-content h3:hover .anchor .octicon-link, +.main-content h4:hover .anchor .octicon-link, +.main-content h5:hover .anchor .octicon-link, +.main-content h6:hover .anchor .octicon-link { + visibility: visible +} diff --git a/index.html b/index.html new file mode 100644 index 00000000..5593f237 --- /dev/null +++ b/index.html @@ -0,0 +1,812 @@ + + + + + + + + + + + + + + + + ameba 0.13.3-dev + + + + + + + + +
+ + + + + + + + + + + + + + +

+ +About

+ +

Ameba is a static code analysis tool for the Crystal language. +It enforces a consistent Crystal code style, +also catches code smells and wrong code constructions.

+ +

See also Roadmap.

+ +

+ +Usage

+ +

Run ameba binary within your project directory to catch code issues:

+ +
$ ameba
+Inspecting 107 files.
+
+...............F.....................F....................................................................
+
+src/ameba/formatter/flycheck_formatter.cr:4:33
+[W] Lint/UnusedArgument: Unused argument `location`
+> source.issues.each do |e, location|
+                            ^
+
+src/ameba/formatter/base_formatter.cr:12:7
+[W] Lint/UselessAssign: Useless assignment to variable `s`
+> return s += issues.size
+         ^
+
+Finished in 542.64 milliseconds
+
+129 inspected, 2 failures.
+
+ +

+ +Run in parallel

+ +

Starting from 0.31.0 Crystal supports parallelism. +It allows to run linting in parallel too. +In order to take advantage of this feature you need to build ameba with preview_mt support:

+ +
$ crystal build src/cli.cr -Dpreview_mt -o bin/ameba
+$ make install
+ +

Some quick benchmark results measured while running Ameba on Crystal repo:

+ +
$ CRYSTAL_WORKERS=1 ameba #=> 29.11 seconds
+$ CRYSTAL_WORKERS=2 ameba #=> 19.49 seconds
+$ CRYSTAL_WORKERS=4 ameba #=> 13.48 seconds
+$ CRYSTAL_WORKERS=8 ameba #=> 10.14 seconds
+ +

+ +Installation

+ +

+ +As a project dependency:

+ +

Add this to your application's shard.yml:

+ +
development_dependencies:
+  ameba:
+    github: crystal-ameba/ameba
+    version: ~> 0.13.0
+ +

Build bin/ameba binary within your project directory while running shards install.

+ +

You may also want to use it on Travis:

+ +
# .travis.yml
+language: crystal
+install:
+  - shards install
+script:
+  - crystal spec
+  - crystal bin/ameba.cr
+ +

Using this config Ameba will inspect files just after the specs run. Travis will also fail +the build if some problems detected.

+ +

+ +OS X

+ +
$ brew tap veelenga/tap
+$ brew install ameba
+ +

+ +Docker

+ +

Build the image:

+ +
$ docker build -t crystal-ameba/ameba .
+ +

To use the resulting image on a local source folder, mount the current (or target) directory into /src:

+ +
$ docker run -v $(pwd):/src crystal-ameba/ameba
+ +

Also available on DockerHub: https://hub.docker.com/r/veelenga/ameba

+ +

+ +From sources

+ +
$ git clone https://github.com/crystal-ameba/ameba && cd ameba
+$ make install
+ +

+ +Configuration

+ +

Default configuration file is .ameba.yml. +It allows to configure rule properties, disable specific rules and exclude sources from the rules.

+ +

Generate new file by running ameba --gen-config.

+ +

+ +Sources

+ +

List of sources to run Ameba on can be configured globally via:

+ + + +

In this example we define default globs and exclude src/compiler folder:

+ +
Globs:
+  - **/*.cr
+  - !lib
+  
+Excluded:
+  - src/compiler
+ +

Specific sources can be excluded at rule level:

+ +
Style/RedundantBegin:
+  Excluded:
+  - src/server/processor.cr
+  - src/server/api.cr
+ +

+ +Rules

+ +

One or more rules, or a one or more group of rules can be included or excluded +via command line arguments:

+ +
$ ameba --only   Lint/Syntax # runs only Lint/Syntax rule
+$ ameba --only   Style,Lint  # runs only rules from Style and Lint groups
+$ ameba --except Lint/Syntax # runs all rules except Lint/Syntax
+$ ameba --except Style,Lint  # runs all rules except rules in Style and Lint groups
+ +

Or through the configuration file:

+ +
Style/RedundantBegin:
+  Enabled: false
+ +

+ +Explain issues

+ +

Ameba allows you to dig deeper into an issue, by showing you details about the issue +and the reasoning by it being reported.

+ +

To be convenient, you can just copy-paste the PATH:line:column string from the +report and paste behind the ameba command to check it out.

+ +
$ ameba crystal/command/format.cr:26:83           # show explanation for the issue
+$ ameba --explain crystal/command/format.cr:26:83 # same thing
+ +

+ +Inline disabling

+ +

One or more rules or one or more group of rules can be disabled using inline directives:

+ +
# ameba:disable Style/LargeNumbers
+time = Time.epoch(1483859302)
+
+time = Time.epoch(1483859302) # ameba:disable Style/LargeNumbers, Lint/UselessAssign
+
+time = Time.epoch(1483859302) # ameba:disable Style, Lint
+ +

+ +Editors & integrations

+ + + +

+ +Credits & inspirations

+ + + +

+ +Contributors

+ + +
+ + diff --git a/index.json b/index.json new file mode 100644 index 00000000..657859a1 --- /dev/null +++ b/index.json @@ -0,0 +1 @@ +{"repository_name":"ameba","body":"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n- [About](#about)\n- [Usage](#usage)\n * [Run in parallel](#run-in-parallel)\n- [Installation](#installation)\n * [As a project dependency:](#as-a-project-dependency)\n * [OS X](#os-x)\n * [Docker](#docker)\n * [From sources](#from-sources)\n- [Configuration](#configuration)\n * [Sources](#sources)\n * [Rules](#rules)\n * [Explain issues](#explain-issues)\n * [Inline disabling](#inline-disabling)\n- [Editors & integrations](#editors--integrations)\n- [Credits & inspirations](#credits--inspirations)\n- [Contributors](#contributors)\n\n## About\n\nAmeba is a static code analysis tool for the Crystal language.\nIt enforces a consistent [Crystal code style](https://crystal-lang.org/docs/conventions/coding_style.html),\nalso catches code smells and wrong code constructions.\n\nSee also [Roadmap](https://github.com/crystal-ameba/ameba/wiki).\n\n## Usage\n\nRun `ameba` binary within your project directory to catch code issues:\n\n```sh\n$ ameba\nInspecting 107 files.\n\n...............F.....................F....................................................................\n\nsrc/ameba/formatter/flycheck_formatter.cr:4:33\n[W] Lint/UnusedArgument: Unused argument `location`\n> source.issues.each do |e, location|\n ^\n\nsrc/ameba/formatter/base_formatter.cr:12:7\n[W] Lint/UselessAssign: Useless assignment to variable `s`\n> return s += issues.size\n ^\n\nFinished in 542.64 milliseconds\n\n129 inspected, 2 failures.\n\n```\n\n### Run in parallel\n\nStarting from 0.31.0 Crystal [supports parallelism](https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html).\nIt allows to run linting in parallel too.\nIn order to take advantage of this feature you need to build ameba with preview_mt support:\n\n```sh\n$ crystal build src/cli.cr -Dpreview_mt -o bin/ameba\n$ make install\n```\n\nSome quick benchmark results measured while running Ameba on Crystal repo:\n\n```sh\n$ CRYSTAL_WORKERS=1 ameba #=> 29.11 seconds\n$ CRYSTAL_WORKERS=2 ameba #=> 19.49 seconds\n$ CRYSTAL_WORKERS=4 ameba #=> 13.48 seconds\n$ CRYSTAL_WORKERS=8 ameba #=> 10.14 seconds\n```\n\n## Installation\n\n### As a project dependency:\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndevelopment_dependencies:\n ameba:\n github: crystal-ameba/ameba\n version: ~> 0.13.0\n```\n\nBuild `bin/ameba` binary within your project directory while running `shards install`.\n\nYou may also want to use it on [Travis](travis-ci.org):\n\n```yaml\n# .travis.yml\nlanguage: crystal\ninstall:\n - shards install\nscript:\n - crystal spec\n - crystal bin/ameba.cr\n```\n\nUsing this config Ameba will inspect files just after the specs run. Travis will also fail\nthe build if some problems detected.\n\n### OS X\n\n```sh\n$ brew tap veelenga/tap\n$ brew install ameba\n```\n\n### Docker\n\nBuild the image:\n\n```sh\n$ docker build -t crystal-ameba/ameba .\n```\n\nTo use the resulting image on a local source folder, mount the current (or target) directory into `/src`:\n\n```sh\n$ docker run -v $(pwd):/src crystal-ameba/ameba\n```\n\nAlso available on DockerHub: https://hub.docker.com/r/veelenga/ameba\n\n### From sources\n\n```sh\n$ git clone https://github.com/crystal-ameba/ameba && cd ameba\n$ make install\n```\n\n## Configuration\n\nDefault configuration file is `.ameba.yml`.\nIt allows to configure rule properties, disable specific rules and exclude sources from the rules.\n\nGenerate new file by running `ameba --gen-config`.\n\n### Sources\n\n**List of sources to run Ameba on can be configured globally via:**\n\n- `Globs` section - an array of wildcards (or paths) to include to the\n inspection. Defaults to `%w(**/*.cr !lib)`, meaning it includes all project\n files with `*.cr` extension except those which exist in `lib` folder.\n- `Excluded` section - an array of wildcards (or paths) to exclude from the\n source list defined by `Globs`. Defaults to an empty array.\n\nIn this example we define default globs and exclude `src/compiler` folder:\n\n``` yaml\nGlobs:\n - **/*.cr\n - !lib\n \nExcluded:\n - src/compiler\n```\n\n**Specific sources can be excluded at rule level**:\n\n``` yaml\nStyle/RedundantBegin:\n Excluded:\n - src/server/processor.cr\n - src/server/api.cr\n```\n\n### Rules\n\nOne or more rules, or a one or more group of rules can be included or excluded\nvia command line arguments:\n\n```sh\n$ ameba --only Lint/Syntax # runs only Lint/Syntax rule\n$ ameba --only Style,Lint # runs only rules from Style and Lint groups\n$ ameba --except Lint/Syntax # runs all rules except Lint/Syntax\n$ ameba --except Style,Lint # runs all rules except rules in Style and Lint groups\n```\n\nOr through the configuration file:\n\n``` yaml\nStyle/RedundantBegin:\n Enabled: false\n```\n\n### Explain issues\n\nAmeba allows you to dig deeper into an issue, by showing you details about the issue\nand the reasoning by it being reported.\n\nTo be convenient, you can just copy-paste the `PATH:line:column` string from the\nreport and paste behind the `ameba` command to check it out.\n\n```sh\n$ ameba crystal/command/format.cr:26:83 # show explanation for the issue\n$ ameba --explain crystal/command/format.cr:26:83 # same thing\n```\n\n### Inline disabling\n\nOne or more rules or one or more group of rules can be disabled using inline directives:\n\n```crystal\n# ameba:disable Style/LargeNumbers\ntime = Time.epoch(1483859302)\n\ntime = Time.epoch(1483859302) # ameba:disable Style/LargeNumbers, Lint/UselessAssign\n\ntime = Time.epoch(1483859302) # ameba:disable Style, Lint\n```\n\n## Editors & integrations\n\n * Vim: [vim-crystal](https://github.com/rhysd/vim-crystal), [Ale](https://github.com/w0rp/ale)\n * Emacs: [ameba.el](https://github.com/crystal-ameba/ameba.el)\n * Sublime Text: [Sublime Linter Ameba](https://github.com/epergo/SublimeLinter-contrib-ameba)\n * VSCode: [vscode-crystal-ameba](https://github.com/crystal-ameba/vscode-crystal-ameba)\n * Codacy: [codacy-ameba](https://github.com/codacy/codacy-ameba)\n * GitHub Actions: [github-action](https://github.com/crystal-ameba/github-action)\n\n## Credits & inspirations\n\n- [Crystal Language](https://crystal-lang.org)\n- [Rubocop](https://rubocop.readthedocs.io/en/latest/)\n- [Credo](http://credo-ci.org/)\n- [Dogma](https://github.com/lpil/dogma)\n\n## Contributors\n\n- [veelenga](https://github.com/veelenga) Vitalii Elenhaupt - creator, maintainer\n","program":{"html_id":"ameba/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":true,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba","path":"Ameba.html","kind":"module","full_name":"Ameba","name":"Ameba","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/travis/build/crystal-ameba/ameba/src\\\"`).chomp.stringify }}","doc":null,"summary":null}],"included_modules":[],"extended_modules":[{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"}],"subclasses":[],"including_types":[],"namespace":null,"doc":"Ameba's entry module.\n\nTo run the linter with default parameters:\n\n```\nAmeba.run\n```\n\nTo configure and run it:\n\n```\nconfig = Ameba::Config.load\nconfig.formatter = formatter\nconfig.files = file_paths\n\nAmeba.run config\n```\n","summary":"

Ameba's entry module.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"run(config=Config.load)-instance-method","html_id":"run(config=Config.load)-instance-method","name":"run","doc":"Initializes `Ameba::Runner` and runs it.\nCan be configured via `config` parameter.\n\nExamples:\n\n```\nAmeba.run\nAmeba.run config\n```\n","summary":"

Initializes Ameba::Runner and runs it.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"Config.load","external_name":"config","restriction":""}],"args_string":"(config = Config.load)","args_html":"(config = Config.load)","location":{"filename":"src/ameba.cr","line_number":39,"url":null},"def":{"name":"run","args":[{"name":"config","doc":null,"default_value":"Config.load","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Runner.new(config)).run"}}],"macros":[],"types":[{"html_id":"ameba/Ameba/AST","path":"Ameba/AST.html","kind":"module","full_name":"Ameba::AST","name":"AST","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"[Alias, IsA, Assign, Call, Block, Case, ClassDef, ClassVar, Def, EnumDef, ExceptionHandler, Expressions, HashLiteral, If, InstanceVar, LibDef, ModuleDef, NilLiteral, StringInterpolation, Unless, Var, When, While, Until]","doc":"List of nodes to be visited by Ameba's rules.","summary":"

List of nodes to be visited by Ameba's rules.

"}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that helps to traverse Crystal AST using `Crystal::Visitor`.","summary":"

A module that helps to traverse Crystal AST using Crystal::Visitor.

","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/AST/Argument","path":"Ameba/AST/Argument.html","kind":"class","full_name":"Ameba::AST::Argument","name":"Argument","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the argument of some node.\nHolds the reference to the variable, thus to scope.\n\nFor example, all these vars are arguments:\n\n```\ndef method(a, b, c = 10, &block)\n 3.times do |i|\n end\n\n ->(x : Int32) {}\nend\n```","summary":"

Represents the argument of some node.

","class_methods":[],"constructors":[{"id":"new(node,variable)-class-method","html_id":"new(node,variable)-class-method","name":"new","doc":"Creates a new argument.\n\n```\nArgument.new(node, variable)\n```","summary":"

Creates a new argument.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""}],"args_string":"(node, variable)","args_html":"(node, variable)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, variable)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":23,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":23,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"ignored?-instance-method","html_id":"ignored?-instance-method","name":"ignored?","doc":"Returns true if the name starts with '_', false if not.","summary":"

Returns true if the name starts with '_', false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":35,"url":null},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":22,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":22,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"name-instance-method","html_id":"name-instance-method","name":"name","doc":"Name of the argument.","summary":"

Name of the argument.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":40,"url":null},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case current_node = node\nwhen Crystal::Var\n current_node.name\nwhen Crystal::Arg\n current_node.name\nelse\n raise(ArgumentError.new(\"invalid node\"))\nend"}},{"id":"node:Crystal::Var|Crystal::Arg-instance-method","html_id":"node:Crystal::Var|Crystal::Arg-instance-method","name":"node","doc":"The actual node.","summary":"

The actual node.

","abstract":false,"args":[],"args_string":" : Crystal::Var | Crystal::Arg","args_html":" : Crystal::Var | Crystal::Arg","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":17,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var | Crystal::Arg","visibility":"Public","body":"@node"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":24,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":24,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"variable:Variable-instance-method","html_id":"variable:Variable-instance-method","name":"variable","doc":"Variable of this argument (may be the same node)","summary":"

Variable of this argument (may be the same node)

","abstract":false,"args":[],"args_string":" : Variable","args_html":" : Variable","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":20,"url":null},"def":{"name":"variable","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Variable","visibility":"Public","body":"@variable"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Assignment","path":"Ameba/AST/Assignment.html","kind":"class","full_name":"Ameba::AST::Assignment","name":"Assignment","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the assignment to the variable.\nHolds the assign node and the variable.","summary":"

Represents the assignment to the variable.

","class_methods":[],"constructors":[{"id":"new(node,variable,scope)-class-method","html_id":"new(node,variable,scope)-class-method","name":"new","doc":"Creates a new assignment.\n\n```\nAssignment.new(node, variable, scope)\n```\n","summary":"

Creates a new assignment.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"args_string":"(node, variable, scope)","args_html":"(node, variable, scope)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":32,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, variable, scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"branch:Branch?-instance-method","html_id":"branch:Branch?-instance-method","name":"branch","doc":"Branch of this assignment.","summary":"

Branch of this assignment.

","abstract":false,"args":[],"args_string":" : Branch?","args_html":" : Branch?","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":17,"url":null},"def":{"name":"branch","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"in_branch?-instance-method","html_id":"in_branch?-instance-method","name":"in_branch?","doc":"Returns true if this assignment is in a branch, false if not.\nFor example, this assignment is in a branch:\n\n```\na = 1 if a.nil?\n```","summary":"

Returns true if this assignment is in a branch, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":61,"url":null},"def":{"name":"in_branch?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!branch.nil?"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual assignment node.","summary":"

The actual assignment node.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":11,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"op_assign?-instance-method","html_id":"op_assign?-instance-method","name":"op_assign?","doc":"Returns true if this assignment is an op assign, false if not.\nFor example, this is an op assign:\n\n```\na ||= 1\n```","summary":"

Returns true if this assignment is an op assign, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":51,"url":null},"def":{"name":"op_assign?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::OpAssign)"}},{"id":"referenced=(referenced)-instance-method","html_id":"referenced=(referenced)-instance-method","name":"referenced=","doc":null,"summary":null,"abstract":false,"args":[{"name":"referenced","doc":null,"default_value":"","external_name":"referenced","restriction":""}],"args_string":"(referenced)","args_html":"(referenced)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":null},"def":{"name":"referenced=","args":[{"name":"referenced","doc":null,"default_value":"","external_name":"referenced","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced = referenced"}},{"id":"referenced?:Bool-instance-method","html_id":"referenced?:Bool-instance-method","name":"referenced?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":null},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced"}},{"id":"referenced_in_loop?-instance-method","html_id":"referenced_in_loop?-instance-method","name":"referenced_in_loop?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":41,"url":null},"def":{"name":"referenced_in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@variable.referenced? && @branch.try(&.in_loop?)"}},{"id":"scope:Scope-instance-method","html_id":"scope:Scope-instance-method","name":"scope","doc":"A scope assignment belongs to","summary":"

A scope assignment belongs to

","abstract":false,"args":[],"args_string":" : Scope","args_html":" : Scope","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":20,"url":null},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"id":"target_node-instance-method","html_id":"target_node-instance-method","name":"target_node","doc":"Returns the target node of the variable in this assignment.","summary":"

Returns the target node of the variable in this assignment.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":66,"url":null},"def":{"name":"target_node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case assign = node\nwhen Crystal::Assign\n assign.target\nwhen Crystal::OpAssign\n assign.target\nwhen Crystal::UninitializedVar\n assign.var\nwhen Crystal::MultiAssign\n assign.targets.find(node) do |target|\n target.is_a?(Crystal::Var) && (target.name == variable.name)\n end\nelse\n node\nend"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"transformed?-instance-method","html_id":"transformed?-instance-method","name":"transformed?","doc":"Indicates whether the node is a transformed assignment by the compiler.\ni.e.\n\n```\ncollection.each do |(a, b)|\n puts b\nend\n```\n\nis transformed to:\n\n```\ncollection.each do |__arg0|\n a = __arg0[0]\n b = __arg0[1]\n puts(b)\nend\n```\n","summary":"

Indicates whether the node is a transformed assignment by the compiler.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":99,"url":null},"def":{"name":"transformed?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (assign = node).is_a?(Crystal::Assign)\nelse\n return false\nend\nif (value = assign.value).is_a?(Crystal::Call)\nelse\n return false\nend\nif (obj = value.obj).is_a?(Crystal::Var)\nelse\n return false\nend\nobj.name.starts_with?(\"__arg\")\n"}},{"id":"variable:Variable-instance-method","html_id":"variable:Variable-instance-method","name":"variable","doc":"Variable of this assignment.","summary":"

Variable of this assignment.

","abstract":false,"args":[],"args_string":" : Variable","args_html":" : Variable","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":14,"url":null},"def":{"name":"variable","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Variable","visibility":"Public","body":"@variable"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/BaseVisitor","path":"Ameba/AST/BaseVisitor.html","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor","abstract":true,"superclass":{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},"ancestors":[{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/AST/FlowExpressionVisitor","kind":"class","full_name":"Ameba::AST::FlowExpressionVisitor","name":"FlowExpressionVisitor"},{"html_id":"ameba/Ameba/AST/NodeVisitor","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor"},{"html_id":"ameba/Ameba/AST/ScopeVisitor","kind":"class","full_name":"Ameba::AST::ScopeVisitor","name":"ScopeVisitor"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"An abstract base visitor that utilizes general logic for all visitors.","summary":"

An abstract base visitor that utilizes general logic for all visitors.

","class_methods":[],"constructors":[{"id":"new(rule,source)-class-method","html_id":"new(rule,source)-class-method","name":"new","doc":"Creates instance of this visitor.\n\n```\nvisitor = Ameba::AST::NodeVisitor.new(rule, source)\n```\n","summary":"

Creates instance of this visitor.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(rule, source)","args_html":"(rule, source)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":19,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"visit(node:Crystal::ASTNode)-instance-method","html_id":"visit(node:Crystal::ASTNode)-instance-method","name":"visit","doc":"A main visit method that accepts `Crystal::ASTNode`.\nReturns true meaning all child nodes will be traversed.","summary":"

A main visit method that accepts Crystal::ASTNode.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":25,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"true"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Branch","path":"Ameba/AST/Branch.html","kind":"class","full_name":"Ameba::AST::Branch","name":"Branch","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the branch in Crystal code.\nBranch is a part of a branchable statement.\nFor example, the branchable if statement contains 3 branches:\n\n```\nif a = something # --> Branch A\n a = 1 # --> Branch B\n put a if out # --> Branch C\nelse\n do_something a # --> Branch D\nend\n```\n","summary":"

Represents the branch in Crystal code.

","class_methods":[{"id":"of(node:Crystal::ASTNode,parent_node:Crystal::ASTNode)-class-method","html_id":"of(node:Crystal::ASTNode,parent_node:Crystal::ASTNode)-class-method","name":"of","doc":"Constructs a new branch based on the node some parent scope.\n\n```\nBranch.of(assign_node, def_node)\n```","summary":"

Constructs a new branch based on the node some parent scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","doc":null,"default_value":"","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branch.cr","line_number":66,"url":null},"def":{"name":"of","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","doc":null,"default_value":"","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(BranchVisitor.new(node)).tap(&.accept(parent_node)).branch"}},{"id":"of(node:Crystal::ASTNode,scope:Scope)-class-method","html_id":"of(node:Crystal::ASTNode,scope:Scope)-class-method","name":"of","doc":"Constructs a new branch based on the node in scope.\n\n```\nBranch.of(assign_node, scope)\n```","summary":"

Constructs a new branch based on the node in scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::ASTNode, scope : Scope)","args_html":"(node : Crystal::ASTNode, scope : Scope)","location":{"filename":"src/ameba/ast/branch.cr","line_number":57,"url":null},"def":{"name":"of","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"of(node, scope.node)"}}],"constructors":[{"id":"new(node,parent)-class-method","html_id":"new(node,parent)-class-method","name":"new","doc":"Creates a new branch.\n\n```\nBranch.new(if_node)\n```","summary":"

Creates a new branch.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":""}],"args_string":"(node, parent)","args_html":"(node, parent)","location":{"filename":"src/ameba/ast/branch.cr","line_number":33,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, parent)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"==(other:self)-instance-method","html_id":"==(other:self)-instance-method","name":"==","doc":"Returns `true` if this reference is the same as *other*. Invokes `same?`.","summary":"

Returns true if this reference is the same as other.

","abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","location":null,"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"hash(hasher)-instance-method","html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","location":null,"def":{"name":"hash","args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"id":"in_loop?-instance-method","html_id":"in_loop?-instance-method","name":"in_loop?","doc":"Returns true if current branch is in a loop, false - otherwise.\nFor example, this branch is in a loop:\n\n```\nwhile true\n handle_input # this branch is in a loop\n if wrong_input\n show_message # this branch is also in a loop.\n end\nend\n```\n","summary":"

Returns true if current branch is in a loop, false - otherwise.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/branch.cr","line_number":48,"url":null},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.loop?"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual branch node.","summary":"

The actual branch node.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/branch.cr","line_number":17,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"parent:Branchable-instance-method","html_id":"parent:Branchable-instance-method","name":"parent","doc":"The parent branchable.","summary":"

The parent branchable.

","abstract":false,"args":[],"args_string":" : Branchable","args_html":" : Branchable","location":{"filename":"src/ameba/ast/branch.cr","line_number":20,"url":null},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable","visibility":"Public","body":"@parent"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Branchable","path":"Ameba/AST/Branchable.html","kind":"class","full_name":"Ameba::AST::Branchable","name":"Branchable","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A generic entity to represent a branchable Crystal node.\nFor example, `Crystal::If`, `Crystal::Unless`, `Crystal::While`\nare branchables.\n\n```\nwhite a > 100 # Branchable A\n if b > 2 # Branchable B\n a += 1\n end\nend\n```","summary":"

A generic entity to represent a branchable Crystal node.

","class_methods":[],"constructors":[{"id":"new(node,parent=nil)-class-method","html_id":"new(node,parent=nil)-class-method","name":"new","doc":"Creates a new branchable\n\n```\nBranchable.new(node, parent_branchable)\n```","summary":"

Creates a new branchable

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"nil","external_name":"parent","restriction":""}],"args_string":"(node, parent = nil)","args_html":"(node, parent = nil)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":35,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"nil","external_name":"parent","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, parent)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"branches:Array(Crystal::ASTNode)-instance-method","html_id":"branches:Array(Crystal::ASTNode)-instance-method","name":"branches","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Crystal::ASTNode)","args_html":" : Array(Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":18,"url":null},"def":{"name":"branches","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@branches"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":28,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":28,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":27,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":27,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"loop?-instance-method","html_id":"loop?-instance-method","name":"loop?","doc":"Returns true if this node or one of the parent branchables is a loop, false otherwise.","summary":"

Returns true if this node or one of the parent branchables is a loop, false otherwise.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/branchable.cr","line_number":39,"url":null},"def":{"name":"loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if loop?(node)\n return true\nend\nparent.try(&.loop?) || false\n"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual Crystal node.","summary":"

The actual Crystal node.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/branchable.cr","line_number":21,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"parent:Branchable?-instance-method","html_id":"parent:Branchable?-instance-method","name":"parent","doc":"Parent branchable (if any)","summary":"

Parent branchable (if any)

","abstract":false,"args":[],"args_string":" : Branchable?","args_html":" : Branchable?","location":{"filename":"src/ameba/ast/branchable.cr","line_number":24,"url":null},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":26,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":26,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/CountingVisitor","path":"Ameba/AST/CountingVisitor.html","kind":"class","full_name":"Ameba::AST::CountingVisitor","name":"CountingVisitor","abstract":false,"superclass":{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},"ancestors":[{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"DEFAULT_COMPLEXITY","name":"DEFAULT_COMPLEXITY","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"AST Visitor that counts occurrences of certain keywords","summary":"

AST Visitor that counts occurrences of certain keywords

","class_methods":[],"constructors":[{"id":"new(scope:Crystal::ASTNode)-class-method","html_id":"new(scope:Crystal::ASTNode)-class-method","name":"new","doc":"Creates a new counting visitor","summary":"

Creates a new counting visitor

","abstract":false,"args":[{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Crystal::ASTNode"}],"args_string":"(scope : Crystal::ASTNode)","args_html":"(scope : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":8,"url":null},"def":{"name":"new","args":[{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Crystal::ASTNode"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"count-instance-method","html_id":"count-instance-method","name":"count","doc":"Returns the number of keywords that were found in the node","summary":"

Returns the number of keywords that were found in the node

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":18,"url":null},"def":{"name":"count","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@scope.accept(self)\n@complexity\n"}},{"id":"macro_condition:Bool-instance-method","html_id":"macro_condition:Bool-instance-method","name":"macro_condition","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":5,"url":null},"def":{"name":"macro_condition","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition"}},{"id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","html_id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","name":"visit","doc":null,"summary":null,"abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"args_string":"(node : Crystal::MacroIf | Crystal::MacroFor)","args_html":"(node : Crystal::MacroIf | Crystal::MacroFor)","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":33,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition = true\n@complexity = DEFAULT_COMPLEXITY\nfalse\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/FlowExpression","path":"Ameba/AST/FlowExpression.html","kind":"class","full_name":"Ameba::AST::FlowExpression","name":"FlowExpression","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents a flow expression in Crystal code.\nFor example,\n\n```\ndef foobar\n a = 3\n return 42 # => flow expression\n a + 1\nend\n```\n\nFlow expression contains an actual node of a control expression and\na parent node, which allows easily search through the related statement\n(i.e. find unreachable code)","summary":"

Represents a flow expression in Crystal code.

","class_methods":[],"constructors":[{"id":"new(node,in_loop)-class-method","html_id":"new(node,in_loop)-class-method","name":"new","doc":"Creates a new flow expression.\n\n```\nFlowExpression.new(node, parent_node)\n```","summary":"

Creates a new flow expression.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":36,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, in_loop)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":29,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":29,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"in_loop?:Bool-instance-method","html_id":"in_loop?:Bool-instance-method","name":"in_loop?","doc":"Is true only if some of the nodes parents is a loop.","summary":"

Is true only if some of the nodes parents is a loop.

","abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":22,"url":null},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":28,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":28,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual node of the flow expression.","summary":"

The actual node of the flow expression.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":25,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":27,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":27,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"unreachable_nodes-instance-method","html_id":"unreachable_nodes-instance-method","name":"unreachable_nodes","doc":"Returns nodes which can't be reached because of a flow command inside.\nFor example:\n\n```\ndef foobar\n a = 1\n return 42\n\n a + 2 # => unreachable assign node\nend\n```","summary":"

Returns nodes which can't be reached because of a flow command inside.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":50,"url":null},"def":{"name":"unreachable_nodes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"unreachable_nodes = [] of Crystal::ASTNode\ncase current_node = node\nwhen Crystal::Expressions\n control_flow_found = false\n current_node.expressions.each do |exp|\n if control_flow_found\n unreachable_nodes << exp\n end\n control_flow_found || (control_flow_found = flow_expression?(exp, in_loop?))\n end\nwhen Crystal::BinaryOp\n if flow_expression?(current_node.left, in_loop?)\n unreachable_nodes << current_node.right\n end\nelse\nend\nunreachable_nodes\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/FlowExpressionVisitor","path":"Ameba/AST/FlowExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::FlowExpressionVisitor","name":"FlowExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"AST Visitor that traverses all the flow expressions.","summary":"

AST Visitor that traverses all the flow expressions.

","class_methods":[],"constructors":[{"id":"new(rule,source)-class-method","html_id":"new(rule,source)-class-method","name":"new","doc":"Creates a new flow expression visitor.","summary":"

Creates a new flow expression visitor.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(rule, source)","args_html":"(rule, source)","location":{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":12,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/InstanceVariable","path":"Ameba/AST/InstanceVariable.html","kind":"class","full_name":"Ameba::AST::InstanceVariable","name":"InstanceVariable","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(node)-class-method","html_id":"new(node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":10,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":6,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":6,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":5,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":5,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"name(*args,**options)-instance-method","html_id":"name(*args,**options)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":7,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options)"}},{"id":"name(*args,**options,&)-instance-method","html_id":"name(*args,**options,&)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":7,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::InstanceVar-instance-method","html_id":"node:Crystal::InstanceVar-instance-method","name":"node","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::InstanceVar","args_html":" : Crystal::InstanceVar","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":3,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/NodeVisitor","path":"Ameba/AST/NodeVisitor.html","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},"ancestors":[{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"An AST Visitor that traverses the source and allows all nodes\nto be inspected by rules.\n\n```\nvisitor = Ameba::AST::NodeVisitor.new(rule, source)\n```\n","summary":"

An AST Visitor that traverses the source and allows all nodes to be inspected by rules.

","class_methods":[],"constructors":[{"id":"new(rule,source,skip=nil)-class-method","html_id":"new(rule,source,skip=nil)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"skip","doc":null,"default_value":"nil","external_name":"skip","restriction":""}],"args_string":"(rule, source, skip = nil)","args_html":"(rule, source, skip = nil)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":42,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"skip","doc":null,"default_value":"nil","external_name":"skip","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"visit(node:Crystal::Alias)-instance-method","html_id":"visit(node:Crystal::Alias)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Alias` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Alias node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(node : Crystal::Alias)","args_html":"(node : Crystal::Alias)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Until)-instance-method","html_id":"visit(node:Crystal::Until)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Until` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Until node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(node : Crystal::Until)","args_html":"(node : Crystal::Until)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::While)-instance-method","html_id":"visit(node:Crystal::While)-instance-method","name":"visit","doc":"A visit callback for `Crystal::While` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::While node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"args_string":"(node : Crystal::While)","args_html":"(node : Crystal::While)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::When)-instance-method","html_id":"visit(node:Crystal::When)-instance-method","name":"visit","doc":"A visit callback for `Crystal::When` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::When node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"args_string":"(node : Crystal::When)","args_html":"(node : Crystal::When)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Var)-instance-method","html_id":"visit(node:Crystal::Var)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Var` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Var node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(node : Crystal::Var)","args_html":"(node : Crystal::Var)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Unless)-instance-method","html_id":"visit(node:Crystal::Unless)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Unless` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Unless node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(node : Crystal::Unless)","args_html":"(node : Crystal::Unless)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::StringInterpolation)-instance-method","html_id":"visit(node:Crystal::StringInterpolation)-instance-method","name":"visit","doc":"A visit callback for `Crystal::StringInterpolation` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::StringInterpolation node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(node : Crystal::StringInterpolation)","args_html":"(node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::NilLiteral)-instance-method","html_id":"visit(node:Crystal::NilLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::NilLiteral` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::NilLiteral node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(node : Crystal::NilLiteral)","args_html":"(node : Crystal::NilLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ModuleDef)-instance-method","html_id":"visit(node:Crystal::ModuleDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ModuleDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ModuleDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(node : Crystal::ModuleDef)","args_html":"(node : Crystal::ModuleDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::LibDef)-instance-method","html_id":"visit(node:Crystal::LibDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::LibDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::LibDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(node : Crystal::LibDef)","args_html":"(node : Crystal::LibDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::InstanceVar)-instance-method","html_id":"visit(node:Crystal::InstanceVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::InstanceVar` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::InstanceVar node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::If)-instance-method","html_id":"visit(node:Crystal::If)-instance-method","name":"visit","doc":"A visit callback for `Crystal::If` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::If node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"args_string":"(node : Crystal::If)","args_html":"(node : Crystal::If)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::HashLiteral)-instance-method","html_id":"visit(node:Crystal::HashLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::HashLiteral` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::HashLiteral node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(node : Crystal::HashLiteral)","args_html":"(node : Crystal::HashLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Expressions)-instance-method","html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Expressions` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Expressions node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(node : Crystal::Expressions)","args_html":"(node : Crystal::Expressions)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ExceptionHandler)-instance-method","html_id":"visit(node:Crystal::ExceptionHandler)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ExceptionHandler` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ExceptionHandler node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(node : Crystal::ExceptionHandler)","args_html":"(node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::EnumDef)-instance-method","html_id":"visit(node:Crystal::EnumDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::EnumDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::EnumDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(node : Crystal::EnumDef)","args_html":"(node : Crystal::EnumDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Def)-instance-method","html_id":"visit(node:Crystal::Def)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Def` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Def node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(node : Crystal::Def)","args_html":"(node : Crystal::Def)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ClassVar)-instance-method","html_id":"visit(node:Crystal::ClassVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassVar` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ClassVar node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(node : Crystal::ClassVar)","args_html":"(node : Crystal::ClassVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ClassDef)-instance-method","html_id":"visit(node:Crystal::ClassDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ClassDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(node : Crystal::ClassDef)","args_html":"(node : Crystal::ClassDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Case)-instance-method","html_id":"visit(node:Crystal::Case)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Case` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Case node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(node : Crystal::Case)","args_html":"(node : Crystal::Case)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Block)-instance-method","html_id":"visit(node:Crystal::Block)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Block` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Block node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(node : Crystal::Block)","args_html":"(node : Crystal::Block)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Call)-instance-method","html_id":"visit(node:Crystal::Call)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Call` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Call node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(node : Crystal::Call)","args_html":"(node : Crystal::Call)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Assign)-instance-method","html_id":"visit(node:Crystal::Assign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Assign` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Assign node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(node : Crystal::Assign)","args_html":"(node : Crystal::Assign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::IsA)-instance-method","html_id":"visit(node:Crystal::IsA)-instance-method","name":"visit","doc":"A visit callback for `Crystal::IsA` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::IsA node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(node : Crystal::IsA)","args_html":"(node : Crystal::IsA)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node)-instance-method","html_id":"visit(node)-instance-method","name":"visit","doc":null,"summary":null,"abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":56,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (skip = @skip)\nelse\n return true\nend\n!(skip.includes?(node.class))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/RedundantControlExpressionVisitor","path":"Ameba/AST/RedundantControlExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::RedundantControlExpressionVisitor","name":"RedundantControlExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A class that utilizes a logic to traverse AST nodes and\nfire a source test callback if a redundant `Crystal::ControlExpression`\nis reached.","summary":"

A class that utilizes a logic to traverse AST nodes and fire a source test callback if a redundant Crystal::ControlExpression is reached.

","class_methods":[],"constructors":[{"id":"new(rule,source,node)-class-method","html_id":"new(rule,source,node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(rule, source, node)","args_html":"(rule, source, node)","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":15,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"A node to run traversal on.","summary":"

A node to run traversal on.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":13,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"rule:Rule::Base-instance-method","html_id":"rule:Rule::Base-instance-method","name":"rule","doc":"A corresponding rule that uses this visitor.","summary":"

A corresponding rule that uses this visitor.

","abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":7,"url":null},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"id":"source:Source-instance-method","html_id":"source:Source-instance-method","name":"source","doc":"A source that needs to be traversed.","summary":"

A source that needs to be traversed.

","abstract":false,"args":[],"args_string":" : Source","args_html":" : Source","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":10,"url":null},"def":{"name":"source","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Source","visibility":"Public","body":"@source"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Reference","path":"Ameba/AST/Reference.html","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/Variable","kind":"class","full_name":"Ameba::AST::Variable","name":"Variable"},"ancestors":[{"html_id":"ameba/Ameba/AST/Variable","kind":"class","full_name":"Ameba::AST::Variable","name":"Variable"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents a reference to the variable.\nIt behaves like a variable is used to distinguish a\nthe variable from its reference.","summary":"

Represents a reference to the variable.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"explicit=(explicit)-instance-method","html_id":"explicit=(explicit)-instance-method","name":"explicit=","doc":null,"summary":null,"abstract":false,"args":[{"name":"explicit","doc":null,"default_value":"","external_name":"explicit","restriction":""}],"args_string":"(explicit)","args_html":"(explicit)","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":null},"def":{"name":"explicit=","args":[{"name":"explicit","doc":null,"default_value":"","external_name":"explicit","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@explicit = explicit"}},{"id":"explicit?:Bool-instance-method","html_id":"explicit?:Bool-instance-method","name":"explicit?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":null},"def":{"name":"explicit?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@explicit"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Scope","path":"Ameba/AST/Scope.html","kind":"class","full_name":"Ameba::AST::Scope","name":"Scope","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents a context of the local variable visibility.\nThis is where the local variables belong to.","summary":"

Represents a context of the local variable visibility.

","class_methods":[],"constructors":[{"id":"new(node,outer_scope=nil)-class-method","html_id":"new(node,outer_scope=nil)-class-method","name":"new","doc":"Creates a new scope. Accepts the AST node and the outer scope.\n\n```\nscope = Scope.new(class_node, nil)\n```","summary":"

Creates a new scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"outer_scope","doc":null,"default_value":"nil","external_name":"outer_scope","restriction":""}],"args_string":"(node, outer_scope = nil)","args_html":"(node, outer_scope = nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":39,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"outer_scope","doc":null,"default_value":"nil","external_name":"outer_scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, outer_scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"==(other:self)-instance-method","html_id":"==(other:self)-instance-method","name":"==","doc":"Returns `true` if this reference is the same as *other*. Invokes `same?`.","summary":"

Returns true if this reference is the same as other.

","abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","location":null,"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"id":"add_argument(node)-instance-method","html_id":"add_argument(node)-instance-method","name":"add_argument","doc":"Creates a new argument in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_argument(arg_node)\n```","summary":"

Creates a new argument in the current scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":59,"url":null},"def":{"name":"add_argument","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"add_variable((Crystal::Var.new(node.name)).at(node))\narguments << (Argument.new(node, variables.last))\n"}},{"id":"add_ivariable(node)-instance-method","html_id":"add_ivariable(node)-instance-method","name":"add_ivariable","doc":"Adds a new instance variable to the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_ivariable(ivar_node)\n```","summary":"

Adds a new instance variable to the current scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":70,"url":null},"def":{"name":"add_ivariable","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ivariables << (InstanceVariable.new(node))"}},{"id":"add_variable(node)-instance-method","html_id":"add_variable(node)-instance-method","name":"add_variable","doc":"Creates a new variable in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_variable(var_node)\n```","summary":"

Creates a new variable in the current scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":49,"url":null},"def":{"name":"add_variable","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variables << (Variable.new(node, self))"}},{"id":"arg?(var)-instance-method","html_id":"arg?(var)-instance-method","name":"arg?","doc":"Returns true if var is an argument in current scope, false if not.","summary":"

Returns true if var is an argument in current scope, false if not.

","abstract":false,"args":[{"name":"var","doc":null,"default_value":"","external_name":"var","restriction":""}],"args_string":"(var)","args_html":"(var)","location":{"filename":"src/ameba/ast/scope.cr","line_number":155,"url":null},"def":{"name":"arg?","args":[{"name":"var","doc":null,"default_value":"","external_name":"var","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case current_node = node\nwhen Crystal::Def\n var.is_a?(Crystal::Arg) && (any_arg?(current_node.args, var))\nwhen Crystal::Block\n var.is_a?(Crystal::Var) && (any_arg?(current_node.args, var))\nwhen Crystal::ProcLiteral\n var.is_a?(Crystal::Var) && (any_arg?(current_node.def.args, var))\nelse\n false\nend"}},{"id":"arguments:Array(Ameba::AST::Argument)-instance-method","html_id":"arguments:Array(Ameba::AST::Argument)-instance-method","name":"arguments","doc":"Link to the arguments in current scope","summary":"

Link to the arguments in current scope

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Argument)","args_html":" : Array(Ameba::AST::Argument)","location":{"filename":"src/ameba/ast/scope.cr","line_number":14,"url":null},"def":{"name":"arguments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@arguments"}},{"id":"assign_variable(name,node)-instance-method","html_id":"assign_variable(name,node)-instance-method","name":"assign_variable","doc":"Creates a new assignment for the variable.\n\n```\nscope = Scope.new(class_node, nil)\nscope.assign_variable(var_name, assign_node)\n```","summary":"

Creates a new assignment for the variable.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(name, node)","args_html":"(name, node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":90,"url":null},"def":{"name":"assign_variable","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(find_variable(name)).try(&.assign(node, self))"}},{"id":"assigns_ivar?(name)-instance-method","html_id":"assigns_ivar?(name)-instance-method","name":"assigns_ivar?","doc":"Returns true instance variable assinged in this scope.","summary":"

Returns true instance variable assinged in this scope.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":119,"url":null},"def":{"name":"assigns_ivar?","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"arguments.find do |arg|\n arg.name == name\nend && ivariables.find do |var|\n var.name == \"@#{name}\"\nend"}},{"id":"block?-instance-method","html_id":"block?-instance-method","name":"block?","doc":"Returns true if current scope represents a block (or proc),\nfalse if not.","summary":"

Returns true if current scope represents a block (or proc), false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":96,"url":null},"def":{"name":"block?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::Block) || node.is_a?(Crystal::ProcLiteral)"}},{"id":"def?-instance-method","html_id":"def?-instance-method","name":"def?","doc":"Returns true if current scope is a def, false if not.","summary":"

Returns true if current scope is a def, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":145,"url":null},"def":{"name":"def?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::Def)"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":30,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":30,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"eql?(node)-instance-method","html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns true if the `node` represents exactly\nthe same Crystal node as `@node`.","summary":"

Returns true if the #node represents exactly the same Crystal node as @node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":174,"url":null},"def":{"name":"eql?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node == @node) && (!node.location.nil?)) && (node.location == @node.location)"}},{"id":"find_variable(name:String)-instance-method","html_id":"find_variable(name:String)-instance-method","name":"find_variable","doc":"Returns variable by its name or nil if it does not exist.\n\n```\nscope = Scope.new(class_node, nil)\nscope.find_variable(\"foo\")\n```","summary":"

Returns variable by its name or nil if it does not exist.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/ast/scope.cr","line_number":80,"url":null},"def":{"name":"find_variable","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variables.find do |v|\n v.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"id":"hash(hasher)-instance-method","html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","location":null,"def":{"name":"hash","args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"id":"in_macro?-instance-method","html_id":"in_macro?-instance-method","name":"in_macro?","doc":"Returns true if current scope sits inside a macro.","summary":"

Returns true if current scope sits inside a macro.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":114,"url":null},"def":{"name":"in_macro?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::Macro) || (!(!outer_scope.try(&.in_macro?)))"}},{"id":"inner_scopes:Array(Ameba::AST::Scope)-instance-method","html_id":"inner_scopes:Array(Ameba::AST::Scope)-instance-method","name":"inner_scopes","doc":"List of inner scopes","summary":"

List of inner scopes

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Scope)","args_html":" : Array(Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/scope.cr","line_number":23,"url":null},"def":{"name":"inner_scopes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@inner_scopes"}},{"id":"ivariables:Array(Ameba::AST::InstanceVariable)-instance-method","html_id":"ivariables:Array(Ameba::AST::InstanceVariable)-instance-method","name":"ivariables","doc":"Link to the instance variables used in current scope","summary":"

Link to the instance variables used in current scope

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::InstanceVariable)","args_html":" : Array(Ameba::AST::InstanceVariable)","location":{"filename":"src/ameba/ast/scope.cr","line_number":17,"url":null},"def":{"name":"ivariables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ivariables"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.location(*args, **options)"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual AST node that represents a current scope.","summary":"

The actual AST node that represents a current scope.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/scope.cr","line_number":26,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"outer_scope:Scope?-instance-method","html_id":"outer_scope:Scope?-instance-method","name":"outer_scope","doc":"Link to the outer scope","summary":"

Link to the outer scope

","abstract":false,"args":[],"args_string":" : Scope?","args_html":" : Scope?","location":{"filename":"src/ameba/ast/scope.cr","line_number":20,"url":null},"def":{"name":"outer_scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope | ::Nil","visibility":"Public","body":"@outer_scope"}},{"id":"references:Array(Ameba::AST::Reference)-instance-method","html_id":"references:Array(Ameba::AST::Reference)-instance-method","name":"references","doc":"Link to all variable references in currency scope","summary":"

Link to all variable references in currency scope

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Reference)","args_html":" : Array(Ameba::AST::Reference)","location":{"filename":"src/ameba/ast/scope.cr","line_number":11,"url":null},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"id":"references?(variable:Variable)-instance-method","html_id":"references?(variable:Variable)-instance-method","name":"references?","doc":"Returns true if current scope (or any of inner scopes) references variable,\nfalse if not.","summary":"

Returns true if current scope (or any of inner scopes) references variable, false if not.

","abstract":false,"args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"}],"args_string":"(variable : Variable)","args_html":"(variable : Variable)","location":{"filename":"src/ameba/ast/scope.cr","line_number":137,"url":null},"def":{"name":"references?","args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variable.references.any? do |reference|\n (reference.scope == self) || inner_scopes.any?(&.references?(variable))\nend || variable.used_in_macro?"}},{"id":"spawn_block?-instance-method","html_id":"spawn_block?-instance-method","name":"spawn_block?","doc":"Returns true if current scope represents a spawn block, e. g.\n\n```\nspawn do\n # ...\nend\n```","summary":"

Returns true if current scope represents a spawn block, e.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":107,"url":null},"def":{"name":"spawn_block?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.is_a?(Crystal::Block)\nelse\n return false\nend\ncall = (node.as(Crystal::Block)).call\ncall.try(&.name) == \"spawn\"\n"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":28,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":28,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"top_level?-instance-method","html_id":"top_level?-instance-method","name":"top_level?","doc":"Returns true if this scope is a top level scope, false if not.","summary":"

Returns true if this scope is a top level scope, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":150,"url":null},"def":{"name":"top_level?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"outer_scope.nil?"}},{"id":"type_definition?-instance-method","html_id":"type_definition?-instance-method","name":"type_definition?","doc":"Returns true if and only if current scope represents some\ntype definition, for example a class.","summary":"

Returns true if and only if current scope represents some type definition, for example a class.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":126,"url":null},"def":{"name":"type_definition?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((((node.is_a?(Crystal::ClassDef) || node.is_a?(Crystal::ModuleDef)) || node.is_a?(Crystal::LibDef)) || node.is_a?(Crystal::FunDef)) || node.is_a?(Crystal::TypeDef)) || node.is_a?(Crystal::CStructOrUnionDef)"}},{"id":"variables:Array(Ameba::AST::Variable)-instance-method","html_id":"variables:Array(Ameba::AST::Variable)-instance-method","name":"variables","doc":"Link to local variables","summary":"

Link to local variables

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Variable)","args_html":" : Array(Ameba::AST::Variable)","location":{"filename":"src/ameba/ast/scope.cr","line_number":8,"url":null},"def":{"name":"variables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@variables"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/ScopeVisitor","path":"Ameba/AST/ScopeVisitor.html","kind":"class","full_name":"Ameba::AST::ScopeVisitor","name":"ScopeVisitor","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},"ancestors":[{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"RECORD_NODE_NAME","name":"RECORD_NODE_NAME","value":"\"record\"","doc":null,"summary":null},{"id":"SUPER_NODE_NAME","name":"SUPER_NODE_NAME","value":"\"super\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"AST Visitor that traverses the source and constructs scopes.","summary":"

AST Visitor that traverses the source and constructs scopes.

","class_methods":[],"constructors":[{"id":"new(rule,source)-class-method","html_id":"new(rule,source)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(rule, source)","args_html":"(rule, source)","location":{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":13,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Util","path":"Ameba/AST/Util.html","kind":"module","full_name":"Ameba::AST::Util","name":"Util","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/AST/Branchable","kind":"class","full_name":"Ameba::AST::Branchable","name":"Branchable"},{"html_id":"ameba/Ameba/AST/FlowExpression","kind":"class","full_name":"Ameba::AST::FlowExpression","name":"FlowExpression"},{"html_id":"ameba/Ameba/AST/FlowExpressionVisitor","kind":"class","full_name":"Ameba::AST::FlowExpressionVisitor","name":"FlowExpressionVisitor"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"struct","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"struct","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"}],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Utility module for Ameba's rules.","summary":"

Utility module for Ameba's rules.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"abort?(node)-instance-method","html_id":"abort?(node)-instance-method","name":"abort?","doc":"Returns true if node represents `abort` method call.","summary":"

Returns true if node represents abort method call.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":141,"url":null},"def":{"name":"abort?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"abort\")) && node.args.size <= 2) && node.obj.nil?"}},{"id":"exit?(node)-instance-method","html_id":"exit?(node)-instance-method","name":"exit?","doc":"Returns true if node represents `exit` method call.","summary":"

Returns true if node represents exit method call.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":135,"url":null},"def":{"name":"exit?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"exit\")) && node.args.size <= 1) && node.obj.nil?"}},{"id":"flow_command?(node,in_loop)-instance-method","html_id":"flow_command?(node,in_loop)-instance-method","name":"flow_command?","doc":"Returns true if node is a flow command, false - otherwise.\nNode represents a flow command if it is a control expression,\nor special call node that interrupts execution (i.e. raise, exit, abort).","summary":"

Returns true if node is a flow command, false - otherwise.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/util.cr","line_number":62,"url":null},"def":{"name":"flow_command?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case node\nwhen Crystal::Return\n true\nwhen Crystal::Break, Crystal::Next\n in_loop\nwhen Crystal::Call\n ((raise?(node)) || (exit?(node))) || (abort?(node))\nelse\n false\nend"}},{"id":"flow_expression?(node,in_loop=false)-instance-method","html_id":"flow_expression?(node,in_loop=false)-instance-method","name":"flow_expression?","doc":"Returns true if node is a flow expression, false if not.\nNode represents a flow expression if it is full-filled by a flow command.\n\nFor example, this node is a flow expression, because each branch contains\na flow command `return`:\n\n```\nif a > 0\n return :positive\nelsif a < 0\n return :negative\nelse\n return :zero\nend\n```\n\nThis node is a not a flow expression:\n\n```\nif a > 0\n return :positive\nend\n```\n\nThat's because not all branches return(i.e. `else` is missing).\n","summary":"

Returns true if node is a flow expression, false if not.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"false","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop = false)","args_html":"(node, in_loop = false)","location":{"filename":"src/ameba/ast/util.cr","line_number":101,"url":null},"def":{"name":"flow_expression?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"false","external_name":"in_loop","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if flow_command?(node, in_loop)\n return true\nend\ncase node\nwhen Crystal::If, Crystal::Unless\n flow_expressions?([node.then, node.else], in_loop)\nwhen Crystal::BinaryOp\n flow_expression?(node.left, in_loop)\nwhen Crystal::Case\n flow_expressions?([node.whens, node.else].flatten, in_loop)\nwhen Crystal::ExceptionHandler\n flow_expressions?([node.else || node.body, node.rescues].flatten, in_loop)\nwhen Crystal::While, Crystal::Until\n flow_expression?(node.body, in_loop)\nwhen Crystal::Rescue, Crystal::When\n flow_expression?(node.body, in_loop)\nwhen Crystal::Expressions\n node.expressions.any? do |exp|\n flow_expression?(exp, in_loop)\n end\nelse\n false\nend\n"}},{"id":"literal?(node)-instance-method","html_id":"literal?(node)-instance-method","name":"literal?","doc":"Returns true if current `node` is a literal, false otherwise.","summary":"

Returns true if current node is a literal, false otherwise.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":4,"url":null},"def":{"name":"literal?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case node\nwhen Crystal::NilLiteral, Crystal::BoolLiteral, Crystal::NumberLiteral, Crystal::CharLiteral, Crystal::StringLiteral, Crystal::SymbolLiteral, Crystal::RegexLiteral, Crystal::ProcLiteral, Crystal::MacroLiteral\n true\nwhen Crystal::RangeLiteral\n (literal?(node.from)) && (literal?(node.to))\nwhen Crystal::ArrayLiteral, Crystal::TupleLiteral\n node.elements.all? do |el|\n literal?(el)\n end\nwhen Crystal::HashLiteral\n node.entries.all? do |entry|\n (literal?(entry.key)) && (literal?(entry.value))\n end\nwhen Crystal::NamedTupleLiteral\n node.entries.all? do |entry|\n literal?(entry.value)\n end\nelse\n false\nend"}},{"id":"loop?(node)-instance-method","html_id":"loop?(node)-instance-method","name":"loop?","doc":"Returns true if node represents a loop.","summary":"

Returns true if node represents a loop.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":147,"url":null},"def":{"name":"loop?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case node\nwhen Crystal::While, Crystal::Until\n true\nwhen Crystal::Call\n ((node.name == \"loop\") && (node.args.size == 0)) && node.obj.nil?\nelse\n false\nend"}},{"id":"node_source(node,code_lines)-instance-method","html_id":"node_source(node,code_lines)-instance-method","name":"node_source","doc":"Returns a source code for the current node.\nThis method uses `node.location` and `node.end_location`\nto determine and cut a piece of source of the node.","summary":"

Returns a source code for the current node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"args_string":"(node, code_lines)","args_html":"(node, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":33,"url":null},"def":{"name":"node_source","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"loc, end_loc = node.location, node.end_location\nif loc && end_loc\nelse\n return\nend\nline, column = loc.line_number - 1, loc.column_number - 1\nend_line, end_column = end_loc.line_number - 1, end_loc.column_number - 1\nnode_lines = code_lines[line..end_line]\nfirst_line, last_line = node_lines[0]?, node_lines[-1]?\nif first_line.nil? || last_line.nil?\n return\nend\nif first_line.size < column\n return\nend\nnode_lines[0] = first_line.sub(0...column, \"\")\nif line == end_line\n end_column = end_column - column\n last_line = node_lines[0]\nend\nif last_line.size < (end_column + 1)\n return\nend\nnode_lines[-1] = last_line.sub((end_column + 1)...last_line.size, \"\")\nnode_lines\n"}},{"id":"raise?(node)-instance-method","html_id":"raise?(node)-instance-method","name":"raise?","doc":"Returns true if node represents `raise` method call.","summary":"

Returns true if node represents raise method call.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":129,"url":null},"def":{"name":"raise?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"raise\")) && (node.args.size == 1)) && node.obj.nil?"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Variable","path":"Ameba/AST/Variable.html","kind":"class","full_name":"Ameba::AST::Variable","name":"Variable","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/AST/Reference","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the existence of the local variable.\nHolds the var node and variable assigments.","summary":"

Represents the existence of the local variable.

","class_methods":[],"constructors":[{"id":"new(node,scope)-class-method","html_id":"new(node,scope)-class-method","name":"new","doc":"Creates a new variable(in the scope).\n\n```\nVariable.new(node, scope)\n```\n","summary":"

Creates a new variable(in the scope).

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"assign(node,scope)-instance-method","html_id":"assign(node,scope)-instance-method","name":"assign","doc":"Assigns the variable (creates a new assignment).\nVariable may have multiple assignments.\n\n```\nvariable = Variable.new(node, scope)\nvariable.assign(node1)\nvariable.assign(node2)\nvariable.assignment.size # => 2\n```\n","summary":"

Assigns the variable (creates a new assignment).

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":49,"url":null},"def":{"name":"assign","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"assignments << (Assignment.new(node, self, scope))\nupdate_assign_reference!\n"}},{"id":"assign_before_reference:Crystal::ASTNode?-instance-method","html_id":"assign_before_reference:Crystal::ASTNode?-instance-method","name":"assign_before_reference","doc":"Node of the first assignment which can be available before any reference.","summary":"

Node of the first assignment which can be available before any reference.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode?","args_html":" : Crystal::ASTNode?","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":18,"url":null},"def":{"name":"assign_before_reference","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode | ::Nil","visibility":"Public","body":"@assign_before_reference"}},{"id":"assignments:Array(Ameba::AST::Assignment)-instance-method","html_id":"assignments:Array(Ameba::AST::Assignment)-instance-method","name":"assignments","doc":"List of the assigments of this variable.","summary":"

List of the assigments of this variable.

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Assignment)","args_html":" : Array(Ameba::AST::Assignment)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":6,"url":null},"def":{"name":"assignments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@assignments"}},{"id":"captured_by_block?(scope=@scope)-instance-method","html_id":"captured_by_block?(scope=@scope)-instance-method","name":"captured_by_block?","doc":"Returns true if the current var is referenced in\nin the block. For example this variable is captured\nby block:\n\n```\na = 1\n3.times { |i| a = a + i }\n```\n\nAnd this variable is not captured by block.\n\n```\ni = 1\n3.times { |i| i + 1 }\n```","summary":"

Returns true if the current var is referenced in in the block.

","abstract":false,"args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":114,"url":null},"def":{"name":"captured_by_block?","args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.inner_scopes.each do |inner_scope|\n if inner_scope.block? && (inner_scope.references?(self))\n return true\n end\n if captured_by_block?(inner_scope)\n return true\n end\nend\nfalse\n"}},{"id":"declared_before?(node)-instance-method","html_id":"declared_before?(node)-instance-method","name":"declared_before?","doc":"Returns true if the variable is delcared before the `node`.","summary":"

Returns true if the variable is delcared before the #node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":160,"url":null},"def":{"name":"declared_before?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"var_location, node_location = location, node.location\nif var_location.nil? || node_location.nil?\n return\nend\n(var_location.line_number < node_location.line_number) || ((var_location.line_number == node_location.line_number) && var_location.column_number < node_location.column_number)\n"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":21,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":21,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"eql?(node)-instance-method","html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns true if the `node` represents exactly\nthe same Crystal node as `@node`.","summary":"

Returns true if the #node represents exactly the same Crystal node as @node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":153,"url":null},"def":{"name":"eql?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(node.is_a?(Crystal::Var) && (node.name == @node.name)) && (node.location == @node.location)"}},{"id":"ignored?-instance-method","html_id":"ignored?-instance-method","name":"ignored?","doc":"Returns true if the name starts with '_', false if not.","summary":"

Returns true if the name starts with '_', false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":147,"url":null},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":20,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":20,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"name(*args,**options)-instance-method","html_id":"name(*args,**options)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":22,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options)"}},{"id":"name(*args,**options,&)-instance-method","html_id":"name(*args,**options,&)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":22,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::Var-instance-method","html_id":"node:Crystal::Var-instance-method","name":"node","doc":"The actual var node.","summary":"

The actual var node.

","abstract":false,"args":[],"args_string":" : Crystal::Var","args_html":" : Crystal::Var","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":12,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var","visibility":"Public","body":"@node"}},{"id":"reference(node:Crystal::Var,scope:Scope)-instance-method","html_id":"reference(node:Crystal::Var,scope:Scope)-instance-method","name":"reference","doc":"Creates a reference to this variable in some scope.\n\n```\nvariable = Variable.new(node, scope)\nvariable.reference(var_node, some_scope)\n```\n","summary":"

Creates a reference to this variable in some scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::Var, scope : Scope)","args_html":"(node : Crystal::Var, scope : Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":73,"url":null},"def":{"name":"reference","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Reference.new(node, scope)).tap do |reference|\n references << reference\n scope.references << reference\nend"}},{"id":"reference_assignments!-instance-method","html_id":"reference_assignments!-instance-method","name":"reference_assignments!","doc":"Reference variable's assignments.\n\n```\nvariable = Variable.new(node, scope)\nvariable.assign(assign_node)\nvariable.reference_assignments!\n```","summary":"

Reference variable's assignments.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":87,"url":null},"def":{"name":"reference_assignments!","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"consumed_branches = Set(Branch).new\nassignments.reverse_each do |assignment|\n if consumed_branches.includes?(assignment.branch)\n next\n end\n assignment.referenced = true\n if assignment.branch\n else\n break\n end\n consumed_branches << assignment.branch.not_nil!\nend\n"}},{"id":"referenced?-instance-method","html_id":"referenced?-instance-method","name":"referenced?","doc":"Returns true if variable has any reference.\n\n```\nvariable = Variable.new(node, scope)\nvariable.reference(var_node)\nvariable.referenced? # => true\n```","summary":"

Returns true if variable has any reference.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":62,"url":null},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"references.any?"}},{"id":"references:Array(Ameba::AST::Reference)-instance-method","html_id":"references:Array(Ameba::AST::Reference)-instance-method","name":"references","doc":"List of the references of this variable.","summary":"

List of the references of this variable.

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Reference)","args_html":" : Array(Ameba::AST::Reference)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":9,"url":null},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"id":"scope:Scope-instance-method","html_id":"scope:Scope-instance-method","name":"scope","doc":"Scope of this variable.","summary":"

Scope of this variable.

","abstract":false,"args":[],"args_string":" : Scope","args_html":" : Scope","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":15,"url":null},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"id":"special?-instance-method","html_id":"special?-instance-method","name":"special?","doc":"Returns true if it is a special variable, i.e `$?`.","summary":"

Returns true if it is a special variable, i.e $?.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":35,"url":null},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.special_var?"}},{"id":"target_of?(assign)-instance-method","html_id":"target_of?(assign)-instance-method","name":"target_of?","doc":"Returns true if the variable is a target (on the left) of the assignment,\nfalse otherwise.","summary":"

Returns true if the variable is a target (on the left) of the assignment, false otherwise.

","abstract":false,"args":[{"name":"assign","doc":null,"default_value":"","external_name":"assign","restriction":""}],"args_string":"(assign)","args_html":"(assign)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":135,"url":null},"def":{"name":"target_of?","args":[{"name":"assign","doc":null,"default_value":"","external_name":"assign","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case assign\nwhen Crystal::Assign\n eql?(assign.target)\nwhen Crystal::OpAssign\n eql?(assign.target)\nwhen Crystal::MultiAssign\n assign.targets.any? do |t|\n eql?(t)\n end\nwhen Crystal::UninitializedVar\n eql?(assign.var)\nelse\n false\nend"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":23,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":23,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"used_in_macro?(scope=@scope)-instance-method","html_id":"used_in_macro?(scope=@scope)-instance-method","name":"used_in_macro?","doc":"Returns true if current variable potentially referenced in a macro literal,\nfalse if not.","summary":"

Returns true if current variable potentially referenced in a macro literal, false if not.

","abstract":false,"args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":125,"url":null},"def":{"name":"used_in_macro?","args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.inner_scopes.each do |inner_scope|\n if (MacroLiteralFinder.new(inner_scope.node)).references?(node)\n return true\n end\nend\nif (outer_scope = scope.outer_scope) && (used_in_macro?(outer_scope))\n return true\nend\nfalse\n"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Config","path":"Ameba/Config.html","kind":"class","full_name":"Ameba::Config","name":"Config","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"AVAILABLE_FORMATTERS","name":"AVAILABLE_FORMATTERS","value":"{progress: Formatter::DotFormatter, todo: Formatter::TODOFormatter, flycheck: Formatter::FlycheckFormatter, silent: Formatter::BaseFormatter, disabled: Formatter::DisabledFormatter, json: Formatter::JSONFormatter}","doc":null,"summary":null},{"id":"DEFAULT_GLOBS","name":"DEFAULT_GLOBS","value":"[\"**/*.cr\", \"!lib\"] of ::String","doc":null,"summary":null},{"id":"PATH","name":"PATH","value":"\".ameba.yml\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A configuration entry for `Ameba::Runner`.\n\nConfig can be loaded from configuration YAML file and adjusted.\n\n```\nconfig = Config.load\nconfig.formatter = my_formatter\n```\n\nBy default config loads `.ameba.yml` file in a current directory.\n","summary":"

A configuration entry for Ameba::Runner.

","class_methods":[{"id":"formatter_names-class-method","html_id":"formatter_names-class-method","name":"formatter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/config.cr","line_number":86,"url":null},"def":{"name":"formatter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AVAILABLE_FORMATTERS.keys.join(\"|\")"}},{"id":"load(path=PATH,colors=true)-class-method","html_id":"load(path=PATH,colors=true)-class-method","name":"load","doc":"Loads YAML configuration file by `path`.\n\n```\nconfig = Ameba::Config.load\n```\n","summary":"

Loads YAML configuration file by path.

","abstract":false,"args":[{"name":"path","doc":null,"default_value":"PATH","external_name":"path","restriction":""},{"name":"colors","doc":null,"default_value":"true","external_name":"colors","restriction":""}],"args_string":"(path = PATH, colors = true)","args_html":"(path = PATH, colors = true)","location":{"filename":"src/ameba/config.cr","line_number":78,"url":null},"def":{"name":"load","args":[{"name":"path","doc":null,"default_value":"PATH","external_name":"path","restriction":""},{"name":"colors","doc":null,"default_value":"true","external_name":"colors","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n Colorize.enabled = colors\n content = File.exists?(path) ? File.read(path) : \"{}\"\n Config.new(YAML.parse(content))\nrescue e\n raise(\"Config file is invalid: #{e.message}\")\nend"}}],"constructors":[],"instance_methods":[{"id":"excluded:Array(String)-instance-method","html_id":"excluded:Array(String)-instance-method","name":"excluded","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/config.cr","line_number":56,"url":null},"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String))-instance-method","html_id":"excluded=(excluded:Array(String))-instance-method","name":"excluded=","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String)"}],"args_string":"(excluded : Array(String))","args_html":"(excluded : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":56,"url":null},"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"formatter-instance-method","html_id":"formatter-instance-method","name":"formatter","doc":"Returns a formatter to be used while inspecting files.\nIf formatter is not set, it will return default formatter.\n\n```\nconfig = Ameba::Config.load\nconfig.formatter = custom_formatter\nconfig.formatter\n```\n","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/config.cr","line_number":114,"url":null},"def":{"name":"formatter","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter || (@formatter = Formatter::DotFormatter.new)"}},{"id":"formatter=(formatter:Formatter::BaseFormatter?)-instance-method","html_id":"formatter=(formatter:Formatter::BaseFormatter?)-instance-method","name":"formatter=","doc":null,"summary":null,"abstract":false,"args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter | ::Nil"}],"args_string":"(formatter : Formatter::BaseFormatter?)","args_html":"(formatter : Formatter::BaseFormatter?)","location":{"filename":"src/ameba/config.cr","line_number":34,"url":null},"def":{"name":"formatter=","args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter = formatter"}},{"id":"formatter=(name:String|Symbol)-instance-method","html_id":"formatter=(name:String|Symbol)-instance-method","name":"formatter=","doc":"Sets formatter by name.\n\n```\nconfig = Ameba::Config.load\nconfig.formatter = :progress\n```\n","summary":"

Sets formatter by name.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String | Symbol"}],"args_string":"(name : String | Symbol)","args_html":"(name : String | Symbol)","location":{"filename":"src/ameba/config.cr","line_number":125,"url":null},"def":{"name":"formatter=","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String | Symbol"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if f = AVAILABLE_FORMATTERS[name]?\n @formatter = f.new\nelse\n raise(\"Unknown formatter `#{name}`. Use one of #{Config.formatter_names}.\")\nend"}},{"id":"globs:Array(String)-instance-method","html_id":"globs:Array(String)-instance-method","name":"globs","doc":"Returns a list of paths (with wildcards) to files.\nRepresents a list of sources to be inspected.\nIf globs are not set, it will return default list of files.\n\n```\nconfig = Ameba::Config.load\nconfig.globs = [\"**/*.cr\"]\nconfig.globs\n```","summary":"

Returns a list of paths (with wildcards) to files.

","abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/config.cr","line_number":47,"url":null},"def":{"name":"globs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@globs"}},{"id":"globs=(globs:Array(String))-instance-method","html_id":"globs=(globs:Array(String))-instance-method","name":"globs=","doc":"Returns a list of paths (with wildcards) to files.\nRepresents a list of sources to be inspected.\nIf globs are not set, it will return default list of files.\n\n```\nconfig = Ameba::Config.load\nconfig.globs = [\"**/*.cr\"]\nconfig.globs\n```","summary":"

Returns a list of paths (with wildcards) to files.

","abstract":false,"args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":"Array(String)"}],"args_string":"(globs : Array(String))","args_html":"(globs : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":47,"url":null},"def":{"name":"globs=","args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@globs = globs"}},{"id":"rules:Array(Rule::Base)-instance-method","html_id":"rules:Array(Rule::Base)-instance-method","name":"rules","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Rule::Base)","args_html":" : Array(Rule::Base)","location":{"filename":"src/ameba/config.cr","line_number":35,"url":null},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":{"filename":"src/ameba/config.cr","line_number":36,"url":null},"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":{"filename":"src/ameba/config.cr","line_number":36,"url":null},"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"sources-instance-method","html_id":"sources-instance-method","name":"sources","doc":"Returns a list of sources matching globs and excluded sections.\n\n```\nconfig = Ameba::Config.load\nconfig.sources # => list of default sources\nconfig.globs = [\"**/*.cr\"]\nconfig.excluded = [\"spec\"]\nconfig.sources # => list of sources pointing to files found by the wildcards\n```\n","summary":"

Returns a list of sources matching globs and excluded sections.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/config.cr","line_number":100,"url":null},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((find_files_by_globs(globs)) - (find_files_by_globs(excluded))).map do |path|\n Source.new(File.read(path), path)\nend"}},{"id":"update_rule(name,enabled=true,excluded=nil)-instance-method","html_id":"update_rule(name,enabled=true,excluded=nil)-instance-method","name":"update_rule","doc":"Updates rule properties.\n\n```\nconfig = Ameba::Config.load\nconfig.update_rule \"MyRuleName\", enabled: false\n```\n","summary":"

Updates rule properties.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"enabled","doc":null,"default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","doc":null,"default_value":"nil","external_name":"excluded","restriction":""}],"args_string":"(name, enabled = true, excluded = nil)","args_html":"(name, enabled = true, excluded = nil)","location":{"filename":"src/ameba/config.cr","line_number":140,"url":null},"def":{"name":"update_rule","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"enabled","doc":null,"default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","doc":null,"default_value":"nil","external_name":"excluded","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"index = @rules.index do |r|\n r.name == name\nend\nif index\nelse\n raise(ArgumentError.new(\"Rule `#{name}` does not exist\"))\nend\nrule = @rules[index]\nrule.enabled = enabled\nrule.excluded = excluded\n@rules[index] = rule\n"}},{"id":"update_rules(names,**args)-instance-method","html_id":"update_rules(names,**args)-instance-method","name":"update_rules","doc":"Updates rules properties.\n\n```\nconfig = Ameba::Config.load\nconfig.update_rules %w(Rule1 Rule2), enabled: true\n```\n\nalso it allows to update groups of rules:\n\n```\nconfig.update_rules %w(Group1 Group2), enabled: true\n```\n","summary":"

Updates rules properties.

","abstract":false,"args":[{"name":"names","doc":null,"default_value":"","external_name":"names","restriction":""}],"args_string":"(names, **args)","args_html":"(names, **args)","location":{"filename":"src/ameba/config.cr","line_number":163,"url":null},"def":{"name":"update_rules","args":[{"name":"names","doc":null,"default_value":"","external_name":"names","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"names.try(&.each do |name|\n if group = @rule_groups[name]?\n group.each do |rule|\n update_rule(rule.name, **args)\n end\n else\n update_rule(name, **args)\n end\nend)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter","path":"Ameba/Formatter.html","kind":"module","full_name":"Ameba::Formatter","name":"Formatter","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes Ameba's formatters.","summary":"

A module that utilizes Ameba's formatters.

","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","path":"Ameba/Formatter/BaseFormatter.html","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/Formatter/DisabledFormatter","kind":"class","full_name":"Ameba::Formatter::DisabledFormatter","name":"DisabledFormatter"},{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},{"html_id":"ameba/Ameba/Formatter/FlycheckFormatter","kind":"class","full_name":"Ameba::Formatter::FlycheckFormatter","name":"FlycheckFormatter"},{"html_id":"ameba/Ameba/Formatter/JSONFormatter","kind":"class","full_name":"Ameba::Formatter::JSONFormatter","name":"JSONFormatter"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A base formatter for all formatters. It uses `output` IO\nto report results and also implements stub methods for\ncallbacks in `Ameba::Runner#run` method.","summary":"

A base formatter for all formatters.

","class_methods":[],"constructors":[{"id":"new(output=STDOUT)-class-method","html_id":"new(output=STDOUT)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(output = STDOUT)","args_html":"(output = STDOUT)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":13,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"config:Hash(Symbol,Bool|String)-instance-method","html_id":"config:Hash(Symbol,Bool|String)-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Hash(Symbol, Bool | String)","args_html":" : Hash(Symbol, Bool | String)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":11,"url":null},"def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config"}},{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Callback that indicates when inspection is finished.\nA list of inspected sources is passed as an argument.","summary":"

Callback that indicates when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":30,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"output:IO::FileDescriptor|IO::Memory-instance-method","html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":"TODO: allow other IOs","summary":"

TODO allow other IOs

","abstract":false,"args":[],"args_string":" : IO::FileDescriptor | IO::Memory","args_html":" : IO::FileDescriptor | IO::Memory","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":10,"url":null},"def":{"name":"output","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}},{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":22,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"source_started(source:Source)-instance-method","html_id":"source_started(source:Source)-instance-method","name":"source_started","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":26,"url":null},"def":{"name":"source_started","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"started(sources)-instance-method","html_id":"started(sources)-instance-method","name":"started","doc":"Callback that indicates when inspecting is started.\nA list of sources to inspect is passed as an argument.","summary":"

Callback that indicates when inspecting is started.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":18,"url":null},"def":{"name":"started","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/DisabledFormatter","path":"Ameba/Formatter/DisabledFormatter.html","kind":"class","full_name":"Ameba::Formatter::DisabledFormatter","name":"DisabledFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that shows all disabled lines by inline directives.","summary":"

A formatter that shows all disabled lines by inline directives.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Callback that indicates when inspection is finished.\nA list of inspected sources is passed as an argument.","summary":"

Callback that indicates when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":4,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"output << \"Disabled rules using inline directives: \\n\\n\"\nsources.each do |source|\n source.issues.select(&.disabled?).each do |e|\n if loc = e.location\n output << (\"#{source.path}:#{loc.line_number}\".colorize(:cyan))\n output << \" #{e.rule.name}\\n\"\n end\n end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/DotFormatter","path":"Ameba/Formatter/DotFormatter.html","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"},{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/Formatter/TODOFormatter","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that shows a progress of inspection in a terminal using dots.\nIt is similar to Crystal's dot formatter for specs.","summary":"

A formatter that shows a progress of inspection in a terminal using dots.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Reports a message when inspection is finished.","summary":"

Reports a message when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":26,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"output.flush\noutput << \"\\n\\n\"\nshow_affected_code = !config[:without_affected_code]?\nfailed_sources = sources.reject(&.valid?)\nfailed_sources.each do |source|\n source.issues.each do |issue|\n if issue.disabled?\n next\n end\n if ( location = issue.location).nil?\n next\n end\n output << (\"#{location}\\n\".colorize(:cyan))\n output << (\"[#{issue.rule.severity.symbol}] #{issue.rule.name}: #{issue.message}\\n\".colorize(:red))\n if show_affected_code && (code = affected_code(source, location))\n output << (code.colorize(:default))\n end\n output << \"\\n\"\n end\nend\noutput << (finished_in_message(@started_at, Time.utc))\noutput << (final_message(sources, failed_sources))\n"}},{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Reports a result of the inspection of a corresponding source.","summary":"

Reports a result of the inspection of a corresponding source.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":20,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"sym = source.valid? ? \".\".colorize(:green) : \"F\".colorize(:red)\n@mutex.synchronize do\n output << sym\nend\n"}},{"id":"started(sources)-instance-method","html_id":"started(sources)-instance-method","name":"started","doc":"Reports a message when inspection is started.","summary":"

Reports a message when inspection is started.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":13,"url":null},"def":{"name":"started","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@started_at = Time.utc\noutput << (started_message(sources.size))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/ExplainFormatter","path":"Ameba/Formatter/ExplainFormatter.html","kind":"class","full_name":"Ameba::Formatter::ExplainFormatter","name":"ExplainFormatter","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"HEADING","name":"HEADING","value":"\"## \"","doc":null,"summary":null},{"id":"LINE_BREAK","name":"LINE_BREAK","value":"\"\\n\"","doc":null,"summary":null},{"id":"PREFIX","name":"PREFIX","value":"\" \"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that shows the detailed explanation of the issue at\na specific location.","summary":"

A formatter that shows the detailed explanation of the issue at a specific location.

","class_methods":[],"constructors":[{"id":"new(output,loc)-class-method","html_id":"new(output,loc)-class-method","name":"new","doc":"Creates a new instance of ExplainFormatter.\nAccepts *output* which indicates the io where the explanation will be wrtitten to.\nSecond argument is *location* which indicates the location to explain.\n\n```\nExplainFormatter.new output,\n {file: path, line: line_number, column: column_number}\n```\n","summary":"

Creates a new instance of ExplainFormatter.

","abstract":false,"args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""}],"args_string":"(output, loc)","args_html":"(output, loc)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":25,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output, loc)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Reports the explainations at the *@location*.","summary":"

Reports the explainations at the @location.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":30,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source = sources.find do |s|\n s.path == @location.filename\nend\nif source\nelse\n return\nend\nsource.issues.each do |issue|\n if ((location = issue.location) && (location.line_number == @location.line_number)) && (location.column_number == @location.column_number)\n explain(source, issue)\n end\nend\n"}},{"id":"location:Crystal::Location-instance-method","html_id":"location:Crystal::Location-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::Location","args_html":" : Crystal::Location","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":14,"url":null},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"id":"output:IO::FileDescriptor|IO::Memory-instance-method","html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : IO::FileDescriptor | IO::Memory","args_html":" : IO::FileDescriptor | IO::Memory","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":13,"url":null},"def":{"name":"output","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/FlycheckFormatter","path":"Ameba/Formatter/FlycheckFormatter.html","kind":"class","full_name":"Ameba::Formatter::FlycheckFormatter","name":"FlycheckFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":5,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.issues.each do |e|\n if e.disabled?\n next\n end\n if loc = e.location\n @mutex.synchronize do\n output.printf(\"%s:%d:%d: %s: [%s] %s\\n\", source.path, loc.line_number, loc.column_number, e.rule.severity.symbol, e.rule.name, e.message.gsub(\"\\n\", \" \"))\n end\n end\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/JSONFormatter","path":"Ameba/Formatter/JSONFormatter.html","kind":"class","full_name":"Ameba::Formatter::JSONFormatter","name":"JSONFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that produces the result in a json format.\n\nExample:\n\n```\n{\n \"metadata\": {\n \"ameba_version\": \"x.x.x\",\n \"crystal_version\": \"x.x.x\",\n },\n \"sources\": [\n {\n \"issues\": [\n {\n \"location\": {\n \"column\": 7,\n \"line\": 17,\n },\n \"end_location\": {\n \"column\": 20,\n \"line\": 17,\n },\n \"message\": \"Useless assignment to variable `a`\",\n \"rule_name\": \"UselessAssign\",\n \"severity\": \"Convention\",\n },\n {\n \"location\": {\n \"column\": 7,\n \"line\": 18,\n },\n \"end_location\": {\n \"column\": 8,\n \"line\": 18,\n },\n \"message\": \"Useless assignment to variable `a`\",\n \"rule_name\": \"UselessAssign\",\n },\n {\n \"location\": {\n \"column\": 7,\n \"line\": 19,\n },\n \"end_location\": {\n \"column\": 9,\n \"line\": 19,\n },\n \"message\": \"Useless assignment to variable `a`\",\n \"rule_name\": \"UselessAssign\",\n \"severity\": \"Convention\",\n },\n ],\n \"path\": \"src/ameba/formatter/json_formatter.cr\",\n },\n ],\n \"summary\": {\n \"issues_count\": 3,\n \"target_sources_count\": 1,\n },\n}\n```\n","summary":"

A formatter that produces the result in a json format.

","class_methods":[],"constructors":[{"id":"new(output=STDOUT)-class-method","html_id":"new(output=STDOUT)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(output = STDOUT)","args_html":"(output = STDOUT)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":67,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Callback that indicates when inspection is finished.\nA list of inspected sources is passed as an argument.","summary":"

Callback that indicates when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":87,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@result.to_json(@output)"}},{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":75,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"json_source = AsJSON::Source.new(source.path)\nsource.issues.each do |e|\n if e.disabled?\n next\n end\n json_source.issues << (AsJSON::Issue.new(e.rule.name, e.rule.severity.to_s, e.location, e.end_location, e.message))\n __temp_28 = @result.summary\n __temp_28.issues_count = __temp_28.issues_count + 1\nend\n@result.sources << json_source\n"}},{"id":"started(sources)-instance-method","html_id":"started(sources)-instance-method","name":"started","doc":"Callback that indicates when inspecting is started.\nA list of sources to inspect is passed as an argument.","summary":"

Callback that indicates when inspecting is started.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":71,"url":null},"def":{"name":"started","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@result.summary.target_sources_count = sources.size"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/TODOFormatter","path":"Ameba/Formatter/TODOFormatter.html","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"},{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that creates a todo config.\nBasically, it takes all issues reported and disables corresponding rules\nor excludes failed sources from these rules.","summary":"

A formatter that creates a todo config.

","class_methods":[],"constructors":[{"id":"new(output=STDOUT)-class-method","html_id":"new(output=STDOUT)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(output = STDOUT)","args_html":"(output = STDOUT)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":6,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Reports a message when inspection is finished.","summary":"

Reports a message when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":9,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"super(sources)\nissues = sources.map(&.issues).flatten\nif issues.any? do |issue|\n !issue.disabled?\nend\nelse\n @output << \"No issues found. File is not generated.\\n\"\n return\nend\nif issues.any? do |issue|\n issue.syntax?\nend\n @output << \"Unable to generate TODO file. Please fix syntax issues.\\n\"\n return\nend\nfile = generate_todo_config(issues)\n@output << \"Created #{file.path}\\n\"\nfile\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/Util","path":"Ameba/Formatter/Util.html","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},{"html_id":"ameba/Ameba/Formatter/ExplainFormatter","kind":"class","full_name":"Ameba::Formatter::ExplainFormatter","name":"ExplainFormatter"}],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"affected_code(source,location,max_length=100,placeholder="...",prompt=">")-instance-method","html_id":"affected_code(source,location,max_length=100,placeholder="...",prompt=">")-instance-method","name":"affected_code","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"max_length","doc":null,"default_value":"100","external_name":"max_length","restriction":""},{"name":"placeholder","doc":null,"default_value":"\" ...\"","external_name":"placeholder","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(source, location, max_length = 100, placeholder = " ...", prompt = "> ")","args_html":"(source, location, max_length = 100, placeholder = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":3,"url":null},"def":{"name":"affected_code","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"max_length","doc":null,"default_value":"100","external_name":"max_length","restriction":""},{"name":"placeholder","doc":null,"default_value":"\" ...\"","external_name":"placeholder","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"line, column = location.line_number, location.column_number\naffected_line = source.lines[line - 1]?\nif affected_line.nil? || affected_line.strip.empty?\n return\nend\nif affected_line.size > max_length && column < max_length\n affected_line = affected_line[0, (max_length - placeholder.size) - 1] + placeholder\nend\nstripped = affected_line.lstrip\nposition = (column - (affected_line.size - stripped.size)) + prompt.size\nString.build do |str|\n ((str << prompt) << stripped) << \"\\n\"\n str << (\" \" * (position - 1))\n str << (\"^\".colorize(:yellow))\nend\n"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/GlobUtils","path":"Ameba/GlobUtils.html","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Config","kind":"class","full_name":"Ameba::Config","name":"Config"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Helper module that is utilizes helpers for working with globs.","summary":"

Helper module that is utilizes helpers for working with globs.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"expand(globs)-instance-method","html_id":"expand(globs)-instance-method","name":"expand","doc":"Expands globs. Globs can point to files or even directories.\n\n```\nexpand([\"spec/*.cr\", \"src\"]) # => all files in src folder + first level specs\n```\n","summary":"

Expands globs.

","abstract":false,"args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":24,"url":null},"def":{"name":"expand","args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"globs.map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.flatten.uniq!"}},{"id":"find_files_by_globs(globs)-instance-method","html_id":"find_files_by_globs(globs)-instance-method","name":"find_files_by_globs","doc":"Returns all files that match specified globs.\nGlobs can have wildcards or be rejected:\n\n```\nfind_files_by_globs([\"**/*.cr\", \"!lib\"])\n```\n","summary":"

Returns all files that match specified globs.

","abstract":false,"args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":11,"url":null},"def":{"name":"find_files_by_globs","args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"rejected = rejected_globs(globs)\nselected = globs - rejected\n(expand(selected)) - (expand(rejected.map! do |p|\n p[1..-1]\nend))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/InlineComments","path":"Ameba/InlineComments.html","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"COMMENT_DIRECTIVE_REGEX","name":"COMMENT_DIRECTIVE_REGEX","value":"/# ameba:(?\\w+) (?\\w+(?:\\/\\w+)?(?:,? \\w+(?:\\/\\w+)?)*)/","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes inline comments parsing and processing logic.","summary":"

A module that utilizes inline comments parsing and processing logic.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"comment?(line_number:Int32)-instance-method","html_id":"comment?(line_number:Int32)-instance-method","name":"comment?","doc":"Returns true if the line at the given `line_number` is a comment.","summary":"

Returns true if the line at the given line_number is a comment.

","abstract":false,"args":[{"name":"line_number","doc":null,"default_value":"","external_name":"line_number","restriction":"Int32"}],"args_string":"(line_number : Int32)","args_html":"(line_number : Int32)","location":{"filename":"src/ameba/inline_comments.cr","line_number":80,"url":null},"def":{"name":"comment?","args":[{"name":"line_number","doc":null,"default_value":"","external_name":"line_number","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if line = lines[line_number]?\n comment?(line)\nend"}},{"id":"location_disabled?(location,rule)-instance-method","html_id":"location_disabled?(location,rule)-instance-method","name":"location_disabled?","doc":"Returns true if current location is disabled for a particular rule,\nfalse otherwise.\n\nLocation is disabled in two cases:\n 1. The line of the location ends with a comment directive.\n 2. The line above the location is a comment directive.\n\nFor example, here are two examples of disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\nTime.epoch(1483859302)\n\nTime.epoch(1483859302) # ameba:disable Style/LargeNumbers\n```\n\nBut here are examples which are not considered as disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\n#\nTime.epoch(1483859302)\n\nif use_epoch? # ameba:disable Style/LargeNumbers\n Time.epoch(1483859302)\nend\n```\n","summary":"

Returns true if current location is disabled for a particular rule, false otherwise.

","abstract":false,"args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""}],"args_string":"(location, rule)","args_html":"(location, rule)","location":{"filename":"src/ameba/inline_comments.cr","line_number":40,"url":null},"def":{"name":"location_disabled?","args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if Rule::SPECIAL.includes?(rule.name)\n return false\nend\nif line_number = location.try do |__arg0|\n __arg0.line_number.try(&.-(1))\nend\nelse\n return false\nend\nif line = lines[line_number]?\nelse\n return false\nend\n(line_disabled?(line, rule)) || (((line_number > 0 && (prev_line = lines[line_number - 1])) && (comment?(prev_line))) && (line_disabled?(prev_line, rule)))\n"}},{"id":"parse_inline_directive(line)-instance-method","html_id":"parse_inline_directive(line)-instance-method","name":"parse_inline_directive","doc":"Parses inline comment directive. Returns a tuple that consists of\nan action and parsed rules if directive found, nil otherwise.\n\n```\nline = \"# ameba:disable Rule1, Rule2\"\ndirective = parse_inline_directive(line)\ndirective[:action] # => \"disable\"\ndirective[:rules] # => [\"Rule1\", \"Rule2\"]\n```\n\nIt ignores the directive if it is commented out.\n\n```\nline = \"# # ameba:disable Rule1, Rule2\"\nparse_inline_directive(line) # => nil\n```\n","summary":"

Parses inline comment directive.

","abstract":false,"args":[{"name":"line","doc":null,"default_value":"","external_name":"line","restriction":""}],"args_string":"(line)","args_html":"(line)","location":{"filename":"src/ameba/inline_comments.cr","line_number":69,"url":null},"def":{"name":"parse_inline_directive","args":[{"name":"line","doc":null,"default_value":"","external_name":"line","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if directive = COMMENT_DIRECTIVE_REGEX.match(line)\n if commented_out?(line.gsub(directive[0], \"\"))\n return\n end\n {action: directive[\"action\"], rules: directive[\"rules\"].split(/[\\s,]/, remove_empty: true)}\nend"}}],"macros":[],"types":[{"html_id":"ameba/Ameba/InlineComments/Action","path":"Ameba/InlineComments/Action.html","kind":"enum","full_name":"Ameba::InlineComments::Action","name":"Action","abstract":false,"superclass":null,"ancestors":[{"html_id":"ameba/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"ameba/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Disable","name":"Disable","value":"0","doc":null,"summary":null},{"id":"Enable","name":"Enable","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},"doc":"Available actions in the inline comments","summary":"

Available actions in the inline comments

","class_methods":[],"constructors":[],"instance_methods":[{"id":"disable?-instance-method","html_id":"disable?-instance-method","name":"disable?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/inline_comments.cr","line_number":8,"url":null},"def":{"name":"disable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disable"}},{"id":"enable?-instance-method","html_id":"enable?-instance-method","name":"enable?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/inline_comments.cr","line_number":9,"url":null},"def":{"name":"enable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Enable"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Issue","path":"Ameba/Issue.html","kind":"struct","full_name":"Ameba::Issue","name":"Issue","abstract":false,"superclass":{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents an issue reported by Ameba.","summary":"

Represents an issue reported by Ameba.

","class_methods":[],"constructors":[{"id":"new(rule:Rule::Base,location:Crystal::Location?,end_location:Crystal::Location?,message:String,status:Symbol?)-class-method","html_id":"new(rule:Rule::Base,location:Crystal::Location?,end_location:Crystal::Location?,message:String,status:Symbol?)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":"Rule::Base"},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"},{"name":"status","doc":null,"default_value":"","external_name":"status","restriction":"Symbol | ::Nil"}],"args_string":"(rule : Rule::Base, location : Crystal::Location?, end_location : Crystal::Location?, message : String, status : Symbol?)","args_html":"(rule : Rule::Base, location : Crystal::Location?, end_location : Crystal::Location?, message : String, status : Symbol?)","location":{"filename":"src/ameba/issue.cr","line_number":3,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":"Rule::Base"},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"},{"name":"status","doc":null,"default_value":"","external_name":"status","restriction":"Symbol | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, location, end_location, message, status)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"clone-instance-method","html_id":"clone-instance-method","name":"clone","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":3,"url":null},"def":{"name":"clone","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(@rule.clone, @location.clone, @end_location.clone, @message.clone, @status.clone)"}},{"id":"copy_with(rule_rule=@rule,location_location=@location,end_location_end_location=@end_location,message_message=@message,status_status=@status)-instance-method","html_id":"copy_with(rule_rule=@rule,location_location=@location,end_location_end_location=@end_location,message_message=@message,status_status=@status)-instance-method","name":"copy_with","doc":null,"summary":null,"abstract":false,"args":[{"name":"_rule","doc":null,"default_value":"@rule","external_name":"rule","restriction":""},{"name":"_location","doc":null,"default_value":"@location","external_name":"location","restriction":""},{"name":"_end_location","doc":null,"default_value":"@end_location","external_name":"end_location","restriction":""},{"name":"_message","doc":null,"default_value":"@message","external_name":"message","restriction":""},{"name":"_status","doc":null,"default_value":"@status","external_name":"status","restriction":""}],"args_string":"(rule _rule = @rule, location _location = @location, end_location _end_location = @end_location, message _message = @message, status _status = @status)","args_html":"(rule _rule = @rule, location _location = @location, end_location _end_location = @end_location, message _message = @message, status _status = @status)","location":{"filename":"src/ameba/issue.cr","line_number":3,"url":null},"def":{"name":"copy_with","args":[{"name":"_rule","doc":null,"default_value":"@rule","external_name":"rule","restriction":""},{"name":"_location","doc":null,"default_value":"@location","external_name":"location","restriction":""},{"name":"_end_location","doc":null,"default_value":"@end_location","external_name":"end_location","restriction":""},{"name":"_message","doc":null,"default_value":"@message","external_name":"message","restriction":""},{"name":"_status","doc":null,"default_value":"@status","external_name":"status","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(_rule, _location, _end_location, _message, _status)"}},{"id":"disabled?-instance-method","html_id":"disabled?-instance-method","name":"disabled?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":18,"url":null},"def":{"name":"disabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"status == (:disabled)"}},{"id":"end_location:Crystal::Location?-instance-method","html_id":"end_location:Crystal::Location?-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":null,"def":{"name":"end_location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@end_location"}},{"id":"location:Crystal::Location?-instance-method","html_id":"location:Crystal::Location?-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":null,"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@location"}},{"id":"message:String-instance-method","html_id":"message:String-instance-method","name":"message","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"id":"rule:Rule::Base-instance-method","html_id":"rule:Rule::Base-instance-method","name":"rule","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":null,"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"id":"status:Symbol?-instance-method","html_id":"status:Symbol?-instance-method","name":"status","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Symbol?","args_html":" : Symbol?","location":null,"def":{"name":"status","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Symbol | ::Nil","visibility":"Public","body":"@status"}},{"id":"syntax?-instance-method","html_id":"syntax?-instance-method","name":"syntax?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":22,"url":null},"def":{"name":"syntax?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"rule.is_a?(Rule::Lint::Syntax)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Reportable","path":"Ameba/Reportable.html","kind":"module","full_name":"Ameba::Reportable","name":"Reportable","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a module used to report issues.","summary":"

Represents a module used to report issues.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,**args)-instance-method","html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for *location* and *end_location* defined by line and column numbers.","summary":"

Adds a new issue for location and end_location defined by line and column numbers.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, **args)","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":30,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nend_location = Crystal::Location.new(path, *end_location)\nadd_issue(rule, location, end_location, message, **args)\n"}},{"id":"add_issue(rule,location,end_location,message,status=nil)-instance-method","html_id":"add_issue(rule,location,end_location,message,status=nil)-instance-method","name":"add_issue","doc":"Adds a new issue to the list of issues.","summary":"

Adds a new issue to the list of issues.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":""}],"args_string":"(rule, location, end_location, message, status = nil)","args_html":"(rule, location, end_location, message, status = nil)","location":{"filename":"src/ameba/reportable.cr","line_number":8,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = :disabled)\nend\nissues << (Issue.new(rule, location, end_location, message, status))\n"}},{"id":"add_issue(rule,location:Tuple(Int32,Int32),message,**args)-instance-method","html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for *location* defined by line and column numbers.","summary":"

Adds a new issue for location defined by line and column numbers.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, location : Tuple(Int32, Int32), message, **args)","args_html":"(rule, location : Tuple(Int32, Int32), message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":24,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, **args)\n"}},{"id":"add_issue(rule,node:Crystal::ASTNode,message,**args)-instance-method","html_id":"add_issue(rule,node:Crystal::ASTNode,message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for AST *node*.","summary":"

Adds a new issue for AST node.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, **args)","args_html":"(rule, node : Crystal::ASTNode, message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":14,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"add_issue(rule, node.location, node.end_location, message, **args)"}},{"id":"add_issue(rule,token:Crystal::Token,message,**args)-instance-method","html_id":"add_issue(rule,token:Crystal::Token,message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for Crystal *token*.","summary":"

Adds a new issue for Crystal token.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"Crystal::Token"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, token : Crystal::Token, message, **args)","args_html":"(rule, token : Crystal::Token, message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":19,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"Crystal::Token"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"add_issue(rule, token.location, nil, message, **args)"}},{"id":"issues-instance-method","html_id":"issues-instance-method","name":"issues","doc":"List of reported issues.","summary":"

List of reported issues.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/reportable.cr","line_number":5,"url":null},"def":{"name":"issues","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@issues"}},{"id":"valid?-instance-method","html_id":"valid?-instance-method","name":"valid?","doc":"Returns true if the list of not disabled issues is empty, false otherwise.","summary":"

Returns true if the list of not disabled issues is empty, false otherwise.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/reportable.cr","line_number":37,"url":null},"def":{"name":"valid?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"issues.reject(&.disabled?).empty?"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule","path":"Ameba/Rule.html","kind":"module","full_name":"Ameba::Rule","name":"Rule","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"SPECIAL","name":"SPECIAL","value":"[Lint::Syntax.rule_name, Lint::UnneededDisableDirective.rule_name]","doc":"List of names of the special rules, which\nbehave differently than usual rules.","summary":"

List of names of the special rules, which behave differently than usual rules.

"}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":null,"summary":null,"class_methods":[{"id":"rules-class-method","html_id":"rules-class-method","name":"rules","doc":"Returns a list of all available rules.\n\n```\nAmeba::Rule.rules # => [Rule1, Rule2, ....]\n```\n","summary":"

Returns a list of all available rules.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":194,"url":null},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Base.subclasses"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Base","path":"Ameba/Rule/Base.html","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base","abstract":true,"superclass":{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"}],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/Rule/Layout/LineLength","kind":"struct","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace"},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","kind":"struct","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"struct","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","kind":"struct","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"struct","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","kind":"struct","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays"},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","kind":"struct","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar"},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","kind":"struct","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber"},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","kind":"struct","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax"},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","kind":"struct","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"struct","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","kind":"struct","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","kind":"struct","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign"},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","kind":"struct","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen"},{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","kind":"struct","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity"},{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"struct","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"struct","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"struct","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"},{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","kind":"struct","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Style/IsANil","kind":"struct","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil"},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","kind":"struct","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers"},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","kind":"struct","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","kind":"struct","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","kind":"struct","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"struct","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","kind":"struct","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext"},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","kind":"struct","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn"},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","kind":"struct","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","kind":"struct","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","kind":"struct","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","kind":"struct","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":"Represents a base of all rules. In other words, all rules\ninherits from this struct:\n\n```\nstruct MyRule < Ameba::Rule::Base\n def test(source)\n if invalid?(source)\n issue_for line, column, \"Something wrong.\"\n end\n end\n\n private def invalid?(source)\n # ...\n end\nend\n```\n\nEnforces rules to implement an abstract `#test` method which\nis designed to test the source passed in. If source has issues\nthat are tested by this rule, it should add an issue.\n","summary":"

Represents a base of all rules.

","class_methods":[{"id":"parsed_doc-class-method","html_id":"parsed_doc-class-method","name":"parsed_doc","doc":"Returns documentation for this rule if any.\n\n```\nmodule Ameba\n # This is a test rule.\n # Does nothing.\n struct MyRule < Ameba::Rule::Base\n def test(source)\n end\n end\nend\n\nMyRule.parsed_doc # => \"This is a test rule.\\nDoes nothing.\"\n```","summary":"

Returns documentation for this rule if any.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":157,"url":null},"def":{"name":"parsed_doc","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source = File.read(path_to_source_file)\nnodes = (Crystal::Parser.new(source)).tap(&.wants_doc = true).parse\ntype_name = (rule_name.split(\"/\")).last?\n(DocFinder.new(nodes, type_name)).doc\n"}}],"constructors":[{"id":"new-class-method","html_id":"new-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":30,"url":null},"def":{"name":"new","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"x = allocate\nif x.responds_to?(:finalize)\n ::GC.add_finalizer(x)\nend\nx\n"}}],"instance_methods":[{"id":"==(other)-instance-method","html_id":"==(other)-instance-method","name":"==","doc":"Returns `true` if this struct is equal to *other*.\n\nBoth structs' instance vars are compared to each other. Thus, two\nstructs are considered equal if each of their instance variables are\nequal. Subclasses should override this method to provide specific\nequality semantics.\n\n```\nstruct Point\n def initialize(@x : Int32, @y : Int32)\n end\nend\n\np1 = Point.new 1, 2\np2 = Point.new 1, 2\np3 = Point.new 3, 4\n\np1 == p2 # => true\np1 == p3 # => false\n```","summary":"

Returns true if this struct is equal to other.

","abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/rule/base.cr","line_number":113,"url":null},"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name == other.try(&.name)"}},{"id":"catch(source:Source)-instance-method","html_id":"catch(source:Source)-instance-method","name":"catch","doc":"A convenient addition to `#test` method that does the same\nbut returns a passed in `source` as an addition.\n\n```\nsource = MyRule.new.catch(source)\nsource.valid?\n```\n","summary":"

A convenient addition to #test method that does the same but returns a passed in source as an addition.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":54,"url":null},"def":{"name":"catch","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.tap do |s|\n test(s)\nend"}},{"id":"excluded?(source)-instance-method","html_id":"excluded?(source)-instance-method","name":"excluded?","doc":"Checks whether the source is excluded from this rule.\nIt searches for a path in `excluded` property which matches\nthe one of the given source.\n\n```\nmy_rule.excluded?(source) # => true or false\n```\n","summary":"

Checks whether the source is excluded from this rule.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/base.cr","line_number":95,"url":null},"def":{"name":"excluded?","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"excluded.try(&.any? do |path|\n (source.matches_path?(path)) || (Dir.glob(path)).any? do |glob|\n source.matches_path?(glob)\n end\nend)"}},{"id":"group-instance-method","html_id":"group-instance-method","name":"group","doc":"Returns a group this rule belong to.\n\n```\nstruct MyGroup::MyRule < Ameba::Rule::Base\n # ...\nend\n\nMyGroup::MyRule.new.group # => \"MyGroup\"\n```\n","summary":"

Returns a group this rule belong to.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":83,"url":null},"def":{"name":"group","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).group_name"}},{"id":"hash-instance-method","html_id":"hash-instance-method","name":"hash","doc":"Generates an `UInt64` hash value for this object.\n\nThis method must have the property that `a == b` implies `a.hash == b.hash`.\n\nThe hash value is used along with `==` by the `Hash` class to determine if two objects\nreference the same hash key.\n\nSubclasses must not override this method. Instead, they must define `hash(hasher)`,\nthough usually the macro `def_hash` can be used to generate this method.","summary":"

Generates an UInt64 hash value for this object.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":117,"url":null},"def":{"name":"hash","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.hash"}},{"id":"name-instance-method","html_id":"name-instance-method","name":"name","doc":"Returns a name of this rule, which is basically a class name.\n\n```\nstruct MyRule < Ameba::Rule::Base\n def test(source)\n end\nend\n\nMyRule.new.name # => \"MyRule\"\n```\n","summary":"

Returns a name of this rule, which is basically a class name.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":69,"url":null},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).rule_name"}},{"id":"special?-instance-method","html_id":"special?-instance-method","name":"special?","doc":"Returns true if this rule is special and behaves differently than\nusual rules.\n\n```\nmy_rule.special? # => true or false\n```\n","summary":"

Returns true if this rule is special and behaves differently than usual rules.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":109,"url":null},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"SPECIAL.includes?(name)"}},{"id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","html_id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","doc":null,"default_value":"","external_name":"opts","restriction":""}],"args_string":"(source : Source, node : Crystal::ASTNode, *opts)","args_html":"(source : Source, node : Crystal::ASTNode, *opts)","location":{"filename":"src/ameba/rule/base.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","doc":null,"default_value":"","external_name":"opts","restriction":""}],"double_splat":null,"splat_index":2,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"test(source:Source)-instance-method","html_id":"test(source:Source)-instance-method","name":"test","doc":"This method is designed to test the source passed in. If source has issues\nthat are tested by this rule, it should add an issue.\n\nBe default it uses a node visitor to traverse all the nodes in the source.\nMust be overriten for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":38,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::NodeVisitor.new(self, source)"}}],"macros":[{"id":"issue_for(*args)-macro","html_id":"issue_for(*args)-macro","name":"issue_for","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","location":{"filename":"src/ameba/rule/base.cr","line_number":121,"url":null},"def":{"name":"issue_for","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"block_arg":null,"visibility":"Public","body":" source.add_issue self, \n{{ *args }}\n\n \n"}}],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout","path":"Ameba/Rule/Layout.html","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Layout/LineLength","path":"Ameba/Rule/Layout/LineLength.html","kind":"struct","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Line too long\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```\n","summary":"

A rule that disallows lines longer than #max_length number of symbols.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```\n","summary":"

A rule that disallows lines longer than #max_length number of symbols.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":12,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"max_length:Int32-instance-method","html_id":"max_length:Int32-instance-method","name":"max_length","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","args_html":" : Int32","location":null,"def":{"name":"max_length","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@max_length"}},{"id":"max_length=(max_length:Int32)-instance-method","html_id":"max_length=(max_length:Int32)-instance-method","name":"max_length=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_length","doc":null,"default_value":"","external_name":"max_length","restriction":"Int32"}],"args_string":"(max_length : Int32)","args_html":"(max_length : Int32)","location":null,"def":{"name":"max_length=","args":[{"name":"max_length","doc":null,"default_value":"","external_name":"max_length","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_length = max_length"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":21,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line.size > max_length\n else\n next\n end\n issue_for({index + 1, max_length + 1}, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","path":"Ameba/Rule/Layout/TrailingBlankLines.html","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Excessive trailing newline detected\"","doc":null,"summary":null},{"id":"MSG_FINAL_NEWLINE","name":"MSG_FINAL_NEWLINE","value":"\"Trailing newline missing\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing blank lines at the end of the source file.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing blank lines at the end of the source file.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":11,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":19,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source_lines = source.lines\nif source_lines.empty?\n return\nend\nlast_source_line = source_lines.last\nsource_lines_size = source_lines.size\nif (source_lines_size == 1) && last_source_line.empty?\n return\nend\nlast_line_not_empty = !last_source_line.empty?\nif source_lines_size >= 1 && ((source_lines.last(2)).join.strip.empty? || last_line_not_empty)\n issue_for({source_lines_size - 1, 1}, last_line_not_empty ? MSG_FINAL_NEWLINE : MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","path":"Ameba/Rule/Layout/TrailingWhitespace.html","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Trailing whitespace detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing whitespaces.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing whitespaces.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing whitespaces.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing whitespaces.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":11,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":18,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line =~ (/\\s$/)\n else\n next\n end\n issue_for({index + 1, line.size}, MSG)\nend"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Lint","path":"Ameba/Rule/Lint.html","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","path":"Ameba/Rule/Lint/BadDirective.html","kind":"struct","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"ALL_GROUP_NAMES","name":"ALL_GROUP_NAMES","value":"Rule.rules.map(&.group_name).uniq!","doc":null,"summary":null},{"id":"ALL_RULE_NAMES","name":"ALL_RULE_NAMES","value":"Rule.rules.map(&.rule_name)","doc":null,"summary":null},{"id":"AVAILABLE_ACTIONS","name":"AVAILABLE_ACTIONS","value":"InlineComments::Action.names.map(&.downcase)","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports incorrect comment directives for Ameba.\n\nFor example, the user can mistakenly add a directive\nto disable a rule that even doesn't exist:\n\n```\n# ameba:disable BadRuleName\ndef foo\n :bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/BadDirective:\n Enabled: true\n```\n","summary":"

A rule that reports incorrect comment directives for Ameba.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports incorrect comment directives for Ameba.\n\nFor example, the user can mistakenly add a directive\nto disable a rule that even doesn't exist:\n\n```\n# ameba:disable BadRuleName\ndef foo\n :bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/BadDirective:\n Enabled: true\n```\n","summary":"

A rule that reports incorrect comment directives for Ameba.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":21,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":30,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type == (:COMMENT)\n else\n next\n end\n if directive = source.parse_inline_directive(token.value.to_s)\n else\n next\n end\n check_action(source, token, directive[:action])\n check_rules(source, token, directive[:rules])\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","path":"Ameba/Rule/Lint/ComparisonToBoolean.html","kind":"struct","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison to a boolean is pointless\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows comparison to booleans.\n\nFor example, these are considered invalid:\n\n```\nfoo == true\nbar != false\nfalse === baz\n```\n\nThis is because these expressions evaluate to `true` or `false`, so you\ncould get the same result by using either the variable directly,\nor negating the variable.\n\nYAML configuration example:\n\n```\nLint/ComparisonToBoolean:\n Enabled: true\n```\n","summary":"

A rule that disallows comparison to booleans.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows comparison to booleans.\n\nFor example, these are considered invalid:\n\n```\nfoo == true\nbar != false\nfalse === baz\n```\n\nThis is because these expressions evaluate to `true` or `false`, so you\ncould get the same result by using either the variable directly,\nor negating the variable.\n\nYAML configuration example:\n\n```\nLint/ComparisonToBoolean:\n Enabled: true\n```\n","summary":"

A rule that disallows comparison to booleans.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":31,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"comparison = ([\"==\", \"!=\", \"===\"] of ::String).includes?(node.name)\nto_boolean = node.args.first?.try do |__arg0|\n __arg0.is_a?(Crystal::BoolLiteral)\nend || node.obj.is_a?(Crystal::BoolLiteral)\nif comparison && to_boolean\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","path":"Ameba/Rule/Lint/DebuggerStatement.html","kind":"struct","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possible forgotten debugger statement detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows calls to debugger.\n\nThis is because we don't want debugger breakpoints accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebuggerStatement:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to debugger.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows calls to debugger.\n\nThis is because we don't want debugger breakpoints accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebuggerStatement:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to debugger.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":14,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":21,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if ((node.name == \"debugger\") && node.args.empty?) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","path":"Ameba/Rule/Lint/EmptyEnsure.html","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty `ensure` block detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows empty ensure statement.\n\nFor example, this is considered invalid:\n\n```\ndef some_method\n do_some_stuff\nensure\nend\n\nbegin\n do_some_stuff\nensure\nend\n```\n\nAnd it should be written as this:\n\n\n```\ndef some_method\n do_some_stuff\nensure\n do_something_else\nend\n\nbegin\n do_some_stuff\nensure\n do_something_else\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyEnsure\n Enabled: true\n```\n","summary":"

A rule that disallows empty ensure statement.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows empty ensure statement.\n\nFor example, this is considered invalid:\n\n```\ndef some_method\n do_some_stuff\nensure\nend\n\nbegin\n do_some_stuff\nensure\nend\n```\n\nAnd it should be written as this:\n\n\n```\ndef some_method\n do_some_stuff\nensure\n do_something_else\nend\n\nbegin\n do_some_stuff\nensure\n do_something_else\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyEnsure\n Enabled: true\n```\n","summary":"

A rule that disallows empty ensure statement.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":42,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ExceptionHandler)-instance-method","html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":49,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node_ensure = node.ensure\nif node_ensure.nil? || (!node_ensure.nop?)\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","path":"Ameba/Rule/Lint/EmptyExpression.html","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid empty expression %s\"","doc":null,"summary":null},{"id":"MSG_EXRS","name":"MSG_EXRS","value":"\"Avoid empty expressions\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows empty expressions.\n\nThis is considered invalid:\n\n```\nfoo = ()\n\nif ()\n bar\nend\n```\n\nAnd this is valid:\n\n```\nfoo = (some_expression)\n\nif (some_expression)\n bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyExpression:\n Enabled: true\n```\n","summary":"

A rule that disallows empty expressions.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows empty expressions.\n\nThis is considered invalid:\n\n```\nfoo = ()\n\nif ()\n bar\nend\n```\n\nAnd this is valid:\n\n```\nfoo = (some_expression)\n\nif (some_expression)\n bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyExpression:\n Enabled: true\n```\n","summary":"

A rule that disallows empty expressions.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::NilLiteral)-instance-method","html_id":"test(source,node:Crystal::NilLiteral)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(source, node : Crystal::NilLiteral)","args_html":"(source, node : Crystal::NilLiteral)","location":{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"exp = (node_source(node, source.lines)).try(&.join)\nif exp.nil? || (exp == \"nil\")\n return\nend\nissue_for(node, MSG % exp)\n"}},{"id":"test(source,node:Crystal::Expressions)-instance-method","html_id":"test(source,node:Crystal::Expressions)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(source, node : Crystal::Expressions)","args_html":"(source, node : Crystal::Expressions)","location":{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":50,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (node.expressions.size == 1) && node.expressions.first.nop?\n issue_for(node, MSG_EXRS)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","path":"Ameba/Rule/Lint/EmptyLoop.html","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty loop detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows empty loops.\n\nThis is considered invalid:\n\n```\nwhile false\nend\n\nuntil 10\nend\n\nloop do\n # nothing here\nend\n```\n\nAnd this is valid:\n\n```\na = 1\nwhile a < 10\n a += 1\nend\n\nuntil socket_opened?\nend\n\nloop do\n do_something_here\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyLoop:\n Enabled: true\n```","summary":"

A rule that disallows empty loops.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows empty loops.\n\nThis is considered invalid:\n\n```\nwhile false\nend\n\nuntil 10\nend\n\nloop do\n # nothing here\nend\n```\n\nAnd this is valid:\n\n```\na = 1\nwhile a < 10\n a += 1\nend\n\nuntil socket_opened?\nend\n\nloop do\n do_something_here\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyLoop:\n Enabled: true\n```","summary":"

A rule that disallows empty loops.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":40,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":49,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if loop?(node)\nelse\n return\nend\ncheck_node(source, node, node.block)\n"}},{"id":"test(source,node:Crystal::While)-instance-method","html_id":"test(source,node:Crystal::While)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":55,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}},{"id":"test(source,node:Crystal::Until)-instance-method","html_id":"test(source,node:Crystal::Until)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(source, node : Crystal::Until)","args_html":"(source, node : Crystal::Until)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":59,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","path":"Ameba/Rule/Lint/HashDuplicatedKey.html","kind":"struct","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated keys in hash literal: %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows duplicated keys in hash literals.\n\nThis is considered invalid:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2, \"foo\" => 3}\n```\n\nAnd it has to written as this instead:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2}\n```\n\nYAML configuration example:\n\n```\nLint/HashDuplicatedKey:\n Enabled: true\n```\n","summary":"

A rule that disallows duplicated keys in hash literals.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows duplicated keys in hash literals.\n\nThis is considered invalid:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2, \"foo\" => 3}\n```\n\nAnd it has to written as this instead:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2}\n```\n\nYAML configuration example:\n\n```\nLint/HashDuplicatedKey:\n Enabled: true\n```\n","summary":"

A rule that disallows duplicated keys in hash literals.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::HashLiteral)-instance-method","html_id":"test(source,node:Crystal::HashLiteral)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(source, node : Crystal::HashLiteral)","args_html":"(source, node : Crystal::HashLiteral)","location":{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":30,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (keys = duplicated_keys(node.entries)).any?\nelse\n return\nend\nissue_for(node, MSG % (keys.join(\", \")))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","path":"Ameba/Rule/Lint/LiteralInCondition.html","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in conditional\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless conditional statements that contain a literal\nin place of a variable or predicate function.\n\nThis is because a conditional construct with a literal predicate will\nalways result in the same behaviour at run time, meaning it can be\nreplaced with either the body of the construct, or deleted entirely.\n\nThis is considered invalid:\n```\nif \"something\"\n :ok\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInCondition:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless conditional statements that contain a literal\nin place of a variable or predicate function.\n\nThis is because a conditional construct with a literal predicate will\nalways result in the same behaviour at run time, meaning it can be\nreplaced with either the body of the construct, or deleted entirely.\n\nThis is considered invalid:\n```\nif \"something\"\n :ok\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInCondition:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"check_node(source,node)-instance-method","html_id":"check_node(source,node)-instance-method","name":"check_node","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(source, node)","args_html":"(source, node)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":33,"url":null},"def":{"name":"check_node","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if literal?(node.cond)\nelse\n return\nend\nissue_for(node, MSG)\n"}},{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::If)-instance-method","html_id":"test(source,node:Crystal::If)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"args_string":"(source, node : Crystal::If)","args_html":"(source, node : Crystal::If)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":38,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::Unless)-instance-method","html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::Case)-instance-method","html_id":"test(source,node:Crystal::Case)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(source, node : Crystal::Case)","args_html":"(source, node : Crystal::Case)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","path":"Ameba/Rule/Lint/LiteralInInterpolation.html","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in interpolation\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless string interpolations\nthat contain a literal value instead of a variable or function.\n\nFor example:\n\n```\n\"Hello, #{:Ary}\"\n\"There are #{4} cats\"\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInInterpolation\n Enabled: true\n```\n","summary":"

A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless string interpolations\nthat contain a literal value instead of a variable or function.\n\nFor example:\n\n```\n\"Hello, #{:Ary}\"\n\"There are #{4} cats\"\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInInterpolation\n Enabled: true\n```\n","summary":"

A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":19,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::StringInterpolation)-instance-method","html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(source, node : Crystal::StringInterpolation)","args_html":"(source, node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":28,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.expressions.select do |e|\n (!e.is_a?(Crystal::StringLiteral)) && (literal?(e))\nend.each do |n|\n issue_for(n, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","path":"Ameba/Rule/Lint/PercentArrays.html","kind":"struct","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Symbols `%s` may be unwanted in %s array literals\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows some unwanted symbols in percent array literals.\n\nFor example, this is usually written by mistake:\n\n```\n%i(:one, :two)\n%w(\"one\", \"two\")\n```\n\nAnd the expected example is:\n\n```\n%i(one two)\n%w(one two)\n```\n\nYAML configuration example:\n\n```\nLint/PercentArrays:\n Enabled: true\n StringArrayUnwantedSymbols: ',\"'\n SymbolArrayUnwantedSymbols: ',:'\n```\n","summary":"

A rule that disallows some unwanted symbols in percent array literals.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows some unwanted symbols in percent array literals.\n\nFor example, this is usually written by mistake:\n\n```\n%i(:one, :two)\n%w(\"one\", \"two\")\n```\n\nAnd the expected example is:\n\n```\n%i(one two)\n%w(one two)\n```\n\nYAML configuration example:\n\n```\nLint/PercentArrays:\n Enabled: true\n StringArrayUnwantedSymbols: ',\"'\n SymbolArrayUnwantedSymbols: ',:'\n```\n","summary":"

A rule that disallows some unwanted symbols in percent array literals.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":27,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"string_array_unwanted_symbols:String-instance-method","html_id":"string_array_unwanted_symbols:String-instance-method","name":"string_array_unwanted_symbols","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"string_array_unwanted_symbols","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@string_array_unwanted_symbols"}},{"id":"string_array_unwanted_symbols=(string_array_unwanted_symbols:String)-instance-method","html_id":"string_array_unwanted_symbols=(string_array_unwanted_symbols:String)-instance-method","name":"string_array_unwanted_symbols=","doc":null,"summary":null,"abstract":false,"args":[{"name":"string_array_unwanted_symbols","doc":null,"default_value":"","external_name":"string_array_unwanted_symbols","restriction":"String"}],"args_string":"(string_array_unwanted_symbols : String)","args_html":"(string_array_unwanted_symbols : String)","location":null,"def":{"name":"string_array_unwanted_symbols=","args":[{"name":"string_array_unwanted_symbols","doc":null,"default_value":"","external_name":"string_array_unwanted_symbols","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@string_array_unwanted_symbols = string_array_unwanted_symbols"}},{"id":"symbol_array_unwanted_symbols:String-instance-method","html_id":"symbol_array_unwanted_symbols:String-instance-method","name":"symbol_array_unwanted_symbols","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"symbol_array_unwanted_symbols","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@symbol_array_unwanted_symbols"}},{"id":"symbol_array_unwanted_symbols=(symbol_array_unwanted_symbols:String)-instance-method","html_id":"symbol_array_unwanted_symbols=(symbol_array_unwanted_symbols:String)-instance-method","name":"symbol_array_unwanted_symbols=","doc":null,"summary":null,"abstract":false,"args":[{"name":"symbol_array_unwanted_symbols","doc":null,"default_value":"","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"args_string":"(symbol_array_unwanted_symbols : String)","args_html":"(symbol_array_unwanted_symbols : String)","location":null,"def":{"name":"symbol_array_unwanted_symbols=","args":[{"name":"symbol_array_unwanted_symbols","doc":null,"default_value":"","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@symbol_array_unwanted_symbols = symbol_array_unwanted_symbols"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"issue = start_token = nil\n(Tokenizer.new(source)).run do |token|\n case token.type\n when :STRING_ARRAY_START, :SYMBOL_ARRAY_START\n start_token = token.dup\n when :STRING\n if start_token && issue.nil?\n issue = array_entry_invalid?(token.value, start_token.not_nil!.raw)\n end\n when :STRING_ARRAY_END, :SYMBOL_ARRAY_END\n if issue\n issue_for(start_token.not_nil!, issue.not_nil!)\n end\n issue = start_token = nil\n else\n end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","path":"Ameba/Rule/Lint/RandZero.html","kind":"struct","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"%s always returns 0\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```\n","summary":"

A rule that disallows rand(0) and rand(1) calls.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```\n","summary":"

A rule that disallows rand(0) and rand(1) calls.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":26,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":33,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (((((node.name == \"rand\") && (node.args.size == 1)) && (arg = node.args.first)) && (arg.is_a?(Crystal::NumberLiteral))) && (value = arg.value)) && ((value == \"0\") || (value == \"1\"))\nelse\n return\nend\nissue_for(node, MSG % node)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","path":"Ameba/Rule/Lint/RedundantStringCoercion.html","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant use of `Object#to_s` in interpolation\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoersion\n Enabled: true\n```\n","summary":"

A rule that disallows string conversion in string interpolation, which is redundant.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoersion\n Enabled: true\n```\n","summary":"

A rule that disallows string conversion in string interpolation, which is redundant.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":24,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::StringInterpolation)-instance-method","html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(source, node : Crystal::StringInterpolation)","args_html":"(source, node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":33,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(string_coercion_nodes(node)).each do |n|\n issue_for(n.name_location, n.end_location, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","path":"Ameba/Rule/Lint/RedundantWithIndex.html","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n```\ncollection.each.with_index do |e|\n # ...\nend\n\ncollection.each_with_index do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithIndex:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant with_index calls.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n```\ncollection.each.with_index do |e|\n # ...\nend\n\ncollection.each_with_index do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithIndex:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant with_index calls.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":30,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":35,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"args, block = node.args, node.block\nif (args.size > 1 || block.nil?) || (with_index_arg?(block.not_nil!))\n return\nend\ncase node.name\nwhen \"with_index\"\n report(source, node, \"Remove redundant with_index\")\nwhen \"each_with_index\"\n report(source, node, \"Use each instead of each_with_index\")\nelse\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","path":"Ameba/Rule/Lint/RedundantWithObject.html","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant each_with_object calls.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant each_with_object calls.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (((node.name != \"each_with_object\") || (node.args.size != 1)) || node.block.nil?) || (with_index_arg?(node.block.not_nil!))\n return\nend\nissue_for(node.name_location, node.name_end_location, \"Use each instead of each_with_object\")\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","path":"Ameba/Rule/Lint/ShadowedArgument.html","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Argument `%s` is assigned before it is used\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```\n","summary":"

A rule that disallows shadowed arguments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```\n","summary":"

A rule that disallows shadowed arguments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":39,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,scope:AST::Scope)-instance-method","html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node, scope : AST::Scope)","args_html":"(source, node, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":50,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.arguments.each do |arg|\n if assign = arg.variable.assign_before_reference\n else\n next\n end\n issue_for(assign, MSG % arg.name)\nend"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","path":"Ameba/Rule/Lint/ShadowedException.html","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Exception handler has shadowed exceptions: %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows a rescued exception that get shadowed by a\nless specific exception being rescued before a more specific\nexception is rescued.\n\nFor example, this is invalid:\n\n```\nbegin\n do_something\nrescue Exception\n handle_exception\nrescue ArgumentError\n handle_argument_error_exception\nend\n```\n\nAnd it has to be written as follows:\n\n```\nbegin\n do_something\nrescue ArgumentError\n handle_argument_error_exception\nrescue Exception\n handle_exception\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedException:\n Enabled: true\n```\n","summary":"

A rule that disallows a rescued exception that get shadowed by a less specific exception being rescued before a more specific exception is rescued.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows a rescued exception that get shadowed by a\nless specific exception being rescued before a more specific\nexception is rescued.\n\nFor example, this is invalid:\n\n```\nbegin\n do_something\nrescue Exception\n handle_exception\nrescue ArgumentError\n handle_argument_error_exception\nend\n```\n\nAnd it has to be written as follows:\n\n```\nbegin\n do_something\nrescue ArgumentError\n handle_argument_error_exception\nrescue Exception\n handle_exception\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedException:\n Enabled: true\n```\n","summary":"

A rule that disallows a rescued exception that get shadowed by a less specific exception being rescued before a more specific exception is rescued.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":37,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ExceptionHandler)-instance-method","html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":44,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if excs = node.rescues\nelse\n return\nend\nif (excs = shadowed(excs.map(&.types))).any?\n issue_for(node, MSG % (excs.join(\", \")))\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","path":"Ameba/Rule/Lint/ShadowingOuterLocalVar.html","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowing outer local variable `%s`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows the usage of the same name as outer local variables\nfor block or proc arguments.\n\nFor example, this is considered incorrect:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |foo| # shadowing outer `foo`\n end\nend\n```\n\nand should be written as:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |bar|\n end\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowingOuterLocalVar:\n Enabled: true\n```\n","summary":"

A rule that disallows the usage of the same name as outer local variables for block or proc arguments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the usage of the same name as outer local variables\nfor block or proc arguments.\n\nFor example, this is considered incorrect:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |foo| # shadowing outer `foo`\n end\nend\n```\n\nand should be written as:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |bar|\n end\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowingOuterLocalVar:\n Enabled: true\n```\n","summary":"

A rule that disallows the usage of the same name as outer local variables for block or proc arguments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":34,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"find_shadowing(source, scope)"}},{"id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":50,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"find_shadowing(source, scope)"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","path":"Ameba/Rule/Lint/SharedVarInFiber.html","kind":"struct","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shared variable `%s` is used in fiber\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows using shared variables in fibers,\nwhich are mutated during iterations.\n\nIn most cases it leads to unexpected behaviour and is undesired.\n\nFor example, having this example:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n spawn { channel.send n }\nend\n\n3.times { puts channel.receive } # => # 3, 3, 3\n```\n\nThe problem is there is only one shared between fibers variable `n`\nand when `channel.receive` is executed its value is `3`.\n\nTo solve this, the code above needs to be rewritten to the following:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n m = n\n spawn do { channel.send m }\nend\n\n3.times { puts channel.receive } # => # 1, 2, 3\n```\n\nThis rule is able to find the shared variables between fibers, which are mutated\nduring iterations. So it reports the issue on the first sample and passes on\nthe second one.\n\nThere are also other technics to solve the problem above which are\n[officially documented](https://crystal-lang.org/reference/guides/concurrency.html)\n\nYAML configuration example:\n\n```\nLint/SharedVarInFiber:\n Enabled: true\n```\n","summary":"

A rule that disallows using shared variables in fibers, which are mutated during iterations.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows using shared variables in fibers,\nwhich are mutated during iterations.\n\nIn most cases it leads to unexpected behaviour and is undesired.\n\nFor example, having this example:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n spawn { channel.send n }\nend\n\n3.times { puts channel.receive } # => # 3, 3, 3\n```\n\nThe problem is there is only one shared between fibers variable `n`\nand when `channel.receive` is executed its value is `3`.\n\nTo solve this, the code above needs to be rewritten to the following:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n m = n\n spawn do { channel.send m }\nend\n\n3.times { puts channel.receive } # => # 1, 2, 3\n```\n\nThis rule is able to find the shared variables between fibers, which are mutated\nduring iterations. So it reports the issue on the first sample and passes on\nthe second one.\n\nThere are also other technics to solve the problem above which are\n[officially documented](https://crystal-lang.org/reference/guides/concurrency.html)\n\nYAML configuration example:\n\n```\nLint/SharedVarInFiber:\n Enabled: true\n```\n","summary":"

A rule that disallows using shared variables in fibers, which are mutated during iterations.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":53,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,scope:AST::Scope)-instance-method","html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node, scope : AST::Scope)","args_html":"(source, node, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":64,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if scope.spawn_block?\nelse\n return\nend\nscope.references.each do |ref|\n if ( variable = scope.find_variable(ref.name)).nil?\n next\n end\n if (variable.scope == scope) || (!(mutated_in_loop?(variable)))\n next\n end\n issue_for(ref.node, MSG % variable.name)\nend\n"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":60,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","path":"Ameba/Rule/Lint/Syntax.html","kind":"struct","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports invalid Crystal syntax.\n\nFor example, this syntax is invalid:\n\n```\ndef hello\n do_something\nrescue Exception => e\nend\n```\n\nAnd should be properly written:\n\n```\ndef hello\n do_something\nrescue e : Exception\nend\n```\n","summary":"

A rule that reports invalid Crystal syntax.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports invalid Crystal syntax.\n\nFor example, this syntax is invalid:\n\n```\ndef hello\n do_something\nrescue Exception => e\nend\n```\n\nAnd should be properly written:\n\n```\ndef hello\n do_something\nrescue e : Exception\nend\n```\n","summary":"

A rule that reports invalid Crystal syntax.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/syntax.cr","line_number":22,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Ameba::Severity","visibility":"Public","body":"@severity"}},{"id":"severity=(severity:Ameba::Severity)-instance-method","html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":"Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":"Ameba::Severity"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/syntax.cr","line_number":28,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n source.ast\nrescue e : Crystal::SyntaxException\n issue_for({e.line_number, e.column_number}, e.message.to_s)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","path":"Ameba/Rule/Lint/UnneededDisableDirective.html","kind":"struct","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unnecessary disabling of %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unneeded disable directives.\nFor example, this is considered invalid:\n\n```\n# ameba:disable Style/PredicateName\ndef comment?\n do_something\nend\n```\n\nas the predicate name is correct and the comment directive does not\nhave any effect, the snippet should be written as the following:\n\n```\ndef comment?\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnneededDisableDirective\n Enabled: true\n```\n","summary":"

A rule that reports unneeded disable directives.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unneeded disable directives.\nFor example, this is considered invalid:\n\n```\n# ameba:disable Style/PredicateName\ndef comment?\n do_something\nend\n```\n\nas the predicate name is correct and the comment directive does not\nhave any effect, the snippet should be written as the following:\n\n```\ndef comment?\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnneededDisableDirective\n Enabled: true\n```\n","summary":"

A rule that reports unneeded disable directives.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":35,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type == (:COMMENT)\n else\n next\n end\n if directive = source.parse_inline_directive(token.value.to_s)\n else\n next\n end\n if names = unneeded_disables(source, directive, token.location)\n else\n next\n end\n if names.any?\n else\n next\n end\n issue_for(token, MSG % (names.join(\", \")))\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","path":"Ameba/Rule/Lint/UnreachableCode.html","kind":"struct","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unreachable code detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unreachable code.\n\nFor example, this is considered invalid:\n\n```\ndef method(a)\n return 42\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break\n a += 1\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method(a)\n return 42 if a == 0\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break a > 3\n a += 1\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnreachableCode:\n Enabled: true\n```\n","summary":"

A rule that reports unreachable code.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unreachable code.\n\nFor example, this is considered invalid:\n\n```\ndef method(a)\n return 42\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break\n a += 1\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method(a)\n return 42 if a == 0\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break a > 3\n a += 1\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnreachableCode:\n Enabled: true\n```\n","summary":"

A rule that reports unreachable code.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":45,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","html_id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"flow_expression","doc":null,"default_value":"","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"args_string":"(source, node, flow_expression : AST::FlowExpression)","args_html":"(source, node, flow_expression : AST::FlowExpression)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":58,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"flow_expression","doc":null,"default_value":"","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if unreachable_node = flow_expression.unreachable_nodes.first?\n issue_for(unreachable_node, MSG)\nend"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":54,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::FlowExpressionVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","path":"Ameba/Rule/Lint/UnusedArgument.html","kind":"struct","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unused argument `%s`. If it's necessary, use `%s` as an argument name to indicate that it won't be used.\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unused arguments.\nFor example, this is considered invalid:\n\n```\ndef method(a, b, c)\n a + b\nend\n```\nand should be written as:\n\n```\ndef method(a, b)\n a + b\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedArgument:\n Enabled: true\n IgnoreDefs: true\n IgnoreBlocks: false\n IgnoreProcs: false\n```\n","summary":"

A rule that reports unused arguments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unused arguments.\nFor example, this is considered invalid:\n\n```\ndef method(a, b, c)\n a + b\nend\n```\nand should be written as:\n\n```\ndef method(a, b)\n a + b\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedArgument:\n Enabled: true\n IgnoreDefs: true\n IgnoreBlocks: false\n IgnoreProcs: false\n```\n","summary":"

A rule that reports unused arguments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"ignore_blocks:Bool-instance-method","html_id":"ignore_blocks:Bool-instance-method","name":"ignore_blocks","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"ignore_blocks","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@ignore_blocks"}},{"id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","html_id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","name":"ignore_blocks=","doc":null,"summary":null,"abstract":false,"args":[{"name":"ignore_blocks","doc":null,"default_value":"","external_name":"ignore_blocks","restriction":"Bool"}],"args_string":"(ignore_blocks : Bool)","args_html":"(ignore_blocks : Bool)","location":null,"def":{"name":"ignore_blocks=","args":[{"name":"ignore_blocks","doc":null,"default_value":"","external_name":"ignore_blocks","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ignore_blocks = ignore_blocks"}},{"id":"ignore_defs:Bool-instance-method","html_id":"ignore_defs:Bool-instance-method","name":"ignore_defs","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"ignore_defs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"id":"ignore_defs=(ignore_defs:Bool)-instance-method","html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","doc":null,"summary":null,"abstract":false,"args":[{"name":"ignore_defs","doc":null,"default_value":"","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","location":null,"def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","doc":null,"default_value":"","external_name":"ignore_defs","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"id":"ignore_procs:Bool-instance-method","html_id":"ignore_procs:Bool-instance-method","name":"ignore_procs","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"ignore_procs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@ignore_procs"}},{"id":"ignore_procs=(ignore_procs:Bool)-instance-method","html_id":"ignore_procs=(ignore_procs:Bool)-instance-method","name":"ignore_procs=","doc":null,"summary":null,"abstract":false,"args":[{"name":"ignore_procs","doc":null,"default_value":"","external_name":"ignore_procs","restriction":"Bool"}],"args_string":"(ignore_procs : Bool)","args_html":"(ignore_procs : Bool)","location":null,"def":{"name":"ignore_procs=","args":[{"name":"ignore_procs","doc":null,"default_value":"","external_name":"ignore_procs","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ignore_procs = ignore_procs"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":44,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ignore_procs || (find_unused_arguments(source, scope))"}},{"id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":48,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ignore_blocks || (find_unused_arguments(source, scope))"}},{"id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Def, scope : AST::Scope)","args_html":"(source, node : Crystal::Def, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":52,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ignore_defs || (find_unused_arguments(source, scope))"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":40,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","path":"Ameba/Rule/Lint/UselessAssign.html","kind":"struct","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless assignment to variable `%s`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless assignments.\n\nFor example, this is considered invalid:\n\n```\ndef method\n var = 1\n do_something\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method\n var = 1\n do_something(var)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessAssign:\n Enabled: true\n```\n","summary":"

A rule that disallows useless assignments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless assignments.\n\nFor example, this is considered invalid:\n\n```\ndef method\n var = 1\n do_something\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method\n var = 1\n do_something(var)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessAssign:\n Enabled: true\n```\n","summary":"

A rule that disallows useless assignments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":29,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,scope:AST::Scope)-instance-method","html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node, scope : AST::Scope)","args_html":"(source, node, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":40,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.variables.each do |var|\n if (var.captured_by_block? || var.used_in_macro?) || var.ignored?\n next\n end\n var.assignments.each do |assign|\n if assign.referenced? || assign.transformed?\n next\n end\n issue_for(assign.target_node, MSG % var.name)\n end\nend"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","path":"Ameba/Rule/Lint/UselessConditionInWhen.html","kind":"struct","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless condition in when detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless conditions in when clause\nwhere it is guaranteed to always return the same result.\n\nFor example, this is considered invalid:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io) if local?\nend\n```\n\nAnd has to be written as the following:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessConditionInWhen:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless conditions in when clause\nwhere it is guaranteed to always return the same result.\n\nFor example, this is considered invalid:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io) if local?\nend\n```\n\nAnd has to be written as the following:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessConditionInWhen:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":34,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::When)-instance-method","html_id":"test(source,node:Crystal::When)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"args_string":"(source, node : Crystal::When)","args_html":"(source, node : Crystal::When)","location":{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":54,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ConditionInWhenVisitor.new(self, source, node)"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Metrics","path":"Ameba/Rule/Metrics.html","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","path":"Ameba/Rule/Metrics/CyclomaticComplexity.html","kind":"struct","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Cyclomatic complexity too high [%d/%d]\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Metrics","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics"},"doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```\n","summary":"

A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```\n","summary":"

A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":12,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"max_complexity:Int32-instance-method","html_id":"max_complexity:Int32-instance-method","name":"max_complexity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","args_html":" : Int32","location":null,"def":{"name":"max_complexity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@max_complexity"}},{"id":"max_complexity=(max_complexity:Int32)-instance-method","html_id":"max_complexity=(max_complexity:Int32)-instance-method","name":"max_complexity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_complexity","doc":null,"default_value":"","external_name":"max_complexity","restriction":"Int32"}],"args_string":"(max_complexity : Int32)","args_html":"(max_complexity : Int32)","location":null,"def":{"name":"max_complexity=","args":[{"name":"max_complexity","doc":null,"default_value":"","external_name":"max_complexity","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_complexity = max_complexity"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":20,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"complexity = (AST::CountingVisitor.new(node)).count\nif complexity > max_complexity && (location = node.name_location)\n issue_for(location, def_name_end_location(node), MSG % {complexity, max_complexity})\nend\n"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Performance","path":"Ameba/Rule/Performance.html","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","path":"Ameba/Rule/Performance/AnyAfterFilter.html","kind":"struct","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"ANY_NAME","name":"ANY_NAME","value":"\"any?\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `#{ANY_NAME} {...}` instead of `%s {...}.#{ANY_NAME}`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of any? calls that follow filters.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of any? calls that follow filters.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"filter_names:Array(String)-instance-method","html_id":"filter_names:Array(String)-instance-method","name":"filter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"filter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@filter_names"}},{"id":"filter_names=(filter_names:Array(String))-instance-method","html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","location":null,"def":{"name":"filter_names=","args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@filter_names = filter_names"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":37,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (node.name == ANY_NAME) && (obj = node.obj)\nelse\n return\nend\nif ((node.block.nil? && obj.is_a?(Crystal::Call)) && (filter_names.includes?(obj.name))) && (!obj.block.nil?)\n issue_for(obj.name_location, node.name_end_location, MSG % obj.name)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","path":"Ameba/Rule/Performance/FirstLastAfterFilter.html","kind":"struct","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"first\", \"last\", \"first?\", \"last?\"] of ::String","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `find {...}` instead of `%s {...}.%s`\"","doc":null,"summary":null},{"id":"MSG_REVERSE","name":"MSG_REVERSE","value":"\"Use `reverse_each.find {...}` instead of `%s {...}.%s`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```\n","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```\n","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":27,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"filter_names:Array(String)-instance-method","html_id":"filter_names:Array(String)-instance-method","name":"filter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"filter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@filter_names"}},{"id":"filter_names=(filter_names:Array(String))-instance-method","html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","location":null,"def":{"name":"filter_names=","args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@filter_names = filter_names"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (CALL_NAMES.includes?(node.name)) && (obj = node.obj)\nelse\n return\nend\nif node.args.any?\n return\nend\nif ((node.block.nil? && obj.is_a?(Crystal::Call)) && (filter_names.includes?(obj.name))) && (!obj.block.nil?)\n message = node.name.includes?(CALL_NAMES.first) ? MSG : MSG_REVERSE\n issue_for(obj.name_location, node.name_end_location, message % {obj.name, node.name})\nend\n"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":37,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor])"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","path":"Ameba/Rule/Performance/SizeAfterFilter.html","kind":"struct","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `count {...}` instead of `%s {...}.#{SIZE_NAME}`.\"","doc":null,"summary":null},{"id":"SIZE_NAME","name":"SIZE_NAME","value":"\"size\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of size calls that follow filter.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":34,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"filter_names:Array(String)-instance-method","html_id":"filter_names:Array(String)-instance-method","name":"filter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"filter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@filter_names"}},{"id":"filter_names=(filter_names:Array(String))-instance-method","html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","location":null,"def":{"name":"filter_names=","args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@filter_names = filter_names"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":52,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (node.name == SIZE_NAME) && (obj = node.obj)\nelse\n return\nend\nif (obj.is_a?(Crystal::Call) && (filter_names.includes?(obj.name))) && (!obj.block.nil?)\n issue_for(obj.name_location, node.name_end_location, MSG % obj.name)\nend\n"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":43,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor])"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Style","path":"Ameba/Rule/Style.html","kind":"module","full_name":"Ameba::Rule::Style","name":"Style","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","path":"Ameba/Rule/Style/ConstantNames.html","kind":"struct","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Constant name should be screaming-cased: %s, not %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces constant names to be in screaming case.\n\nFor example, these constant names are considered valid:\n\n```\nLUCKY_NUMBERS = [3, 7, 11]\nDOCUMENTATION_URL = \"http://crystal-lang.org/docs\"\n```\n\nAnd these are invalid names:\n\n```\nmyBadConstant = 1\nWrong_NAME = 2\n```\n\nYAML configuration example:\n\n```\nStyle/ConstantNames:\n Enabled: true\n```\n","summary":"

A rule that enforces constant names to be in screaming case.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces constant names to be in screaming case.\n\nFor example, these constant names are considered valid:\n\n```\nLUCKY_NUMBERS = [3, 7, 11]\nDOCUMENTATION_URL = \"http://crystal-lang.org/docs\"\n```\n\nAnd these are invalid names:\n\n```\nmyBadConstant = 1\nWrong_NAME = 2\n```\n\nYAML configuration example:\n\n```\nStyle/ConstantNames:\n Enabled: true\n```\n","summary":"

A rule that enforces constant names to be in screaming case.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/constant_names.cr","line_number":25,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Assign)-instance-method","html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/style/constant_names.cr","line_number":32,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\n name = target.names.first\n expected = name.upcase\n if (expected == name) || (name.camelcase == name)\n return\n end\n issue_for(target, MSG % {expected, name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/IsANil","path":"Ameba/Rule/Style/IsANil.html","kind":"struct","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `nil?` instead of `is_a?(Nil)`\"","doc":null,"summary":null},{"id":"PATH_NIL_NAMES","name":"PATH_NIL_NAMES","value":"[\"Nil\"] of ::String","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a? Nil\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a? Nil\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::IsA)-instance-method","html_id":"test(source,node:Crystal::IsA)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(source, node : Crystal::IsA)","args_html":"(source, node : Crystal::IsA)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":31,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.nil_check?\n return\nend\nconst = node.const\nif const.is_a?(Crystal::Path) && (const.names == PATH_NIL_NAMES)\n issue_for(const, MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","path":"Ameba/Rule/Style/LargeNumbers.html","kind":"struct","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Large numbers should be written with underscores: %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n10000\n141592654\n5.12345\n```\n\nAnd has to be rewritten as the following:\n\n```\n10_000\n141_592_654\n5.123_45\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 5 # i.e. integers higher than 9999\n```\n","summary":"

A rule that disallows usage of large numbers without underscore.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n10000\n141592654\n5.12345\n```\n\nAnd has to be rewritten as the following:\n\n```\n10_000\n141_592_654\n5.123_45\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 5 # i.e. integers higher than 9999\n```\n","summary":"

A rule that disallows usage of large numbers without underscore.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":30,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"int_min_digits:Int32-instance-method","html_id":"int_min_digits:Int32-instance-method","name":"int_min_digits","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","args_html":" : Int32","location":null,"def":{"name":"int_min_digits","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@int_min_digits"}},{"id":"int_min_digits=(int_min_digits:Int32)-instance-method","html_id":"int_min_digits=(int_min_digits:Int32)-instance-method","name":"int_min_digits=","doc":null,"summary":null,"abstract":false,"args":[{"name":"int_min_digits","doc":null,"default_value":"","external_name":"int_min_digits","restriction":"Int32"}],"args_string":"(int_min_digits : Int32)","args_html":"(int_min_digits : Int32)","location":null,"def":{"name":"int_min_digits=","args":[{"name":"int_min_digits","doc":null,"default_value":"","external_name":"int_min_digits","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@int_min_digits = int_min_digits"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":39,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if (token.type == (:NUMBER)) && (decimal?(token.raw))\n else\n next\n end\n parsed = parse_number(token.raw)\n if (allowed?(*parsed)) && ((expected = underscored(*parsed)) != token.raw)\n issue_for(token, MSG % expected)\n end\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","path":"Ameba/Rule/Style/MethodNames.html","kind":"struct","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Method name should be underscore-cased: %s, not %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces method names to be in underscored case.\n\nFor example, these are considered valid:\n\n```\nclass Person\n def first_name\n end\n\n def date_of_birth\n end\n\n def homepage_url\n end\nend\n```\n\nAnd these are invalid method names:\n\n```\nclass Person\n def firstName\n end\n\n def date_of_Birth\n end\n\n def homepageURL\n end\nend\n```\n\nYAML configuration example:\n\n```\nStyle/MethodNames:\n Enabled: true\n```\n","summary":"

A rule that enforces method names to be in underscored case.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces method names to be in underscored case.\n\nFor example, these are considered valid:\n\n```\nclass Person\n def first_name\n end\n\n def date_of_birth\n end\n\n def homepage_url\n end\nend\n```\n\nAnd these are invalid method names:\n\n```\nclass Person\n def firstName\n end\n\n def date_of_Birth\n end\n\n def homepageURL\n end\nend\n```\n\nYAML configuration example:\n\n```\nStyle/MethodNames:\n Enabled: true\n```\n","summary":"

A rule that enforces method names to be in underscored case.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/method_names.cr","line_number":41,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/method_names.cr","line_number":48,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (expected = node.name.underscore) == node.name\n return\nend\nline_number = node.location.try(&.line_number)\ncolumn_number = node.name_location.try(&.column_number)\nif line_number.nil? || column_number.nil?\n return\nend\nissue_for({line_number, column_number}, {line_number, (column_number + node.name.size) - 1}, MSG % {expected, node.name})\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","path":"Ameba/Rule/Style/NegatedConditionsInUnless.html","kind":"struct","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid negated conditions in unless blocks\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows negated conditions in unless.\n\nFor example, this is considered invalid:\n\n```\nunless !s.empty?\n :ok\nend\n```\n\nAnd should be rewritten to the following:\n\n```\nif s.emtpy?\n :ok\nend\n```\n\nIt is pretty difficult to wrap your head around a block of code\nthat is executed if a negated condition is NOT met.\n\nYAML configuration example:\n\n```\nStyle/NegatedConditionsInUnless:\n Enabled: true\n```\n","summary":"

A rule that disallows negated conditions in unless.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows negated conditions in unless.\n\nFor example, this is considered invalid:\n\n```\nunless !s.empty?\n :ok\nend\n```\n\nAnd should be rewritten to the following:\n\n```\nif s.emtpy?\n :ok\nend\n```\n\nIt is pretty difficult to wrap your head around a block of code\nthat is executed if a negated condition is NOT met.\n\nYAML configuration example:\n\n```\nStyle/NegatedConditionsInUnless:\n Enabled: true\n```\n","summary":"

A rule that disallows negated conditions in unless.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":30,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Unless)-instance-method","html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":37,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if negated_condition?(node.cond)\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","path":"Ameba/Rule/Style/PredicateName.html","kind":"struct","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s?' over '%s'\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows tautological predicate names, meaning those that\nstart with the prefix `has_` or the prefix `is_`. Ignores if the alternative isn't valid Crystal code (e.g. `is_404?`).\n\nFavour these:\n\n```\ndef valid?(x)\nend\n\ndef picture?(x)\nend\n```\n\nOver these:\n\n```\ndef is_valid?(x)\nend\n\ndef has_picture?(x)\nend\n```\n\nYAML configuration example:\n\n```\nStyle/PredicateName:\n Enabled: true\n```\n","summary":"

A rule that disallows tautological predicate names, meaning those that start with the prefix has_ or the prefix is_.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows tautological predicate names, meaning those that\nstart with the prefix `has_` or the prefix `is_`. Ignores if the alternative isn't valid Crystal code (e.g. `is_404?`).\n\nFavour these:\n\n```\ndef valid?(x)\nend\n\ndef picture?(x)\nend\n```\n\nOver these:\n\n```\ndef is_valid?(x)\nend\n\ndef has_picture?(x)\nend\n```\n\nYAML configuration example:\n\n```\nStyle/PredicateName:\n Enabled: true\n```\n","summary":"

A rule that disallows tautological predicate names, meaning those that start with the prefix has_ or the prefix is_.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":32,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":40,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.name =~ (/^(is|has)_(\\w+)\\?/)\n alternative = $~[2]\n if alternative =~ (/^[a-z][a-zA-Z_0-9]*$/)\n else\n return\n end\n issue_for(node, MSG % {alternative, node.name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","path":"Ameba/Rule/Style/RedundantBegin.html","kind":"struct","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `begin` block detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant begin blocks.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant begin blocks.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":59,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":67,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if redundant_begin?(source, node)\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","path":"Ameba/Rule/Style/RedundantNext.html","kind":"struct","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `next` detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant next expressions. A `next` keyword allows\na block to skip to the next iteration early, however, it is considered\nredundant in cases where it is the last expression in a block or combines\ninto the node which is the last in a block.\n\nFor example, this is considered invalid:\n\n```\nblock do |v|\n next v + 1\nend\n```\n\n```\nblock do |v|\n case v\n when .nil?\n next \"nil\"\n when .blank?\n next \"blank\"\n else\n next \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\nblock do |v|\n v + 1\nend\n```\n\n```\nblock do |v|\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwhich yield tuple literals i.e.\n\n```\nblock do\n next a, b\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n {a, b}\nend\n```\n\n2. *allow_empty_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwithout arguments. Sometimes such statements are used to yild the `nil` value explicitly.\n\n```\nblock do\n @foo = :empty\n next\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantNext:\n Enabled: true\n AllowMultiNext: true\n AllowEmptyNext: true\n```","summary":"

A rule that disallows redundant next expressions.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant next expressions. A `next` keyword allows\na block to skip to the next iteration early, however, it is considered\nredundant in cases where it is the last expression in a block or combines\ninto the node which is the last in a block.\n\nFor example, this is considered invalid:\n\n```\nblock do |v|\n next v + 1\nend\n```\n\n```\nblock do |v|\n case v\n when .nil?\n next \"nil\"\n when .blank?\n next \"blank\"\n else\n next \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\nblock do |v|\n v + 1\nend\n```\n\n```\nblock do |v|\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwhich yield tuple literals i.e.\n\n```\nblock do\n next a, b\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n {a, b}\nend\n```\n\n2. *allow_empty_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwithout arguments. Sometimes such statements are used to yild the `nil` value explicitly.\n\n```\nblock do\n @foo = :empty\n next\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantNext:\n Enabled: true\n AllowMultiNext: true\n AllowEmptyNext: true\n```","summary":"

A rule that disallows redundant next expressions.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":99,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"allow_empty_next:Bool-instance-method","html_id":"allow_empty_next:Bool-instance-method","name":"allow_empty_next","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_empty_next","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_empty_next"}},{"id":"allow_empty_next=(allow_empty_next:Bool)-instance-method","html_id":"allow_empty_next=(allow_empty_next:Bool)-instance-method","name":"allow_empty_next=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_empty_next","doc":null,"default_value":"","external_name":"allow_empty_next","restriction":"Bool"}],"args_string":"(allow_empty_next : Bool)","args_html":"(allow_empty_next : Bool)","location":null,"def":{"name":"allow_empty_next=","args":[{"name":"allow_empty_next","doc":null,"default_value":"","external_name":"allow_empty_next","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_empty_next = allow_empty_next"}},{"id":"allow_multi_next:Bool-instance-method","html_id":"allow_multi_next:Bool-instance-method","name":"allow_multi_next","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_multi_next","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_multi_next"}},{"id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","html_id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","name":"allow_multi_next=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_multi_next","doc":null,"default_value":"","external_name":"allow_multi_next","restriction":"Bool"}],"args_string":"(allow_multi_next : Bool)","args_html":"(allow_multi_next : Bool)","location":null,"def":{"name":"allow_multi_next=","args":[{"name":"allow_multi_next","doc":null,"default_value":"","external_name":"allow_multi_next","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_multi_next = allow_multi_next"}},{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","html_id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"args_string":"(source, node : Crystal::Next, visitor : AST::RedundantControlExpressionVisitor)","args_html":"(source, node : Crystal::Next, visitor : AST::RedundantControlExpressionVisitor)","location":{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":112,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if allow_multi_next && node.exp.is_a?(Crystal::TupleLiteral)\n return\nend\nif allow_empty_next && (node.exp.nil? || node.exp.not_nil!.nop?)\n return\nend\nsource.try(&.add_issue(self, node, MSG))\n"}},{"id":"test(source,node:Crystal::Block)-instance-method","html_id":"test(source,node:Crystal::Block)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(source, node : Crystal::Block)","args_html":"(source, node : Crystal::Block)","location":{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":108,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","path":"Ameba/Rule/Style/RedundantReturn.html","kind":"struct","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `return` detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant return expressions.\n\nFor example, this is considered invalid:\n\n```\ndef foo\n return :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n return \"nil\"\n when .blank?\n return \"blank\"\n else\n return \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef foo\n :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwhich return tuple literals i.e.\n\n```\ndef method(a, b)\n return a, b\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method(a, b)\n {a, b}\nend\n```\n\n2. *allow_empty_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwithout arguments. Sometimes such returns are used to return the `nil` value explicitly.\n\n```\ndef method\n @foo = :empty\n return\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantReturn:\n Enabled: true\n AllowMutliReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant return expressions.\n\nFor example, this is considered invalid:\n\n```\ndef foo\n return :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n return \"nil\"\n when .blank?\n return \"blank\"\n else\n return \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef foo\n :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwhich return tuple literals i.e.\n\n```\ndef method(a, b)\n return a, b\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method(a, b)\n {a, b}\nend\n```\n\n2. *allow_empty_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwithout arguments. Sometimes such returns are used to return the `nil` value explicitly.\n\n```\ndef method\n @foo = :empty\n return\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantReturn:\n Enabled: true\n AllowMutliReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":96,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"allow_empty_return:Bool-instance-method","html_id":"allow_empty_return:Bool-instance-method","name":"allow_empty_return","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_empty_return","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_empty_return"}},{"id":"allow_empty_return=(allow_empty_return:Bool)-instance-method","html_id":"allow_empty_return=(allow_empty_return:Bool)-instance-method","name":"allow_empty_return=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_empty_return","doc":null,"default_value":"","external_name":"allow_empty_return","restriction":"Bool"}],"args_string":"(allow_empty_return : Bool)","args_html":"(allow_empty_return : Bool)","location":null,"def":{"name":"allow_empty_return=","args":[{"name":"allow_empty_return","doc":null,"default_value":"","external_name":"allow_empty_return","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_empty_return = allow_empty_return"}},{"id":"allow_multi_return:Bool-instance-method","html_id":"allow_multi_return:Bool-instance-method","name":"allow_multi_return","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_multi_return","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_multi_return"}},{"id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","html_id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","name":"allow_multi_return=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_multi_return","doc":null,"default_value":"","external_name":"allow_multi_return","restriction":"Bool"}],"args_string":"(allow_multi_return : Bool)","args_html":"(allow_multi_return : Bool)","location":null,"def":{"name":"allow_multi_return=","args":[{"name":"allow_multi_return","doc":null,"default_value":"","external_name":"allow_multi_return","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_multi_return = allow_multi_return"}},{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","html_id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"args_string":"(source, node : Crystal::Return, visitor : AST::RedundantControlExpressionVisitor)","args_html":"(source, node : Crystal::Return, visitor : AST::RedundantControlExpressionVisitor)","location":{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":109,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if allow_multi_return && node.exp.is_a?(Crystal::TupleLiteral)\n return\nend\nif allow_empty_return && (node.exp.nil? || node.exp.not_nil!.nop?)\n return\nend\nsource.try(&.add_issue(self, node, MSG))\n"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":105,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","path":"Ameba/Rule/Style/TypeNames.html","kind":"struct","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Type name should be camelcased: %s, but it was %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces type names in camelcase manner.\n\nFor example, these are considered valid:\n\n```\nclass ParseError < Exception\nend\n\nmodule HTTP\n class RequestHandler\n end\nend\n\nalias NumericValue = Float32 | Float64 | Int32 | Int64\n\nlib LibYAML\nend\n\nstruct TagDirective\nend\n\nenum Time::DayOfWeek\nend\n```\n\nAnd these are invalid type names\n\n```\nclass My_class\nend\n\nmodule HTT_p\nend\n\nalias Numeric_value = Int32\n\nlib Lib_YAML\nend\n\nstruct Tag_directive\nend\n\nenum Time_enum::Day_of_week\nend\n```\n\nYAML configuration example:\n\n```\nStyle/TypeNames:\n Enabled: true\n```\n","summary":"

A rule that enforces type names in camelcase manner.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces type names in camelcase manner.\n\nFor example, these are considered valid:\n\n```\nclass ParseError < Exception\nend\n\nmodule HTTP\n class RequestHandler\n end\nend\n\nalias NumericValue = Float32 | Float64 | Int32 | Int64\n\nlib LibYAML\nend\n\nstruct TagDirective\nend\n\nenum Time::DayOfWeek\nend\n```\n\nAnd these are invalid type names\n\n```\nclass My_class\nend\n\nmodule HTT_p\nend\n\nalias Numeric_value = Int32\n\nlib Lib_YAML\nend\n\nstruct Tag_directive\nend\n\nenum Time_enum::Day_of_week\nend\n```\n\nYAML configuration example:\n\n```\nStyle/TypeNames:\n Enabled: true\n```\n","summary":"

A rule that enforces type names in camelcase manner.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":55,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ClassDef)-instance-method","html_id":"test(source,node:Crystal::ClassDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(source, node : Crystal::ClassDef)","args_html":"(source, node : Crystal::ClassDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":70,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::Alias)-instance-method","html_id":"test(source,node:Crystal::Alias)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(source, node : Crystal::Alias)","args_html":"(source, node : Crystal::Alias)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":74,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::LibDef)-instance-method","html_id":"test(source,node:Crystal::LibDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(source, node : Crystal::LibDef)","args_html":"(source, node : Crystal::LibDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":78,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::EnumDef)-instance-method","html_id":"test(source,node:Crystal::EnumDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(source, node : Crystal::EnumDef)","args_html":"(source, node : Crystal::EnumDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":82,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::ModuleDef)-instance-method","html_id":"test(source,node:Crystal::ModuleDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ModuleDef)","args_html":"(source, node : Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":86,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","path":"Ameba/Rule/Style/UnlessElse.html","kind":"struct","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour if over unless with else\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of an else block with the unless.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of an else block with the unless.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":46,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Unless)-instance-method","html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":53,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.else.nop?\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","path":"Ameba/Rule/Style/VariableNames.html","kind":"struct","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Var name should be underscore-cased: %s, not %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces variable names to be in underscored case.\n\nFor example, these variable names are considered valid:\n\n```\nvar_name = 1\nname = 2\n_another_good_name = 3\n```\n\nAnd these are invalid variable names:\n\n```\nmyBadNamedVar = 1\nwrong_Name = 2\n```\n\nYAML configuration example:\n\n```\nStyle/VariableNames:\n Enabled: true\n```\n","summary":"

A rule that enforces variable names to be in underscored case.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces variable names to be in underscored case.\n\nFor example, these variable names are considered valid:\n\n```\nvar_name = 1\nname = 2\n_another_good_name = 3\n```\n\nAnd these are invalid variable names:\n\n```\nmyBadNamedVar = 1\nwrong_Name = 2\n```\n\nYAML configuration example:\n\n```\nStyle/VariableNames:\n Enabled: true\n```\n","summary":"

A rule that enforces variable names to be in underscored case.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":26,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Var)-instance-method","html_id":"test(source,node:Crystal::Var)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(source, node : Crystal::Var)","args_html":"(source, node : Crystal::Var)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":39,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::InstanceVar)-instance-method","html_id":"test(source,node:Crystal::InstanceVar)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(source, node : Crystal::InstanceVar)","args_html":"(source, node : Crystal::InstanceVar)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":43,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::ClassVar)-instance-method","html_id":"test(source,node:Crystal::ClassVar)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(source, node : Crystal::ClassVar)","args_html":"(source, node : Crystal::ClassVar)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":47,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","path":"Ameba/Rule/Style/WhileTrue.html","kind":"struct","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"While statement using true literal as condition\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":29,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::While)-instance-method","html_id":"test(source,node:Crystal::While)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.cond.true_literal?\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]}]}]},{"html_id":"ameba/Ameba/Runner","path":"Ameba/Runner.html","kind":"class","full_name":"Ameba::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a runner for inspecting sources files.\nHolds a list of rules to do inspection based on,\nlist of sources to run inspection on and a formatter\nto prepare a report.\n\n```\nconfig = Ameba::Config.load\nrunner = Ameba::Runner.new config\nrunner.run.success? # => true or false\n```\n","summary":"

Represents a runner for inspecting sources files.

","class_methods":[],"constructors":[{"id":"new(config:Config)-class-method","html_id":"new(config:Config)-class-method","name":"new","doc":"Instantiates a runner using a `config`.\n\n```\nconfig = Ameba::Config.load\nconfig.files = files\nconfig.formatter = formatter\n\nAmeba::Runner.new config\n```\n","summary":"

Instantiates a runner using a config.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","args_html":"(config : Config)","location":{"filename":"src/ameba/runner.cr","line_number":42,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"explain(location,output=STDOUT)-instance-method","html_id":"explain(location,output=STDOUT)-instance-method","name":"explain","doc":"Explains an issue at a specified *location*.\n\nRunner should perform inspection before doing the explain.\nThis is necessary to be able to find the issue at a specified location.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.explain({file: file, line: l, column: c})\n```\n","summary":"

Explains an issue at a specified location.

","abstract":false,"args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(location, output = STDOUT)","args_html":"(location, output = STDOUT)","location":{"filename":"src/ameba/runner.cr","line_number":118,"url":null},"def":{"name":"explain","args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Formatter::ExplainFormatter.new(output, location)).finished(@sources)"}},{"id":"run-instance-method","html_id":"run-instance-method","name":"run","doc":"Performs the inspection. Iterates through all sources and test it using\nlist of rules. If a specific rule fails on a specific source, it adds\nan issue to that source.\n\nThis action also notifies formatter when inspection is started/finished,\nand when a specific source started/finished to be inspected.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run # => returns runner again\n```\n","summary":"

Performs the inspection.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":69,"url":null},"def":{"name":"run","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n @formatter.started(@sources)\n channels = @sources.map do\n Channel(Exception | ::Nil).new\n end\n @sources.each_with_index do |source, idx|\n channel = channels[idx]\n spawn do\n begin\n run_source(source)\n rescue e\n channel.send(e)\n else\n channel.send(nil)\n end\n end\n end\n channels.each do |c|\n e = c.receive\n if e.nil?\n else\n raise(e)\n end\n end\n self\nensure\n @formatter.finished(@sources)\nend"}},{"id":"sources:Array(Source)-instance-method","html_id":"sources:Array(Source)-instance-method","name":"sources","doc":"A list of sources to run inspection on.","summary":"

A list of sources to run inspection on.

","abstract":false,"args":[],"args_string":" : Array(Source)","args_html":" : Array(Source)","location":{"filename":"src/ameba/runner.cr","line_number":18,"url":null},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Source)","visibility":"Public","body":"@sources"}},{"id":"success?-instance-method","html_id":"success?-instance-method","name":"success?","doc":"Indicates whether the last inspection successful or not.\nIt returns true if no issues matching severity in sources found, false otherwise.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.success? # => true or false\n```\n","summary":"

Indicates whether the last inspection successful or not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":131,"url":null},"def":{"name":"success?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sources.all? do |source|\n source.issues.reject(&.disabled?).none? do |issue|\n issue.rule.severity <= @severity\n end\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Severity","path":"Ameba/Severity.html","kind":"enum","full_name":"Ameba::Severity","name":"Severity","abstract":false,"superclass":null,"ancestors":[{"html_id":"ameba/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"ameba/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Error","name":"Error","value":"0","doc":null,"summary":null},{"id":"Warning","name":"Warning","value":"1","doc":null,"summary":null},{"id":"Convention","name":"Convention","value":"2","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":null,"summary":null,"class_methods":[{"id":"parse(name:String)-class-method","html_id":"parse(name:String)-class-method","name":"parse","doc":"Creates Severity by the name.\n\n```\nSeverity.parse(\"convention\") # => Severity::Convention\nSeverity.parse(\"foo-bar\") # => Exception: Incorrect severity name\n```\n","summary":"

Creates Severity by the name.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/severity.cr","line_number":23,"url":null},"def":{"name":"parse","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n super(name)\nrescue ArgumentError\n raise(\"Incorrect severity name #{name}. Try one of #{values}\")\nend"}}],"constructors":[],"instance_methods":[{"id":"convention?-instance-method","html_id":"convention?-instance-method","name":"convention?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":5,"url":null},"def":{"name":"convention?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Convention"}},{"id":"error?-instance-method","html_id":"error?-instance-method","name":"error?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":3,"url":null},"def":{"name":"error?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Error"}},{"id":"symbol-instance-method","html_id":"symbol-instance-method","name":"symbol","doc":"Returns a symbol uniquely indicating severity.\n\n```\nSeverity::Warning.symbol # => 'W'\n```","summary":"

Returns a symbol uniquely indicating severity.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":12,"url":null},"def":{"name":"symbol","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"to_s[0]"}},{"id":"warning?-instance-method","html_id":"warning?-instance-method","name":"warning?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":4,"url":null},"def":{"name":"warning?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Warning"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/SeverityYamlConverter","path":"Ameba/SeverityYamlConverter.html","kind":"class","full_name":"Ameba::SeverityYamlConverter","name":"SeverityYamlConverter","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Converter for `YAML.mapping` which converts severity enum to and from YAML.","summary":"

Converter for YAML.mapping which converts severity enum to and from YAML.

","class_methods":[{"id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"from_yaml","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":{"filename":"src/ameba/severity.cr","line_number":32,"url":null},"def":{"name":"from_yaml","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.is_a?(YAML::Nodes::Scalar)\nelse\n raise(\"Severity must be a scalar, not #{node.class}\")\nend\ncase value = node.value\nwhen String\n Severity.parse(value)\nwhen Nil\n nil\nelse\n raise(\"Incorrect severity: #{value}\")\nend\n"}},{"id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","html_id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","name":"to_yaml","doc":null,"summary":null,"abstract":false,"args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":"Severity"},{"name":"yaml","doc":null,"default_value":"","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"args_string":"(value : Severity, yaml : YAML::Nodes::Builder)","args_html":"(value : Severity, yaml : YAML::Nodes::Builder)","location":{"filename":"src/ameba/severity.cr","line_number":45,"url":null},"def":{"name":"to_yaml","args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":"Severity"},{"name":"yaml","doc":null,"default_value":"","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"yaml.scalar(value)"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Source","path":"Ameba/Source.html","kind":"class","full_name":"Ameba::Source","name":"Source","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"An entity that represents a Crystal source file.\nHas path, lines of code and issues reported by rules.","summary":"

An entity that represents a Crystal source file.

","class_methods":[],"constructors":[{"id":"new(code:String,path="")-class-method","html_id":"new(code:String,path="")-class-method","name":"new","doc":"Creates a new source by `code` and `path`.\n\nFor example:\n\n```\npath = \"./src/source.cr\"\nAmeba::Source.new File.read(path), path\n```\n","summary":"

Creates a new source by #code and #path.

","abstract":false,"args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""}],"args_string":"(code : String, path = "")","args_html":"(code : String, path = "")","location":{"filename":"src/ameba/source.cr","line_number":27,"url":null},"def":{"name":"new","args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(code, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"ast-instance-method","html_id":"ast-instance-method","name":"ast","doc":"Returns AST nodes constructed by `Crystal::Parser`.\n\n```\nsource = Ameba::Source.new code, path\nsource.ast\n```\n","summary":"

Returns AST nodes constructed by Crystal::Parser.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/source.cr","line_number":52,"url":null},"def":{"name":"ast","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ast || (@ast = (Crystal::Parser.new(code)).tap do |parser|\n parser.wants_doc = true\nend.tap do |parser|\n parser.filename = @path\nend.parse)"}},{"id":"code:String-instance-method","html_id":"code:String-instance-method","name":"code","doc":"Crystal code (content of a source file).","summary":"

Crystal code (content of a source file).

","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":12,"url":null},"def":{"name":"code","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@code"}},{"id":"fullpath-instance-method","html_id":"fullpath-instance-method","name":"fullpath","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/source.cr","line_number":60,"url":null},"def":{"name":"fullpath","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@fullpath || (@fullpath = File.expand_path(@path))"}},{"id":"lines-instance-method","html_id":"lines-instance-method","name":"lines","doc":"Returns lines of code splitted by new line character.\nSince `code` is immutable and can't be changed, this\nmethod caches lines in an instance variable, so calling\nit second time will not perform a split, but will return\nlines instantly.\n\n```\nsource = Ameba::Source.new \"a = 1\\nb = 2\", path\nsource.lines # => [\"a = 1\", \"b = 2\"]\n```\n","summary":"

Returns lines of code splitted by new line character.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/source.cr","line_number":41,"url":null},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@lines || (@lines = @code.split(\"\\n\"))"}},{"id":"matches_path?(filepath)-instance-method","html_id":"matches_path?(filepath)-instance-method","name":"matches_path?","doc":"Returns true if *filepath* matches the source's path, false if it does not.","summary":"

Returns true if filepath matches the source's path, false if it does not.

","abstract":false,"args":[{"name":"filepath","doc":null,"default_value":"","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/ameba/source.cr","line_number":65,"url":null},"def":{"name":"matches_path?","args":[{"name":"filepath","doc":null,"default_value":"","external_name":"filepath","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(path == filepath) || (path == (File.expand_path(filepath)))"}},{"id":"path:String-instance-method","html_id":"path:String-instance-method","name":"path","doc":"Path to the source file.","summary":"

Path to the source file.

","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":9,"url":null},"def":{"name":"path","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@path"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Tokenizer","path":"Ameba/Tokenizer.html","kind":"class","full_name":"Ameba::Tokenizer","name":"Tokenizer","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents Crystal syntax tokenizer based on `Crystal::Lexer`.\n\n```\nsource = Ameba::Source.new code, path\ntokenizer = Ameba::Tokenizer.new(source)\ntokenizer.run do |token|\n puts token\nend\n```\n","summary":"

Represents Crystal syntax tokenizer based on Crystal::Lexer.

","class_methods":[],"constructors":[{"id":"new(lexer:Crystal::Lexer)-class-method","html_id":"new(lexer:Crystal::Lexer)-class-method","name":"new","doc":"Instantiates Tokenizer using a `lexer`.\n\n```\nlexer = Crystal::Lexer.new(code)\nAmeba::Tokenizer.new(lexer)\n```\n","summary":"

Instantiates Tokenizer using a lexer.

","abstract":false,"args":[{"name":"lexer","doc":null,"default_value":"","external_name":"lexer","restriction":"Crystal::Lexer"}],"args_string":"(lexer : Crystal::Lexer)","args_html":"(lexer : Crystal::Lexer)","location":{"filename":"src/ameba/tokenizer.cr","line_number":37,"url":null},"def":{"name":"new","args":[{"name":"lexer","doc":null,"default_value":"","external_name":"lexer","restriction":"Crystal::Lexer"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(lexer)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(source)-class-method","html_id":"new(source)-class-method","name":"new","doc":"Instantiates Tokenizer using a `source`.\n\n```\nsource = Ameba::Source.new code, path\nAmeba::Tokenizer.new(source)\n```\n","summary":"

Instantiates Tokenizer using a source.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/tokenizer.cr","line_number":22,"url":null},"def":{"name":"new","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"run(&block:Crystal::Token->_)-instance-method","html_id":"run(&block:Crystal::Token->_)-instance-method","name":"run","doc":"Runs the tokenizer and yields each token as a block argument.\n\n```\nAmeba::Tokenizer.new(source).run do |token|\n puts token\nend\n```\n","summary":"

Runs the tokenizer and yields each token as a block argument.

","abstract":false,"args":[],"args_string":"(&block : Crystal::Token -> _)","args_html":"(&block : Crystal::Token -> _)","location":{"filename":"src/ameba/tokenizer.cr","line_number":48,"url":null},"def":{"name":"run","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(Crystal::Token -> _)"},"return_type":"","visibility":"Public","body":"begin\n run_normal_state(@lexer, &block)\n true\nrescue e : Crystal::SyntaxException\n false\nend"}}],"macros":[],"types":[]}]}]}} \ No newline at end of file diff --git a/js/doc.js b/js/doc.js new file mode 100644 index 00000000..eb03302d --- /dev/null +++ b/js/doc.js @@ -0,0 +1,1086 @@ +window.CrystalDocs = (window.CrystalDocs || {}); + +CrystalDocs.base_path = (CrystalDocs.base_path || ""); + +CrystalDocs.searchIndex = (CrystalDocs.searchIndex || false); +CrystalDocs.MAX_RESULTS_DISPLAY = 140; + +CrystalDocs.runQuery = function(query) { + function searchType(type, query, results) { + var matches = []; + var matchedFields = []; + var name = type.full_name; + var i = name.lastIndexOf("::"); + if (i > 0) { + name = name.substring(i + 2); + } + var nameMatches = query.matches(name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + var namespaceMatches = query.matchesNamespace(type.full_name); + if(namespaceMatches){ + matches = matches.concat(namespaceMatches); + matchedFields.push("name"); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + results.push({ + id: type.id, + result_type: "type", + kind: type.kind, + name: name, + full_name: type.full_name, + href: type.path, + summary: type.summary, + matched_fields: matchedFields, + matched_terms: matches + }); + } + + type.instance_methods.forEach(function(method) { + searchMethod(method, type, "instance_method", query, results); + }) + type.class_methods.forEach(function(method) { + searchMethod(method, type, "class_method", query, results); + }) + type.constructors.forEach(function(constructor) { + searchMethod(constructor, type, "constructor", query, results); + }) + type.macros.forEach(function(macro) { + searchMethod(macro, type, "macro", query, results); + }) + type.constants.forEach(function(constant){ + searchConstant(constant, type, query, results); + }); + + type.types.forEach(function(subtype){ + searchType(subtype, query, results); + }); + }; + + function searchMethod(method, type, kind, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matchesMethod(method.name, kind, type); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + method.args.forEach(function(arg){ + var argMatches = query.matches(arg.external_name); + if (argMatches) { + matches = matches.concat(argMatches); + matchedFields.push("args"); + } + }); + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: method.id, + type: type.full_name, + result_type: kind, + name: method.name, + full_name: type.full_name + "#" + method.name, + args_string: method.args_string, + summary: method.summary, + href: type.path + "#" + method.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + function searchConstant(constant, type, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matches(constant.name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + var docMatches = query.matches(constant.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: constant.id, + type: type.full_name, + result_type: "constant", + name: constant.name, + full_name: type.full_name + "#" + constant.name, + value: constant.value, + summary: constant.summary, + href: type.path + "#" + constant.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + var results = []; + searchType(CrystalDocs.searchIndex.program, query, results); + return results; +}; + +CrystalDocs.rankResults = function(results, query) { + function uniqueArray(ar) { + var j = {}; + + ar.forEach(function(v) { + j[v + "::" + typeof v] = v; + }); + + return Object.keys(j).map(function(v) { + return j[v]; + }); + } + + results = results.sort(function(a, b) { + var matchedTermsDiff = uniqueArray(b.matched_terms).length - uniqueArray(a.matched_terms).length; + var aHasDocs = b.matched_fields.includes("doc"); + var bHasDocs = b.matched_fields.includes("doc"); + + var aOnlyDocs = aHasDocs && a.matched_fields.length == 1; + var bOnlyDocs = bHasDocs && b.matched_fields.length == 1; + + if (a.result_type == "type" && b.result_type != "type" && !aOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("a is type b not"); } + return -1; + } else if (b.result_type == "type" && a.result_type != "type" && !bOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("b is type, a not"); } + return 1; + } + if (a.matched_fields.includes("name")) { + if (b.matched_fields.includes("name")) { + var a_name = (CrystalDocs.prefixForType(a.result_type) || "") + ((a.result_type == "type") ? a.full_name : a.name); + var b_name = (CrystalDocs.prefixForType(b.result_type) || "") + ((b.result_type == "type") ? b.full_name : b.name); + a_name = a_name.toLowerCase(); + b_name = b_name.toLowerCase(); + for(var i = 0; i < query.normalizedTerms.length; i++) { + var term = query.terms[i].replace(/^::?|::?$/, ""); + var a_orig_index = a_name.indexOf(term); + var b_orig_index = b_name.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("term: " + term + " a: " + a_name + " b: " + b_name); } + if(CrystalDocs.DEBUG) { console.log(a_orig_index, b_orig_index, a_orig_index - b_orig_index); } + if (a_orig_index >= 0) { + if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("both have exact match", a_orig_index > b_orig_index ? -1 : 1); } + if(a_orig_index != b_orig_index) { + if(CrystalDocs.DEBUG) { console.log("both have exact match at different positions", a_orig_index > b_orig_index ? 1 : -1); } + return a_orig_index > b_orig_index ? 1 : -1; + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has exact match, b not"); } + return -1; + } + } else if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("b has exact match, a not"); } + return 1; + } + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has match in name, b not"); } + return -1; + } + } else if ( + !a.matched_fields.includes("name") && + b.matched_fields.includes("name") + ) { + return 1; + } + + if (matchedTermsDiff != 0 || (aHasDocs != bHasDocs)) { + if(CrystalDocs.DEBUG) { console.log("matchedTermsDiff: " + matchedTermsDiff, aHasDocs, bHasDocs); } + return matchedTermsDiff; + } + + var matchedFieldsDiff = b.matched_fields.length - a.matched_fields.length; + if (matchedFieldsDiff != 0) { + if(CrystalDocs.DEBUG) { console.log("matched to different number of fields: " + matchedFieldsDiff); } + return matchedFieldsDiff > 0 ? 1 : -1; + } + + var nameCompare = a.name.localeCompare(b.name); + if(nameCompare != 0){ + if(CrystalDocs.DEBUG) { console.log("nameCompare resulted in: " + a.name + "<=>" + b.name + ": " + nameCompare); } + return nameCompare > 0 ? 1 : -1; + } + + if(a.matched_fields.includes("args") && b.matched_fields.includes("args")) { + for(var i = 0; i < query.terms.length; i++) { + var term = query.terms[i]; + var aIndex = a.args_string.indexOf(term); + var bIndex = b.args_string.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("index of " + term + " in args_string: " + aIndex + " - " + bIndex); } + if(aIndex >= 0){ + if(bIndex >= 0){ + if(aIndex != bIndex){ + return aIndex > bIndex ? 1 : -1; + } + }else{ + return -1; + } + }else if(bIndex >= 0) { + return 1; + } + } + } + + return 0; + }); + + if (results.length > 1) { + // if we have more than two search terms, only include results with the most matches + var bestMatchedTerms = uniqueArray(results[0].matched_terms).length; + + results = results.filter(function(result) { + return uniqueArray(result.matched_terms).length + 1 >= bestMatchedTerms; + }); + } + return results; +}; + +CrystalDocs.prefixForType = function(type) { + switch (type) { + case "instance_method": + return "#"; + + case "class_method": + case "macro": + case "constructor": + return "."; + + default: + return false; + } +}; + +CrystalDocs.displaySearchResults = function(results, query) { + function sanitize(html){ + return html.replace(/<(?!\/?code)[^>]+>/g, ""); + } + + // limit results + if (results.length > CrystalDocs.MAX_RESULTS_DISPLAY) { + results = results.slice(0, CrystalDocs.MAX_RESULTS_DISPLAY); + } + + var $frag = document.createDocumentFragment(); + var $resultsElem = document.querySelector(".search-list"); + $resultsElem.innerHTML = ""; + + results.forEach(function(result, i) { + var url = CrystalDocs.base_path + result.href; + var type = false; + + var title = query.highlight(result.result_type == "type" ? result.full_name : result.name); + + var prefix = CrystalDocs.prefixForType(result.result_type); + if (prefix) { + title = "" + prefix + "" + title; + } + + title = "" + title + ""; + + if (result.args_string) { + title += + "" + query.highlight(result.args_string) + ""; + } + + $elem = document.createElement("li"); + $elem.className = "search-result search-result--" + result.result_type; + $elem.dataset.href = url; + $elem.setAttribute("title", result.full_name + " docs page"); + + var $title = document.createElement("div"); + $title.setAttribute("class", "search-result__title"); + var $titleLink = document.createElement("a"); + $titleLink.setAttribute("href", url); + + $titleLink.innerHTML = title; + $title.appendChild($titleLink); + $elem.appendChild($title); + $elem.addEventListener("click", function() { + $titleLink.click(); + }); + + if (result.result_type !== "type") { + var $type = document.createElement("div"); + $type.setAttribute("class", "search-result__type"); + $type.innerHTML = query.highlight(result.type); + $elem.appendChild($type); + } + + if(result.summary){ + var $doc = document.createElement("div"); + $doc.setAttribute("class", "search-result__doc"); + $doc.innerHTML = query.highlight(sanitize(result.summary)); + $elem.appendChild($doc); + } + + $elem.appendChild(document.createComment(JSON.stringify(result))); + $frag.appendChild($elem); + }); + + $resultsElem.appendChild($frag); + + CrystalDocs.toggleResultsList(true); +}; + +CrystalDocs.toggleResultsList = function(visible) { + if (visible) { + document.querySelector(".types-list").classList.add("hidden"); + document.querySelector(".search-results").classList.remove("hidden"); + } else { + document.querySelector(".types-list").classList.remove("hidden"); + document.querySelector(".search-results").classList.add("hidden"); + } +}; + +CrystalDocs.Query = function(string) { + this.original = string; + this.terms = string.split(/\s+/).filter(function(word) { + return CrystalDocs.Query.stripModifiers(word).length > 0; + }); + + var normalized = this.terms.map(CrystalDocs.Query.normalizeTerm); + this.normalizedTerms = normalized; + + function runMatcher(field, matcher) { + if (!field) { + return false; + } + var normalizedValue = CrystalDocs.Query.normalizeTerm(field); + + var matches = []; + normalized.forEach(function(term) { + if (matcher(normalizedValue, term)) { + matches.push(term); + } + }); + return matches.length > 0 ? matches : false; + } + + this.matches = function(field) { + return runMatcher(field, function(normalized, term) { + if (term[0] == "#" || term[0] == ".") { + return false; + } + return normalized.indexOf(term) >= 0; + }); + }; + + function namespaceMatcher(normalized, term){ + var i = term.indexOf(":"); + if(i >= 0){ + term = term.replace(/^::?|::?$/, ""); + var index = normalized.indexOf(term); + if((index == 0) || (index > 0 && normalized[index-1] == ":")){ + return true; + } + } + return false; + } + this.matchesMethod = function(name, kind, type) { + return runMatcher(name, function(normalized, term) { + var i = term.indexOf("#"); + if(i >= 0){ + if (kind != "instance_method") { + return false; + } + }else{ + i = term.indexOf("."); + if(i >= 0){ + if (kind != "class_method" && kind != "macro" && kind != "constructor") { + return false; + } + }else{ + //neither # nor . + if(term.indexOf(":") && namespaceMatcher(normalized, term)){ + return true; + } + } + } + + var methodName = term; + if(i >= 0){ + var termType = term.substring(0, i); + methodName = term.substring(i+1); + + if(termType != "") { + if(CrystalDocs.Query.normalizeTerm(type.full_name).indexOf(termType) < 0){ + return false; + } + } + } + return normalized.indexOf(methodName) >= 0; + }); + }; + + this.matchesNamespace = function(namespace){ + return runMatcher(namespace, namespaceMatcher); + }; + + this.highlight = function(string) { + if (typeof string == "undefined") { + return ""; + } + function escapeRegExp(s) { + return s.replace(/[.*+?\^${}()|\[\]\\]/g, "\\$&").replace(/^[#\.:]+/, ""); + } + return string.replace( + new RegExp("(" + this.normalizedTerms.map(escapeRegExp).join("|") + ")", "gi"), + "$1" + ); + }; +}; +CrystalDocs.Query.normalizeTerm = function(term) { + return term.toLowerCase(); +}; +CrystalDocs.Query.stripModifiers = function(term) { + switch (term[0]) { + case "#": + case ".": + case ":": + return term.substr(1); + + default: + return term; + } +} + +CrystalDocs.search = function(string) { + if(!CrystalDocs.searchIndex) { + console.log("CrystalDocs search index not initialized, delaying search"); + + document.addEventListener("CrystalDocs:loaded", function listener(){ + document.removeEventListener("CrystalDocs:loaded", listener); + CrystalDocs.search(string); + }); + return; + } + + document.dispatchEvent(new Event("CrystalDocs:searchStarted")); + + var query = new CrystalDocs.Query(string); + var results = CrystalDocs.runQuery(query); + results = CrystalDocs.rankResults(results, query); + CrystalDocs.displaySearchResults(results, query); + + document.dispatchEvent(new Event("CrystalDocs:searchPerformed")); +}; + +CrystalDocs.initializeIndex = function(data) { + CrystalDocs.searchIndex = data; + + document.dispatchEvent(new Event("CrystalDocs:loaded")); +}; + +CrystalDocs.loadIndex = function() { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function loadScript(file) { + script = document.createElement("script"); + script.src = file; + document.body.appendChild(script); + } + + function parseJSON(json) { + CrystalDocs.initializeIndex(JSON.parse(json)); + } + + for(var i = 0; i < document.scripts.length; i++){ + var script = document.scripts[i]; + if (script.src && script.src.indexOf("js/doc.js") >= 0) { + if (script.src.indexOf("file://") == 0) { + // We need to support JSONP files for the search to work on local file system. + var jsonPath = script.src.replace("js/doc.js", "search-index.js"); + loadScript(jsonPath); + return; + } else { + var jsonPath = script.src.replace("js/doc.js", "index.json"); + loadJSON(jsonPath, parseJSON); + return; + } + } + } + console.error("Could not find location of js/doc.js"); +}; + +// Callback for jsonp +function crystal_doc_search_index_callback(data) { + CrystalDocs.initializeIndex(data); +} + +Navigator = function(sidebar, searchInput, list, leaveSearchScope){ + this.list = list; + var self = this; + + var performingSearch = false; + + document.addEventListener('CrystalDocs:searchStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchDebounceStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchPerformed', function(){ + performingSearch = false; + }); + document.addEventListener('CrystalDocs:searchDebounceStopped', function(event){ + performingSearch = false; + }); + + function delayWhileSearching(callback) { + if(performingSearch){ + document.addEventListener('CrystalDocs:searchPerformed', function listener(){ + document.removeEventListener('CrystalDocs:searchPerformed', listener); + + // add some delay to let search results display kick in + setTimeout(callback, 100); + }); + }else{ + callback(); + } + } + + function clearMoveTimeout() { + clearTimeout(self.moveTimeout); + self.moveTimeout = null; + } + + function startMoveTimeout(upwards){ + /*if(self.moveTimeout) { + clearMoveTimeout(); + } + + var go = function() { + if (!self.moveTimeout) return; + self.move(upwards); + self.moveTimout = setTimeout(go, 600); + }; + self.moveTimeout = setTimeout(go, 800);*/ + } + + function scrollCenter(element) { + var rect = element.getBoundingClientRect(); + var middle = sidebar.clientHeight / 2; + sidebar.scrollTop += rect.top + rect.height / 2 - middle; + } + + var move = this.move = function(upwards){ + if(!this.current){ + this.highlightFirst(); + return true; + } + var next = upwards ? this.current.previousElementSibling : this.current.nextElementSibling; + if(next && next.classList) { + this.highlight(next); + scrollCenter(next); + return true; + } + return false; + }; + + this.moveRight = function(){ + }; + this.moveLeft = function(){ + }; + + this.highlight = function(elem) { + if(!elem){ + return; + } + this.removeHighlight(); + + this.current = elem; + this.current.classList.add("current"); + }; + + this.highlightFirst = function(){ + this.highlight(this.list.querySelector('li:first-child')); + }; + + this.removeHighlight = function() { + if(this.current){ + this.current.classList.remove("current"); + } + this.current = null; + } + + this.openSelectedResult = function() { + if(this.current) { + this.current.click(); + } + } + + this.focus = function() { + searchInput.focus(); + searchInput.select(); + this.highlightFirst(); + } + + function handleKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + case "i": + case "j": + case "k": + case "l": + case "c": + case "h": + case "t": + case "n": + event.stopPropagation(); + clearMoveTimeout(); + } + } + + function handleKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + self.openSelectedResult(); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + break; + case "j": + case "c": + case "ArrowUp": + if(event.ctrlKey || event.key == "ArrowUp") { + event.stopPropagation(); + self.move(true); + startMoveTimeout(true); + } + break; + case "k": + case "h": + case "ArrowDown": + if(event.ctrlKey || event.key == "ArrowDown") { + event.stopPropagation(); + self.move(false); + startMoveTimeout(false); + } + break; + case "k": + case "t": + case "ArrowLeft": + if(event.ctrlKey || event.key == "ArrowLeft") { + event.stopPropagation(); + self.moveLeft(); + } + break; + case "l": + case "n": + case "ArrowRight": + if(event.ctrlKey || event.key == "ArrowRight") { + event.stopPropagation(); + self.moveRight(); + } + break; + } + } + + function handleInputKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + clearMoveTimeout(); + } + } + + function handleInputKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + delayWhileSearching(function(){ + self.openSelectedResult(); + leaveSearchScope(); + }); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + // remove focus from search input + leaveSearchScope(); + sidebar.focus(); + break; + case "ArrowUp": + event.stopPropagation(); + event.preventDefault(); + self.move(true); + startMoveTimeout(true); + break; + + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + self.move(false); + startMoveTimeout(false); + break; + } + } + + sidebar.tabIndex = 100; // set tabIndex to enable keylistener + sidebar.addEventListener('keyup', function(event) { + handleKeyUp(event); + }); + sidebar.addEventListener('keydown', function(event) { + handleKeyDown(event); + }); + searchInput.addEventListener('keydown', function(event) { + handleInputKeyDown(event); + }); + searchInput.addEventListener('keyup', function(event) { + handleInputKeyUp(event); + }); + this.move(); +}; + +CrystalDocs.initializeVersions = function () { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function parseJSON(json) { + CrystalDocs.loadConfig(JSON.parse(json)); + } + + $elem = document.querySelector("html > head > meta[name=\"crystal_docs.json_config_url\"]") + if ($elem == undefined) { + return + } + jsonURL = $elem.getAttribute("content") + if (jsonURL && jsonURL != "") { + loadJSON(jsonURL, parseJSON); + } +} + +CrystalDocs.loadConfig = function (config) { + var projectVersions = config["versions"] + var currentVersion = document.querySelector("html > head > meta[name=\"crystal_docs.project_version\"]").getAttribute("content") + + var currentVersionInList = projectVersions.find(function (element) { + return element.name == currentVersion + }) + + if (!currentVersionInList) { + projectVersions.unshift({ name: currentVersion, url: '#' }) + } + + $version = document.querySelector(".project-summary > .project-version") + $version.innerHTML = "" + + $select = document.createElement("select") + $select.classList.add("project-versions-nav") + $select.addEventListener("change", function () { + window.location.href = this.value + }) + projectVersions.forEach(function (version) { + $item = document.createElement("option") + $item.setAttribute("value", version.url) + $item.append(document.createTextNode(version.name)) + + if (version.name == currentVersion) { + $item.setAttribute("selected", true) + $item.setAttribute("disabled", true) + } + $select.append($item) + }); + $form = document.createElement("form") + $form.setAttribute("autocomplete", "off") + $form.append($select) + $version.append($form) +} + +document.addEventListener("DOMContentLoaded", function () { + CrystalDocs.initializeVersions() +}) + +var UsageModal = function(title, content) { + var $body = document.body; + var self = this; + var $modalBackground = document.createElement("div"); + $modalBackground.classList.add("modal-background"); + var $usageModal = document.createElement("div"); + $usageModal.classList.add("usage-modal"); + $modalBackground.appendChild($usageModal); + var $title = document.createElement("h3"); + $title.classList.add("modal-title"); + $title.innerHTML = title + $usageModal.appendChild($title); + var $closeButton = document.createElement("span"); + $closeButton.classList.add("close-button"); + $closeButton.setAttribute("title", "Close modal"); + $closeButton.innerText = '×'; + $usageModal.appendChild($closeButton); + $usageModal.insertAdjacentHTML("beforeend", content); + + $modalBackground.addEventListener('click', function(event) { + var element = event.target || event.srcElement; + + if(element == $modalBackground) { + self.hide(); + } + }); + $closeButton.addEventListener('click', function(event) { + self.hide(); + }); + + $body.insertAdjacentElement('beforeend', $modalBackground); + + this.show = function(){ + $body.classList.add("js-modal-visible"); + }; + this.hide = function(){ + $body.classList.remove("js-modal-visible"); + }; + this.isVisible = function(){ + return $body.classList.contains("js-modal-visible"); + } +} + + +document.addEventListener('DOMContentLoaded', function() { + var sessionStorage; + try { + sessionStorage = window.sessionStorage; + } catch (e) { } + if(!sessionStorage) { + sessionStorage = { + setItem: function() {}, + getItem: function() {}, + removeItem: function() {} + }; + } + + var repositoryName = document.querySelector('[name=repository-name]').getAttribute('content'); + var typesList = document.querySelector('.types-list'); + var searchInput = document.querySelector('.search-input'); + var parents = document.querySelectorAll('.types-list li.parent'); + + var scrollSidebarToOpenType = function(){ + var openTypes = typesList.querySelectorAll('.current'); + if (openTypes.length > 0) { + var lastOpenType = openTypes[openTypes.length - 1]; + lastOpenType.scrollIntoView(); + } + } + + scrollSidebarToOpenType(); + + var setPersistentSearchQuery = function(value){ + sessionStorage.setItem(repositoryName + '::search-input:value', value); + } + + for(var i = 0; i < parents.length; i++) { + var _parent = parents[i]; + _parent.addEventListener('click', function(e) { + e.stopPropagation(); + + if(e.target.tagName.toLowerCase() == 'li') { + if(e.target.className.match(/open/)) { + sessionStorage.removeItem(e.target.getAttribute('data-id')); + e.target.className = e.target.className.replace(/ +open/g, ''); + } else { + sessionStorage.setItem(e.target.getAttribute('data-id'), '1'); + if(e.target.className.indexOf('open') == -1) { + e.target.className += ' open'; + } + } + } + }); + + if(sessionStorage.getItem(_parent.getAttribute('data-id')) == '1') { + _parent.className += ' open'; + } + } + + var leaveSearchScope = function(){ + CrystalDocs.toggleResultsList(false); + window.focus(); + } + + var navigator = new Navigator(document.querySelector('.types-list'), searchInput, document.querySelector(".search-results"), leaveSearchScope); + + CrystalDocs.loadIndex(); + var searchTimeout; + var lastSearchText = false; + var performSearch = function() { + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStarted")); + + clearTimeout(searchTimeout); + searchTimeout = setTimeout(function() { + var text = searchInput.value; + + if(text == "") { + CrystalDocs.toggleResultsList(false); + }else if(text == lastSearchText){ + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStopped")); + }else{ + CrystalDocs.search(text); + navigator.highlightFirst(); + searchInput.focus(); + } + lastSearchText = text; + setPersistentSearchQuery(text); + }, 200); + }; + + if(location.hash.length > 3 && location.hash.substring(0,3) == "#q="){ + // allows directly linking a search query which is then executed on the client + // this comes handy for establishing a custom browser search engine with https://crystal-lang.org/api/#q=%s as a search URL + // TODO: Add OpenSearch description + var searchQuery = location.hash.substring(3); + history.pushState({searchQuery: searchQuery}, "Search for " + searchQuery, location.href.replace(/#q=.*/, "")); + searchInput.value = searchQuery; + document.addEventListener('CrystalDocs:loaded', performSearch); + } + + if (searchInput.value.length == 0) { + var searchText = sessionStorage.getItem(repositoryName + '::search-input:value'); + if(searchText){ + searchInput.value = searchText; + } + } + searchInput.addEventListener('keyup', performSearch); + searchInput.addEventListener('input', performSearch); + + var usageModal = new UsageModal('Keyboard Shortcuts', '' + + '
    ' + + '
  • ' + + ' ' + + ' s,' + + ' /' + + ' ' + + ' Search' + + '
  • ' + + '
  • ' + + ' Esc' + + ' Abort search / Close modal' + + '
  • ' + + '
  • ' + + ' ' + + ' ⇨,' + + ' Enter' + + ' ' + + ' Open highlighted result' + + '
  • ' + + '
  • ' + + ' ' + + ' ⇧,' + + ' Ctrl+j' + + ' ' + + ' Select previous result' + + '
  • ' + + '
  • ' + + ' ' + + ' ⇩,' + + ' Ctrl+k' + + ' ' + + ' Select next result' + + '
  • ' + + '
  • ' + + ' ?' + + ' Show usage info' + + '
  • ' + + '
' + ); + + function handleShortkeys(event) { + var element = event.target || event.srcElement; + + if(element.tagName == "INPUT" || element.tagName == "TEXTAREA" || element.parentElement.tagName == "TEXTAREA"){ + return; + } + + switch(event.key) { + case "?": + usageModal.show(); + break; + + case "Escape": + usageModal.hide(); + break; + + case "s": + case "/": + if(usageModal.isVisible()) { + return; + } + event.stopPropagation(); + navigator.focus(); + performSearch(); + break; + } + } + + document.addEventListener('keyup', handleShortkeys); + + var scrollToEntryFromLocationHash = function() { + var hash = window.location.hash; + if (hash) { + var targetAnchor = decodeURI(hash.substr(1)); + var targetEl = document.getElementById(targetAnchor) + if (targetEl) { + targetEl.offsetParent.scrollTop = targetEl.offsetTop; + } + } + }; + window.addEventListener("hashchange", scrollToEntryFromLocationHash, false); + scrollToEntryFromLocationHash(); +}); diff --git a/search-index.js b/search-index.js new file mode 100644 index 00000000..6ff74ae4 --- /dev/null +++ b/search-index.js @@ -0,0 +1 @@ +crystal_doc_search_index_callback({"repository_name":"ameba","body":"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n- [About](#about)\n- [Usage](#usage)\n * [Run in parallel](#run-in-parallel)\n- [Installation](#installation)\n * [As a project dependency:](#as-a-project-dependency)\n * [OS X](#os-x)\n * [Docker](#docker)\n * [From sources](#from-sources)\n- [Configuration](#configuration)\n * [Sources](#sources)\n * [Rules](#rules)\n * [Explain issues](#explain-issues)\n * [Inline disabling](#inline-disabling)\n- [Editors & integrations](#editors--integrations)\n- [Credits & inspirations](#credits--inspirations)\n- [Contributors](#contributors)\n\n## About\n\nAmeba is a static code analysis tool for the Crystal language.\nIt enforces a consistent [Crystal code style](https://crystal-lang.org/docs/conventions/coding_style.html),\nalso catches code smells and wrong code constructions.\n\nSee also [Roadmap](https://github.com/crystal-ameba/ameba/wiki).\n\n## Usage\n\nRun `ameba` binary within your project directory to catch code issues:\n\n```sh\n$ ameba\nInspecting 107 files.\n\n...............F.....................F....................................................................\n\nsrc/ameba/formatter/flycheck_formatter.cr:4:33\n[W] Lint/UnusedArgument: Unused argument `location`\n> source.issues.each do |e, location|\n ^\n\nsrc/ameba/formatter/base_formatter.cr:12:7\n[W] Lint/UselessAssign: Useless assignment to variable `s`\n> return s += issues.size\n ^\n\nFinished in 542.64 milliseconds\n\n129 inspected, 2 failures.\n\n```\n\n### Run in parallel\n\nStarting from 0.31.0 Crystal [supports parallelism](https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html).\nIt allows to run linting in parallel too.\nIn order to take advantage of this feature you need to build ameba with preview_mt support:\n\n```sh\n$ crystal build src/cli.cr -Dpreview_mt -o bin/ameba\n$ make install\n```\n\nSome quick benchmark results measured while running Ameba on Crystal repo:\n\n```sh\n$ CRYSTAL_WORKERS=1 ameba #=> 29.11 seconds\n$ CRYSTAL_WORKERS=2 ameba #=> 19.49 seconds\n$ CRYSTAL_WORKERS=4 ameba #=> 13.48 seconds\n$ CRYSTAL_WORKERS=8 ameba #=> 10.14 seconds\n```\n\n## Installation\n\n### As a project dependency:\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndevelopment_dependencies:\n ameba:\n github: crystal-ameba/ameba\n version: ~> 0.13.0\n```\n\nBuild `bin/ameba` binary within your project directory while running `shards install`.\n\nYou may also want to use it on [Travis](travis-ci.org):\n\n```yaml\n# .travis.yml\nlanguage: crystal\ninstall:\n - shards install\nscript:\n - crystal spec\n - crystal bin/ameba.cr\n```\n\nUsing this config Ameba will inspect files just after the specs run. Travis will also fail\nthe build if some problems detected.\n\n### OS X\n\n```sh\n$ brew tap veelenga/tap\n$ brew install ameba\n```\n\n### Docker\n\nBuild the image:\n\n```sh\n$ docker build -t crystal-ameba/ameba .\n```\n\nTo use the resulting image on a local source folder, mount the current (or target) directory into `/src`:\n\n```sh\n$ docker run -v $(pwd):/src crystal-ameba/ameba\n```\n\nAlso available on DockerHub: https://hub.docker.com/r/veelenga/ameba\n\n### From sources\n\n```sh\n$ git clone https://github.com/crystal-ameba/ameba && cd ameba\n$ make install\n```\n\n## Configuration\n\nDefault configuration file is `.ameba.yml`.\nIt allows to configure rule properties, disable specific rules and exclude sources from the rules.\n\nGenerate new file by running `ameba --gen-config`.\n\n### Sources\n\n**List of sources to run Ameba on can be configured globally via:**\n\n- `Globs` section - an array of wildcards (or paths) to include to the\n inspection. Defaults to `%w(**/*.cr !lib)`, meaning it includes all project\n files with `*.cr` extension except those which exist in `lib` folder.\n- `Excluded` section - an array of wildcards (or paths) to exclude from the\n source list defined by `Globs`. Defaults to an empty array.\n\nIn this example we define default globs and exclude `src/compiler` folder:\n\n``` yaml\nGlobs:\n - **/*.cr\n - !lib\n \nExcluded:\n - src/compiler\n```\n\n**Specific sources can be excluded at rule level**:\n\n``` yaml\nStyle/RedundantBegin:\n Excluded:\n - src/server/processor.cr\n - src/server/api.cr\n```\n\n### Rules\n\nOne or more rules, or a one or more group of rules can be included or excluded\nvia command line arguments:\n\n```sh\n$ ameba --only Lint/Syntax # runs only Lint/Syntax rule\n$ ameba --only Style,Lint # runs only rules from Style and Lint groups\n$ ameba --except Lint/Syntax # runs all rules except Lint/Syntax\n$ ameba --except Style,Lint # runs all rules except rules in Style and Lint groups\n```\n\nOr through the configuration file:\n\n``` yaml\nStyle/RedundantBegin:\n Enabled: false\n```\n\n### Explain issues\n\nAmeba allows you to dig deeper into an issue, by showing you details about the issue\nand the reasoning by it being reported.\n\nTo be convenient, you can just copy-paste the `PATH:line:column` string from the\nreport and paste behind the `ameba` command to check it out.\n\n```sh\n$ ameba crystal/command/format.cr:26:83 # show explanation for the issue\n$ ameba --explain crystal/command/format.cr:26:83 # same thing\n```\n\n### Inline disabling\n\nOne or more rules or one or more group of rules can be disabled using inline directives:\n\n```crystal\n# ameba:disable Style/LargeNumbers\ntime = Time.epoch(1483859302)\n\ntime = Time.epoch(1483859302) # ameba:disable Style/LargeNumbers, Lint/UselessAssign\n\ntime = Time.epoch(1483859302) # ameba:disable Style, Lint\n```\n\n## Editors & integrations\n\n * Vim: [vim-crystal](https://github.com/rhysd/vim-crystal), [Ale](https://github.com/w0rp/ale)\n * Emacs: [ameba.el](https://github.com/crystal-ameba/ameba.el)\n * Sublime Text: [Sublime Linter Ameba](https://github.com/epergo/SublimeLinter-contrib-ameba)\n * VSCode: [vscode-crystal-ameba](https://github.com/crystal-ameba/vscode-crystal-ameba)\n * Codacy: [codacy-ameba](https://github.com/codacy/codacy-ameba)\n * GitHub Actions: [github-action](https://github.com/crystal-ameba/github-action)\n\n## Credits & inspirations\n\n- [Crystal Language](https://crystal-lang.org)\n- [Rubocop](https://rubocop.readthedocs.io/en/latest/)\n- [Credo](http://credo-ci.org/)\n- [Dogma](https://github.com/lpil/dogma)\n\n## Contributors\n\n- [veelenga](https://github.com/veelenga) Vitalii Elenhaupt - creator, maintainer\n","program":{"html_id":"ameba/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":true,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba","path":"Ameba.html","kind":"module","full_name":"Ameba","name":"Ameba","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/travis/build/crystal-ameba/ameba/src\\\"`).chomp.stringify }}","doc":null,"summary":null}],"included_modules":[],"extended_modules":[{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"}],"subclasses":[],"including_types":[],"namespace":null,"doc":"Ameba's entry module.\n\nTo run the linter with default parameters:\n\n```\nAmeba.run\n```\n\nTo configure and run it:\n\n```\nconfig = Ameba::Config.load\nconfig.formatter = formatter\nconfig.files = file_paths\n\nAmeba.run config\n```\n","summary":"

Ameba's entry module.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"run(config=Config.load)-instance-method","html_id":"run(config=Config.load)-instance-method","name":"run","doc":"Initializes `Ameba::Runner` and runs it.\nCan be configured via `config` parameter.\n\nExamples:\n\n```\nAmeba.run\nAmeba.run config\n```\n","summary":"

Initializes Ameba::Runner and runs it.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"Config.load","external_name":"config","restriction":""}],"args_string":"(config = Config.load)","args_html":"(config = Config.load)","location":{"filename":"src/ameba.cr","line_number":39,"url":null},"def":{"name":"run","args":[{"name":"config","doc":null,"default_value":"Config.load","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Runner.new(config)).run"}}],"macros":[],"types":[{"html_id":"ameba/Ameba/AST","path":"Ameba/AST.html","kind":"module","full_name":"Ameba::AST","name":"AST","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"[Alias, IsA, Assign, Call, Block, Case, ClassDef, ClassVar, Def, EnumDef, ExceptionHandler, Expressions, HashLiteral, If, InstanceVar, LibDef, ModuleDef, NilLiteral, StringInterpolation, Unless, Var, When, While, Until]","doc":"List of nodes to be visited by Ameba's rules.","summary":"

List of nodes to be visited by Ameba's rules.

"}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that helps to traverse Crystal AST using `Crystal::Visitor`.","summary":"

A module that helps to traverse Crystal AST using Crystal::Visitor.

","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/AST/Argument","path":"Ameba/AST/Argument.html","kind":"class","full_name":"Ameba::AST::Argument","name":"Argument","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the argument of some node.\nHolds the reference to the variable, thus to scope.\n\nFor example, all these vars are arguments:\n\n```\ndef method(a, b, c = 10, &block)\n 3.times do |i|\n end\n\n ->(x : Int32) {}\nend\n```","summary":"

Represents the argument of some node.

","class_methods":[],"constructors":[{"id":"new(node,variable)-class-method","html_id":"new(node,variable)-class-method","name":"new","doc":"Creates a new argument.\n\n```\nArgument.new(node, variable)\n```","summary":"

Creates a new argument.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""}],"args_string":"(node, variable)","args_html":"(node, variable)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, variable)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":23,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":23,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"ignored?-instance-method","html_id":"ignored?-instance-method","name":"ignored?","doc":"Returns true if the name starts with '_', false if not.","summary":"

Returns true if the name starts with '_', false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":35,"url":null},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":22,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":22,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"name-instance-method","html_id":"name-instance-method","name":"name","doc":"Name of the argument.","summary":"

Name of the argument.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":40,"url":null},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case current_node = node\nwhen Crystal::Var\n current_node.name\nwhen Crystal::Arg\n current_node.name\nelse\n raise(ArgumentError.new(\"invalid node\"))\nend"}},{"id":"node:Crystal::Var|Crystal::Arg-instance-method","html_id":"node:Crystal::Var|Crystal::Arg-instance-method","name":"node","doc":"The actual node.","summary":"

The actual node.

","abstract":false,"args":[],"args_string":" : Crystal::Var | Crystal::Arg","args_html":" : Crystal::Var | Crystal::Arg","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":17,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var | Crystal::Arg","visibility":"Public","body":"@node"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":24,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":24,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"variable:Variable-instance-method","html_id":"variable:Variable-instance-method","name":"variable","doc":"Variable of this argument (may be the same node)","summary":"

Variable of this argument (may be the same node)

","abstract":false,"args":[],"args_string":" : Variable","args_html":" : Variable","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":20,"url":null},"def":{"name":"variable","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Variable","visibility":"Public","body":"@variable"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Assignment","path":"Ameba/AST/Assignment.html","kind":"class","full_name":"Ameba::AST::Assignment","name":"Assignment","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the assignment to the variable.\nHolds the assign node and the variable.","summary":"

Represents the assignment to the variable.

","class_methods":[],"constructors":[{"id":"new(node,variable,scope)-class-method","html_id":"new(node,variable,scope)-class-method","name":"new","doc":"Creates a new assignment.\n\n```\nAssignment.new(node, variable, scope)\n```\n","summary":"

Creates a new assignment.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"args_string":"(node, variable, scope)","args_html":"(node, variable, scope)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":32,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, variable, scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"branch:Branch?-instance-method","html_id":"branch:Branch?-instance-method","name":"branch","doc":"Branch of this assignment.","summary":"

Branch of this assignment.

","abstract":false,"args":[],"args_string":" : Branch?","args_html":" : Branch?","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":17,"url":null},"def":{"name":"branch","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"in_branch?-instance-method","html_id":"in_branch?-instance-method","name":"in_branch?","doc":"Returns true if this assignment is in a branch, false if not.\nFor example, this assignment is in a branch:\n\n```\na = 1 if a.nil?\n```","summary":"

Returns true if this assignment is in a branch, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":61,"url":null},"def":{"name":"in_branch?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!branch.nil?"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual assignment node.","summary":"

The actual assignment node.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":11,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"op_assign?-instance-method","html_id":"op_assign?-instance-method","name":"op_assign?","doc":"Returns true if this assignment is an op assign, false if not.\nFor example, this is an op assign:\n\n```\na ||= 1\n```","summary":"

Returns true if this assignment is an op assign, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":51,"url":null},"def":{"name":"op_assign?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::OpAssign)"}},{"id":"referenced=(referenced)-instance-method","html_id":"referenced=(referenced)-instance-method","name":"referenced=","doc":null,"summary":null,"abstract":false,"args":[{"name":"referenced","doc":null,"default_value":"","external_name":"referenced","restriction":""}],"args_string":"(referenced)","args_html":"(referenced)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":null},"def":{"name":"referenced=","args":[{"name":"referenced","doc":null,"default_value":"","external_name":"referenced","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced = referenced"}},{"id":"referenced?:Bool-instance-method","html_id":"referenced?:Bool-instance-method","name":"referenced?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":null},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced"}},{"id":"referenced_in_loop?-instance-method","html_id":"referenced_in_loop?-instance-method","name":"referenced_in_loop?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":41,"url":null},"def":{"name":"referenced_in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@variable.referenced? && @branch.try(&.in_loop?)"}},{"id":"scope:Scope-instance-method","html_id":"scope:Scope-instance-method","name":"scope","doc":"A scope assignment belongs to","summary":"

A scope assignment belongs to

","abstract":false,"args":[],"args_string":" : Scope","args_html":" : Scope","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":20,"url":null},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"id":"target_node-instance-method","html_id":"target_node-instance-method","name":"target_node","doc":"Returns the target node of the variable in this assignment.","summary":"

Returns the target node of the variable in this assignment.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":66,"url":null},"def":{"name":"target_node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case assign = node\nwhen Crystal::Assign\n assign.target\nwhen Crystal::OpAssign\n assign.target\nwhen Crystal::UninitializedVar\n assign.var\nwhen Crystal::MultiAssign\n assign.targets.find(node) do |target|\n target.is_a?(Crystal::Var) && (target.name == variable.name)\n end\nelse\n node\nend"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"transformed?-instance-method","html_id":"transformed?-instance-method","name":"transformed?","doc":"Indicates whether the node is a transformed assignment by the compiler.\ni.e.\n\n```\ncollection.each do |(a, b)|\n puts b\nend\n```\n\nis transformed to:\n\n```\ncollection.each do |__arg0|\n a = __arg0[0]\n b = __arg0[1]\n puts(b)\nend\n```\n","summary":"

Indicates whether the node is a transformed assignment by the compiler.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":99,"url":null},"def":{"name":"transformed?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (assign = node).is_a?(Crystal::Assign)\nelse\n return false\nend\nif (value = assign.value).is_a?(Crystal::Call)\nelse\n return false\nend\nif (obj = value.obj).is_a?(Crystal::Var)\nelse\n return false\nend\nobj.name.starts_with?(\"__arg\")\n"}},{"id":"variable:Variable-instance-method","html_id":"variable:Variable-instance-method","name":"variable","doc":"Variable of this assignment.","summary":"

Variable of this assignment.

","abstract":false,"args":[],"args_string":" : Variable","args_html":" : Variable","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":14,"url":null},"def":{"name":"variable","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Variable","visibility":"Public","body":"@variable"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/BaseVisitor","path":"Ameba/AST/BaseVisitor.html","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor","abstract":true,"superclass":{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},"ancestors":[{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/AST/FlowExpressionVisitor","kind":"class","full_name":"Ameba::AST::FlowExpressionVisitor","name":"FlowExpressionVisitor"},{"html_id":"ameba/Ameba/AST/NodeVisitor","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor"},{"html_id":"ameba/Ameba/AST/ScopeVisitor","kind":"class","full_name":"Ameba::AST::ScopeVisitor","name":"ScopeVisitor"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"An abstract base visitor that utilizes general logic for all visitors.","summary":"

An abstract base visitor that utilizes general logic for all visitors.

","class_methods":[],"constructors":[{"id":"new(rule,source)-class-method","html_id":"new(rule,source)-class-method","name":"new","doc":"Creates instance of this visitor.\n\n```\nvisitor = Ameba::AST::NodeVisitor.new(rule, source)\n```\n","summary":"

Creates instance of this visitor.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(rule, source)","args_html":"(rule, source)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":19,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"visit(node:Crystal::ASTNode)-instance-method","html_id":"visit(node:Crystal::ASTNode)-instance-method","name":"visit","doc":"A main visit method that accepts `Crystal::ASTNode`.\nReturns true meaning all child nodes will be traversed.","summary":"

A main visit method that accepts Crystal::ASTNode.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":25,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"true"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Branch","path":"Ameba/AST/Branch.html","kind":"class","full_name":"Ameba::AST::Branch","name":"Branch","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the branch in Crystal code.\nBranch is a part of a branchable statement.\nFor example, the branchable if statement contains 3 branches:\n\n```\nif a = something # --> Branch A\n a = 1 # --> Branch B\n put a if out # --> Branch C\nelse\n do_something a # --> Branch D\nend\n```\n","summary":"

Represents the branch in Crystal code.

","class_methods":[{"id":"of(node:Crystal::ASTNode,parent_node:Crystal::ASTNode)-class-method","html_id":"of(node:Crystal::ASTNode,parent_node:Crystal::ASTNode)-class-method","name":"of","doc":"Constructs a new branch based on the node some parent scope.\n\n```\nBranch.of(assign_node, def_node)\n```","summary":"

Constructs a new branch based on the node some parent scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","doc":null,"default_value":"","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branch.cr","line_number":66,"url":null},"def":{"name":"of","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","doc":null,"default_value":"","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(BranchVisitor.new(node)).tap(&.accept(parent_node)).branch"}},{"id":"of(node:Crystal::ASTNode,scope:Scope)-class-method","html_id":"of(node:Crystal::ASTNode,scope:Scope)-class-method","name":"of","doc":"Constructs a new branch based on the node in scope.\n\n```\nBranch.of(assign_node, scope)\n```","summary":"

Constructs a new branch based on the node in scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::ASTNode, scope : Scope)","args_html":"(node : Crystal::ASTNode, scope : Scope)","location":{"filename":"src/ameba/ast/branch.cr","line_number":57,"url":null},"def":{"name":"of","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"of(node, scope.node)"}}],"constructors":[{"id":"new(node,parent)-class-method","html_id":"new(node,parent)-class-method","name":"new","doc":"Creates a new branch.\n\n```\nBranch.new(if_node)\n```","summary":"

Creates a new branch.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":""}],"args_string":"(node, parent)","args_html":"(node, parent)","location":{"filename":"src/ameba/ast/branch.cr","line_number":33,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, parent)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"==(other:self)-instance-method","html_id":"==(other:self)-instance-method","name":"==","doc":"Returns `true` if this reference is the same as *other*. Invokes `same?`.","summary":"

Returns true if this reference is the same as other.

","abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","location":null,"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"hash(hasher)-instance-method","html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","location":null,"def":{"name":"hash","args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"id":"in_loop?-instance-method","html_id":"in_loop?-instance-method","name":"in_loop?","doc":"Returns true if current branch is in a loop, false - otherwise.\nFor example, this branch is in a loop:\n\n```\nwhile true\n handle_input # this branch is in a loop\n if wrong_input\n show_message # this branch is also in a loop.\n end\nend\n```\n","summary":"

Returns true if current branch is in a loop, false - otherwise.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/branch.cr","line_number":48,"url":null},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.loop?"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":23,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual branch node.","summary":"

The actual branch node.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/branch.cr","line_number":17,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"parent:Branchable-instance-method","html_id":"parent:Branchable-instance-method","name":"parent","doc":"The parent branchable.","summary":"

The parent branchable.

","abstract":false,"args":[],"args_string":" : Branchable","args_html":" : Branchable","location":{"filename":"src/ameba/ast/branch.cr","line_number":20,"url":null},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable","visibility":"Public","body":"@parent"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":22,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Branchable","path":"Ameba/AST/Branchable.html","kind":"class","full_name":"Ameba::AST::Branchable","name":"Branchable","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A generic entity to represent a branchable Crystal node.\nFor example, `Crystal::If`, `Crystal::Unless`, `Crystal::While`\nare branchables.\n\n```\nwhite a > 100 # Branchable A\n if b > 2 # Branchable B\n a += 1\n end\nend\n```","summary":"

A generic entity to represent a branchable Crystal node.

","class_methods":[],"constructors":[{"id":"new(node,parent=nil)-class-method","html_id":"new(node,parent=nil)-class-method","name":"new","doc":"Creates a new branchable\n\n```\nBranchable.new(node, parent_branchable)\n```","summary":"

Creates a new branchable

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"nil","external_name":"parent","restriction":""}],"args_string":"(node, parent = nil)","args_html":"(node, parent = nil)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":35,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"parent","doc":null,"default_value":"nil","external_name":"parent","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, parent)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"branches:Array(Crystal::ASTNode)-instance-method","html_id":"branches:Array(Crystal::ASTNode)-instance-method","name":"branches","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Crystal::ASTNode)","args_html":" : Array(Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":18,"url":null},"def":{"name":"branches","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@branches"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":28,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":28,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":27,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":27,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"loop?-instance-method","html_id":"loop?-instance-method","name":"loop?","doc":"Returns true if this node or one of the parent branchables is a loop, false otherwise.","summary":"

Returns true if this node or one of the parent branchables is a loop, false otherwise.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/branchable.cr","line_number":39,"url":null},"def":{"name":"loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if loop?(node)\n return true\nend\nparent.try(&.loop?) || false\n"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual Crystal node.","summary":"

The actual Crystal node.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/branchable.cr","line_number":21,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"parent:Branchable?-instance-method","html_id":"parent:Branchable?-instance-method","name":"parent","doc":"Parent branchable (if any)","summary":"

Parent branchable (if any)

","abstract":false,"args":[],"args_string":" : Branchable?","args_html":" : Branchable?","location":{"filename":"src/ameba/ast/branchable.cr","line_number":24,"url":null},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":26,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":26,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/CountingVisitor","path":"Ameba/AST/CountingVisitor.html","kind":"class","full_name":"Ameba::AST::CountingVisitor","name":"CountingVisitor","abstract":false,"superclass":{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},"ancestors":[{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"DEFAULT_COMPLEXITY","name":"DEFAULT_COMPLEXITY","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"AST Visitor that counts occurrences of certain keywords","summary":"

AST Visitor that counts occurrences of certain keywords

","class_methods":[],"constructors":[{"id":"new(scope:Crystal::ASTNode)-class-method","html_id":"new(scope:Crystal::ASTNode)-class-method","name":"new","doc":"Creates a new counting visitor","summary":"

Creates a new counting visitor

","abstract":false,"args":[{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Crystal::ASTNode"}],"args_string":"(scope : Crystal::ASTNode)","args_html":"(scope : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":8,"url":null},"def":{"name":"new","args":[{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Crystal::ASTNode"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"count-instance-method","html_id":"count-instance-method","name":"count","doc":"Returns the number of keywords that were found in the node","summary":"

Returns the number of keywords that were found in the node

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":18,"url":null},"def":{"name":"count","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@scope.accept(self)\n@complexity\n"}},{"id":"macro_condition:Bool-instance-method","html_id":"macro_condition:Bool-instance-method","name":"macro_condition","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":5,"url":null},"def":{"name":"macro_condition","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition"}},{"id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","html_id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","name":"visit","doc":null,"summary":null,"abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"args_string":"(node : Crystal::MacroIf | Crystal::MacroFor)","args_html":"(node : Crystal::MacroIf | Crystal::MacroFor)","location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":33,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition = true\n@complexity = DEFAULT_COMPLEXITY\nfalse\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/FlowExpression","path":"Ameba/AST/FlowExpression.html","kind":"class","full_name":"Ameba::AST::FlowExpression","name":"FlowExpression","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents a flow expression in Crystal code.\nFor example,\n\n```\ndef foobar\n a = 3\n return 42 # => flow expression\n a + 1\nend\n```\n\nFlow expression contains an actual node of a control expression and\na parent node, which allows easily search through the related statement\n(i.e. find unreachable code)","summary":"

Represents a flow expression in Crystal code.

","class_methods":[],"constructors":[{"id":"new(node,in_loop)-class-method","html_id":"new(node,in_loop)-class-method","name":"new","doc":"Creates a new flow expression.\n\n```\nFlowExpression.new(node, parent_node)\n```","summary":"

Creates a new flow expression.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":36,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, in_loop)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":29,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":29,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"in_loop?:Bool-instance-method","html_id":"in_loop?:Bool-instance-method","name":"in_loop?","doc":"Is true only if some of the nodes parents is a loop.","summary":"

Is true only if some of the nodes parents is a loop.

","abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":22,"url":null},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":28,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":28,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual node of the flow expression.","summary":"

The actual node of the flow expression.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":25,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":27,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":27,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"unreachable_nodes-instance-method","html_id":"unreachable_nodes-instance-method","name":"unreachable_nodes","doc":"Returns nodes which can't be reached because of a flow command inside.\nFor example:\n\n```\ndef foobar\n a = 1\n return 42\n\n a + 2 # => unreachable assign node\nend\n```","summary":"

Returns nodes which can't be reached because of a flow command inside.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":50,"url":null},"def":{"name":"unreachable_nodes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"unreachable_nodes = [] of Crystal::ASTNode\ncase current_node = node\nwhen Crystal::Expressions\n control_flow_found = false\n current_node.expressions.each do |exp|\n if control_flow_found\n unreachable_nodes << exp\n end\n control_flow_found || (control_flow_found = flow_expression?(exp, in_loop?))\n end\nwhen Crystal::BinaryOp\n if flow_expression?(current_node.left, in_loop?)\n unreachable_nodes << current_node.right\n end\nelse\nend\nunreachable_nodes\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/FlowExpressionVisitor","path":"Ameba/AST/FlowExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::FlowExpressionVisitor","name":"FlowExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"AST Visitor that traverses all the flow expressions.","summary":"

AST Visitor that traverses all the flow expressions.

","class_methods":[],"constructors":[{"id":"new(rule,source)-class-method","html_id":"new(rule,source)-class-method","name":"new","doc":"Creates a new flow expression visitor.","summary":"

Creates a new flow expression visitor.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(rule, source)","args_html":"(rule, source)","location":{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":12,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/InstanceVariable","path":"Ameba/AST/InstanceVariable.html","kind":"class","full_name":"Ameba::AST::InstanceVariable","name":"InstanceVariable","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(node)-class-method","html_id":"new(node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":10,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":6,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":6,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":5,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":5,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"name(*args,**options)-instance-method","html_id":"name(*args,**options)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":7,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options)"}},{"id":"name(*args,**options,&)-instance-method","html_id":"name(*args,**options,&)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":7,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::InstanceVar-instance-method","html_id":"node:Crystal::InstanceVar-instance-method","name":"node","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::InstanceVar","args_html":" : Crystal::InstanceVar","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":3,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/NodeVisitor","path":"Ameba/AST/NodeVisitor.html","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},"ancestors":[{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"An AST Visitor that traverses the source and allows all nodes\nto be inspected by rules.\n\n```\nvisitor = Ameba::AST::NodeVisitor.new(rule, source)\n```\n","summary":"

An AST Visitor that traverses the source and allows all nodes to be inspected by rules.

","class_methods":[],"constructors":[{"id":"new(rule,source,skip=nil)-class-method","html_id":"new(rule,source,skip=nil)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"skip","doc":null,"default_value":"nil","external_name":"skip","restriction":""}],"args_string":"(rule, source, skip = nil)","args_html":"(rule, source, skip = nil)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":42,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"skip","doc":null,"default_value":"nil","external_name":"skip","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"visit(node:Crystal::Alias)-instance-method","html_id":"visit(node:Crystal::Alias)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Alias` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Alias node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(node : Crystal::Alias)","args_html":"(node : Crystal::Alias)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Until)-instance-method","html_id":"visit(node:Crystal::Until)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Until` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Until node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(node : Crystal::Until)","args_html":"(node : Crystal::Until)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::While)-instance-method","html_id":"visit(node:Crystal::While)-instance-method","name":"visit","doc":"A visit callback for `Crystal::While` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::While node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"args_string":"(node : Crystal::While)","args_html":"(node : Crystal::While)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::When)-instance-method","html_id":"visit(node:Crystal::When)-instance-method","name":"visit","doc":"A visit callback for `Crystal::When` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::When node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"args_string":"(node : Crystal::When)","args_html":"(node : Crystal::When)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Var)-instance-method","html_id":"visit(node:Crystal::Var)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Var` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Var node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(node : Crystal::Var)","args_html":"(node : Crystal::Var)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Unless)-instance-method","html_id":"visit(node:Crystal::Unless)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Unless` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Unless node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(node : Crystal::Unless)","args_html":"(node : Crystal::Unless)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::StringInterpolation)-instance-method","html_id":"visit(node:Crystal::StringInterpolation)-instance-method","name":"visit","doc":"A visit callback for `Crystal::StringInterpolation` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::StringInterpolation node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(node : Crystal::StringInterpolation)","args_html":"(node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::NilLiteral)-instance-method","html_id":"visit(node:Crystal::NilLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::NilLiteral` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::NilLiteral node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(node : Crystal::NilLiteral)","args_html":"(node : Crystal::NilLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ModuleDef)-instance-method","html_id":"visit(node:Crystal::ModuleDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ModuleDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ModuleDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(node : Crystal::ModuleDef)","args_html":"(node : Crystal::ModuleDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::LibDef)-instance-method","html_id":"visit(node:Crystal::LibDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::LibDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::LibDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(node : Crystal::LibDef)","args_html":"(node : Crystal::LibDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::InstanceVar)-instance-method","html_id":"visit(node:Crystal::InstanceVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::InstanceVar` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::InstanceVar node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::If)-instance-method","html_id":"visit(node:Crystal::If)-instance-method","name":"visit","doc":"A visit callback for `Crystal::If` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::If node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"args_string":"(node : Crystal::If)","args_html":"(node : Crystal::If)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::HashLiteral)-instance-method","html_id":"visit(node:Crystal::HashLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::HashLiteral` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::HashLiteral node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(node : Crystal::HashLiteral)","args_html":"(node : Crystal::HashLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Expressions)-instance-method","html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Expressions` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Expressions node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(node : Crystal::Expressions)","args_html":"(node : Crystal::Expressions)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ExceptionHandler)-instance-method","html_id":"visit(node:Crystal::ExceptionHandler)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ExceptionHandler` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ExceptionHandler node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(node : Crystal::ExceptionHandler)","args_html":"(node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::EnumDef)-instance-method","html_id":"visit(node:Crystal::EnumDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::EnumDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::EnumDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(node : Crystal::EnumDef)","args_html":"(node : Crystal::EnumDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Def)-instance-method","html_id":"visit(node:Crystal::Def)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Def` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Def node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(node : Crystal::Def)","args_html":"(node : Crystal::Def)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ClassVar)-instance-method","html_id":"visit(node:Crystal::ClassVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassVar` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ClassVar node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(node : Crystal::ClassVar)","args_html":"(node : Crystal::ClassVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::ClassDef)-instance-method","html_id":"visit(node:Crystal::ClassDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassDef` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::ClassDef node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(node : Crystal::ClassDef)","args_html":"(node : Crystal::ClassDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Case)-instance-method","html_id":"visit(node:Crystal::Case)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Case` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Case node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(node : Crystal::Case)","args_html":"(node : Crystal::Case)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Block)-instance-method","html_id":"visit(node:Crystal::Block)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Block` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Block node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(node : Crystal::Block)","args_html":"(node : Crystal::Block)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Call)-instance-method","html_id":"visit(node:Crystal::Call)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Call` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Call node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(node : Crystal::Call)","args_html":"(node : Crystal::Call)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::Assign)-instance-method","html_id":"visit(node:Crystal::Assign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Assign` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::Assign node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(node : Crystal::Assign)","args_html":"(node : Crystal::Assign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node:Crystal::IsA)-instance-method","html_id":"visit(node:Crystal::IsA)-instance-method","name":"visit","doc":"A visit callback for `Crystal::IsA` node.\nReturns true meaning that child nodes will be traversed as well.","summary":"

A visit callback for Crystal::IsA node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(node : Crystal::IsA)","args_html":"(node : Crystal::IsA)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@rule.test(@source, node)\ntrue\n"}},{"id":"visit(node)-instance-method","html_id":"visit(node)-instance-method","name":"visit","doc":null,"summary":null,"abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":56,"url":null},"def":{"name":"visit","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (skip = @skip)\nelse\n return true\nend\n!(skip.includes?(node.class))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/RedundantControlExpressionVisitor","path":"Ameba/AST/RedundantControlExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::RedundantControlExpressionVisitor","name":"RedundantControlExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A class that utilizes a logic to traverse AST nodes and\nfire a source test callback if a redundant `Crystal::ControlExpression`\nis reached.","summary":"

A class that utilizes a logic to traverse AST nodes and fire a source test callback if a redundant Crystal::ControlExpression is reached.

","class_methods":[],"constructors":[{"id":"new(rule,source,node)-class-method","html_id":"new(rule,source,node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(rule, source, node)","args_html":"(rule, source, node)","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":15,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"A node to run traversal on.","summary":"

A node to run traversal on.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":13,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"rule:Rule::Base-instance-method","html_id":"rule:Rule::Base-instance-method","name":"rule","doc":"A corresponding rule that uses this visitor.","summary":"

A corresponding rule that uses this visitor.

","abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":7,"url":null},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"id":"source:Source-instance-method","html_id":"source:Source-instance-method","name":"source","doc":"A source that needs to be traversed.","summary":"

A source that needs to be traversed.

","abstract":false,"args":[],"args_string":" : Source","args_html":" : Source","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":10,"url":null},"def":{"name":"source","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Source","visibility":"Public","body":"@source"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Reference","path":"Ameba/AST/Reference.html","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/Variable","kind":"class","full_name":"Ameba::AST::Variable","name":"Variable"},"ancestors":[{"html_id":"ameba/Ameba/AST/Variable","kind":"class","full_name":"Ameba::AST::Variable","name":"Variable"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents a reference to the variable.\nIt behaves like a variable is used to distinguish a\nthe variable from its reference.","summary":"

Represents a reference to the variable.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"explicit=(explicit)-instance-method","html_id":"explicit=(explicit)-instance-method","name":"explicit=","doc":null,"summary":null,"abstract":false,"args":[{"name":"explicit","doc":null,"default_value":"","external_name":"explicit","restriction":""}],"args_string":"(explicit)","args_html":"(explicit)","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":null},"def":{"name":"explicit=","args":[{"name":"explicit","doc":null,"default_value":"","external_name":"explicit","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@explicit = explicit"}},{"id":"explicit?:Bool-instance-method","html_id":"explicit?:Bool-instance-method","name":"explicit?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":null},"def":{"name":"explicit?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@explicit"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Scope","path":"Ameba/AST/Scope.html","kind":"class","full_name":"Ameba::AST::Scope","name":"Scope","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents a context of the local variable visibility.\nThis is where the local variables belong to.","summary":"

Represents a context of the local variable visibility.

","class_methods":[],"constructors":[{"id":"new(node,outer_scope=nil)-class-method","html_id":"new(node,outer_scope=nil)-class-method","name":"new","doc":"Creates a new scope. Accepts the AST node and the outer scope.\n\n```\nscope = Scope.new(class_node, nil)\n```","summary":"

Creates a new scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"outer_scope","doc":null,"default_value":"nil","external_name":"outer_scope","restriction":""}],"args_string":"(node, outer_scope = nil)","args_html":"(node, outer_scope = nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":39,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"outer_scope","doc":null,"default_value":"nil","external_name":"outer_scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, outer_scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"==(other:self)-instance-method","html_id":"==(other:self)-instance-method","name":"==","doc":"Returns `true` if this reference is the same as *other*. Invokes `same?`.","summary":"

Returns true if this reference is the same as other.

","abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","location":null,"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"id":"add_argument(node)-instance-method","html_id":"add_argument(node)-instance-method","name":"add_argument","doc":"Creates a new argument in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_argument(arg_node)\n```","summary":"

Creates a new argument in the current scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":59,"url":null},"def":{"name":"add_argument","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"add_variable((Crystal::Var.new(node.name)).at(node))\narguments << (Argument.new(node, variables.last))\n"}},{"id":"add_ivariable(node)-instance-method","html_id":"add_ivariable(node)-instance-method","name":"add_ivariable","doc":"Adds a new instance variable to the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_ivariable(ivar_node)\n```","summary":"

Adds a new instance variable to the current scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":70,"url":null},"def":{"name":"add_ivariable","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ivariables << (InstanceVariable.new(node))"}},{"id":"add_variable(node)-instance-method","html_id":"add_variable(node)-instance-method","name":"add_variable","doc":"Creates a new variable in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_variable(var_node)\n```","summary":"

Creates a new variable in the current scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":49,"url":null},"def":{"name":"add_variable","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variables << (Variable.new(node, self))"}},{"id":"arg?(var)-instance-method","html_id":"arg?(var)-instance-method","name":"arg?","doc":"Returns true if var is an argument in current scope, false if not.","summary":"

Returns true if var is an argument in current scope, false if not.

","abstract":false,"args":[{"name":"var","doc":null,"default_value":"","external_name":"var","restriction":""}],"args_string":"(var)","args_html":"(var)","location":{"filename":"src/ameba/ast/scope.cr","line_number":155,"url":null},"def":{"name":"arg?","args":[{"name":"var","doc":null,"default_value":"","external_name":"var","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case current_node = node\nwhen Crystal::Def\n var.is_a?(Crystal::Arg) && (any_arg?(current_node.args, var))\nwhen Crystal::Block\n var.is_a?(Crystal::Var) && (any_arg?(current_node.args, var))\nwhen Crystal::ProcLiteral\n var.is_a?(Crystal::Var) && (any_arg?(current_node.def.args, var))\nelse\n false\nend"}},{"id":"arguments:Array(Ameba::AST::Argument)-instance-method","html_id":"arguments:Array(Ameba::AST::Argument)-instance-method","name":"arguments","doc":"Link to the arguments in current scope","summary":"

Link to the arguments in current scope

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Argument)","args_html":" : Array(Ameba::AST::Argument)","location":{"filename":"src/ameba/ast/scope.cr","line_number":14,"url":null},"def":{"name":"arguments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@arguments"}},{"id":"assign_variable(name,node)-instance-method","html_id":"assign_variable(name,node)-instance-method","name":"assign_variable","doc":"Creates a new assignment for the variable.\n\n```\nscope = Scope.new(class_node, nil)\nscope.assign_variable(var_name, assign_node)\n```","summary":"

Creates a new assignment for the variable.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(name, node)","args_html":"(name, node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":90,"url":null},"def":{"name":"assign_variable","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(find_variable(name)).try(&.assign(node, self))"}},{"id":"assigns_ivar?(name)-instance-method","html_id":"assigns_ivar?(name)-instance-method","name":"assigns_ivar?","doc":"Returns true instance variable assinged in this scope.","summary":"

Returns true instance variable assinged in this scope.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":119,"url":null},"def":{"name":"assigns_ivar?","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"arguments.find do |arg|\n arg.name == name\nend && ivariables.find do |var|\n var.name == \"@#{name}\"\nend"}},{"id":"block?-instance-method","html_id":"block?-instance-method","name":"block?","doc":"Returns true if current scope represents a block (or proc),\nfalse if not.","summary":"

Returns true if current scope represents a block (or proc), false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":96,"url":null},"def":{"name":"block?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::Block) || node.is_a?(Crystal::ProcLiteral)"}},{"id":"def?-instance-method","html_id":"def?-instance-method","name":"def?","doc":"Returns true if current scope is a def, false if not.","summary":"

Returns true if current scope is a def, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":145,"url":null},"def":{"name":"def?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::Def)"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":30,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":30,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"eql?(node)-instance-method","html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns true if the `node` represents exactly\nthe same Crystal node as `@node`.","summary":"

Returns true if the #node represents exactly the same Crystal node as @node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":174,"url":null},"def":{"name":"eql?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node == @node) && (!node.location.nil?)) && (node.location == @node.location)"}},{"id":"find_variable(name:String)-instance-method","html_id":"find_variable(name:String)-instance-method","name":"find_variable","doc":"Returns variable by its name or nil if it does not exist.\n\n```\nscope = Scope.new(class_node, nil)\nscope.find_variable(\"foo\")\n```","summary":"

Returns variable by its name or nil if it does not exist.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/ast/scope.cr","line_number":80,"url":null},"def":{"name":"find_variable","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variables.find do |v|\n v.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"id":"hash(hasher)-instance-method","html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","location":null,"def":{"name":"hash","args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"id":"in_macro?-instance-method","html_id":"in_macro?-instance-method","name":"in_macro?","doc":"Returns true if current scope sits inside a macro.","summary":"

Returns true if current scope sits inside a macro.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":114,"url":null},"def":{"name":"in_macro?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.is_a?(Crystal::Macro) || (!(!outer_scope.try(&.in_macro?)))"}},{"id":"inner_scopes:Array(Ameba::AST::Scope)-instance-method","html_id":"inner_scopes:Array(Ameba::AST::Scope)-instance-method","name":"inner_scopes","doc":"List of inner scopes","summary":"

List of inner scopes

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Scope)","args_html":" : Array(Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/scope.cr","line_number":23,"url":null},"def":{"name":"inner_scopes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@inner_scopes"}},{"id":"ivariables:Array(Ameba::AST::InstanceVariable)-instance-method","html_id":"ivariables:Array(Ameba::AST::InstanceVariable)-instance-method","name":"ivariables","doc":"Link to the instance variables used in current scope","summary":"

Link to the instance variables used in current scope

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::InstanceVariable)","args_html":" : Array(Ameba::AST::InstanceVariable)","location":{"filename":"src/ameba/ast/scope.cr","line_number":17,"url":null},"def":{"name":"ivariables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ivariables"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.location(*args, **options)"}},{"id":"node:Crystal::ASTNode-instance-method","html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual AST node that represents a current scope.","summary":"

The actual AST node that represents a current scope.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode","args_html":" : Crystal::ASTNode","location":{"filename":"src/ameba/ast/scope.cr","line_number":26,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"id":"outer_scope:Scope?-instance-method","html_id":"outer_scope:Scope?-instance-method","name":"outer_scope","doc":"Link to the outer scope","summary":"

Link to the outer scope

","abstract":false,"args":[],"args_string":" : Scope?","args_html":" : Scope?","location":{"filename":"src/ameba/ast/scope.cr","line_number":20,"url":null},"def":{"name":"outer_scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope | ::Nil","visibility":"Public","body":"@outer_scope"}},{"id":"references:Array(Ameba::AST::Reference)-instance-method","html_id":"references:Array(Ameba::AST::Reference)-instance-method","name":"references","doc":"Link to all variable references in currency scope","summary":"

Link to all variable references in currency scope

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Reference)","args_html":" : Array(Ameba::AST::Reference)","location":{"filename":"src/ameba/ast/scope.cr","line_number":11,"url":null},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"id":"references?(variable:Variable)-instance-method","html_id":"references?(variable:Variable)-instance-method","name":"references?","doc":"Returns true if current scope (or any of inner scopes) references variable,\nfalse if not.","summary":"

Returns true if current scope (or any of inner scopes) references variable, false if not.

","abstract":false,"args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"}],"args_string":"(variable : Variable)","args_html":"(variable : Variable)","location":{"filename":"src/ameba/ast/scope.cr","line_number":137,"url":null},"def":{"name":"references?","args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variable.references.any? do |reference|\n (reference.scope == self) || inner_scopes.any?(&.references?(variable))\nend || variable.used_in_macro?"}},{"id":"spawn_block?-instance-method","html_id":"spawn_block?-instance-method","name":"spawn_block?","doc":"Returns true if current scope represents a spawn block, e. g.\n\n```\nspawn do\n # ...\nend\n```","summary":"

Returns true if current scope represents a spawn block, e.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":107,"url":null},"def":{"name":"spawn_block?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.is_a?(Crystal::Block)\nelse\n return false\nend\ncall = (node.as(Crystal::Block)).call\ncall.try(&.name) == \"spawn\"\n"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":28,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":28,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"top_level?-instance-method","html_id":"top_level?-instance-method","name":"top_level?","doc":"Returns true if this scope is a top level scope, false if not.","summary":"

Returns true if this scope is a top level scope, false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":150,"url":null},"def":{"name":"top_level?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"outer_scope.nil?"}},{"id":"type_definition?-instance-method","html_id":"type_definition?-instance-method","name":"type_definition?","doc":"Returns true if and only if current scope represents some\ntype definition, for example a class.","summary":"

Returns true if and only if current scope represents some type definition, for example a class.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/scope.cr","line_number":126,"url":null},"def":{"name":"type_definition?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((((node.is_a?(Crystal::ClassDef) || node.is_a?(Crystal::ModuleDef)) || node.is_a?(Crystal::LibDef)) || node.is_a?(Crystal::FunDef)) || node.is_a?(Crystal::TypeDef)) || node.is_a?(Crystal::CStructOrUnionDef)"}},{"id":"variables:Array(Ameba::AST::Variable)-instance-method","html_id":"variables:Array(Ameba::AST::Variable)-instance-method","name":"variables","doc":"Link to local variables","summary":"

Link to local variables

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Variable)","args_html":" : Array(Ameba::AST::Variable)","location":{"filename":"src/ameba/ast/scope.cr","line_number":8,"url":null},"def":{"name":"variables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@variables"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/ScopeVisitor","path":"Ameba/AST/ScopeVisitor.html","kind":"class","full_name":"Ameba::AST::ScopeVisitor","name":"ScopeVisitor","abstract":false,"superclass":{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},"ancestors":[{"html_id":"ameba/Ameba/AST/BaseVisitor","kind":"class","full_name":"Ameba::AST::BaseVisitor","name":"BaseVisitor"},{"html_id":"ameba/Crystal/Visitor","kind":"class","full_name":"Crystal::Visitor","name":"Visitor"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"RECORD_NODE_NAME","name":"RECORD_NODE_NAME","value":"\"record\"","doc":null,"summary":null},{"id":"SUPER_NODE_NAME","name":"SUPER_NODE_NAME","value":"\"super\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"AST Visitor that traverses the source and constructs scopes.","summary":"

AST Visitor that traverses the source and constructs scopes.

","class_methods":[],"constructors":[{"id":"new(rule,source)-class-method","html_id":"new(rule,source)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(rule, source)","args_html":"(rule, source)","location":{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":13,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Util","path":"Ameba/AST/Util.html","kind":"module","full_name":"Ameba::AST::Util","name":"Util","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/AST/Branchable","kind":"class","full_name":"Ameba::AST::Branchable","name":"Branchable"},{"html_id":"ameba/Ameba/AST/FlowExpression","kind":"class","full_name":"Ameba::AST::FlowExpression","name":"FlowExpression"},{"html_id":"ameba/Ameba/AST/FlowExpressionVisitor","kind":"class","full_name":"Ameba::AST::FlowExpressionVisitor","name":"FlowExpressionVisitor"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"struct","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"struct","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"}],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Utility module for Ameba's rules.","summary":"

Utility module for Ameba's rules.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"abort?(node)-instance-method","html_id":"abort?(node)-instance-method","name":"abort?","doc":"Returns true if node represents `abort` method call.","summary":"

Returns true if node represents abort method call.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":141,"url":null},"def":{"name":"abort?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"abort\")) && node.args.size <= 2) && node.obj.nil?"}},{"id":"exit?(node)-instance-method","html_id":"exit?(node)-instance-method","name":"exit?","doc":"Returns true if node represents `exit` method call.","summary":"

Returns true if node represents exit method call.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":135,"url":null},"def":{"name":"exit?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"exit\")) && node.args.size <= 1) && node.obj.nil?"}},{"id":"flow_command?(node,in_loop)-instance-method","html_id":"flow_command?(node,in_loop)-instance-method","name":"flow_command?","doc":"Returns true if node is a flow command, false - otherwise.\nNode represents a flow command if it is a control expression,\nor special call node that interrupts execution (i.e. raise, exit, abort).","summary":"

Returns true if node is a flow command, false - otherwise.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/util.cr","line_number":62,"url":null},"def":{"name":"flow_command?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"","external_name":"in_loop","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case node\nwhen Crystal::Return\n true\nwhen Crystal::Break, Crystal::Next\n in_loop\nwhen Crystal::Call\n ((raise?(node)) || (exit?(node))) || (abort?(node))\nelse\n false\nend"}},{"id":"flow_expression?(node,in_loop=false)-instance-method","html_id":"flow_expression?(node,in_loop=false)-instance-method","name":"flow_expression?","doc":"Returns true if node is a flow expression, false if not.\nNode represents a flow expression if it is full-filled by a flow command.\n\nFor example, this node is a flow expression, because each branch contains\na flow command `return`:\n\n```\nif a > 0\n return :positive\nelsif a < 0\n return :negative\nelse\n return :zero\nend\n```\n\nThis node is a not a flow expression:\n\n```\nif a > 0\n return :positive\nend\n```\n\nThat's because not all branches return(i.e. `else` is missing).\n","summary":"

Returns true if node is a flow expression, false if not.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"false","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop = false)","args_html":"(node, in_loop = false)","location":{"filename":"src/ameba/ast/util.cr","line_number":101,"url":null},"def":{"name":"flow_expression?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"in_loop","doc":null,"default_value":"false","external_name":"in_loop","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if flow_command?(node, in_loop)\n return true\nend\ncase node\nwhen Crystal::If, Crystal::Unless\n flow_expressions?([node.then, node.else], in_loop)\nwhen Crystal::BinaryOp\n flow_expression?(node.left, in_loop)\nwhen Crystal::Case\n flow_expressions?([node.whens, node.else].flatten, in_loop)\nwhen Crystal::ExceptionHandler\n flow_expressions?([node.else || node.body, node.rescues].flatten, in_loop)\nwhen Crystal::While, Crystal::Until\n flow_expression?(node.body, in_loop)\nwhen Crystal::Rescue, Crystal::When\n flow_expression?(node.body, in_loop)\nwhen Crystal::Expressions\n node.expressions.any? do |exp|\n flow_expression?(exp, in_loop)\n end\nelse\n false\nend\n"}},{"id":"literal?(node)-instance-method","html_id":"literal?(node)-instance-method","name":"literal?","doc":"Returns true if current `node` is a literal, false otherwise.","summary":"

Returns true if current node is a literal, false otherwise.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":4,"url":null},"def":{"name":"literal?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case node\nwhen Crystal::NilLiteral, Crystal::BoolLiteral, Crystal::NumberLiteral, Crystal::CharLiteral, Crystal::StringLiteral, Crystal::SymbolLiteral, Crystal::RegexLiteral, Crystal::ProcLiteral, Crystal::MacroLiteral\n true\nwhen Crystal::RangeLiteral\n (literal?(node.from)) && (literal?(node.to))\nwhen Crystal::ArrayLiteral, Crystal::TupleLiteral\n node.elements.all? do |el|\n literal?(el)\n end\nwhen Crystal::HashLiteral\n node.entries.all? do |entry|\n (literal?(entry.key)) && (literal?(entry.value))\n end\nwhen Crystal::NamedTupleLiteral\n node.entries.all? do |entry|\n literal?(entry.value)\n end\nelse\n false\nend"}},{"id":"loop?(node)-instance-method","html_id":"loop?(node)-instance-method","name":"loop?","doc":"Returns true if node represents a loop.","summary":"

Returns true if node represents a loop.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":147,"url":null},"def":{"name":"loop?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case node\nwhen Crystal::While, Crystal::Until\n true\nwhen Crystal::Call\n ((node.name == \"loop\") && (node.args.size == 0)) && node.obj.nil?\nelse\n false\nend"}},{"id":"node_source(node,code_lines)-instance-method","html_id":"node_source(node,code_lines)-instance-method","name":"node_source","doc":"Returns a source code for the current node.\nThis method uses `node.location` and `node.end_location`\nto determine and cut a piece of source of the node.","summary":"

Returns a source code for the current node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"args_string":"(node, code_lines)","args_html":"(node, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":33,"url":null},"def":{"name":"node_source","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"loc, end_loc = node.location, node.end_location\nif loc && end_loc\nelse\n return\nend\nline, column = loc.line_number - 1, loc.column_number - 1\nend_line, end_column = end_loc.line_number - 1, end_loc.column_number - 1\nnode_lines = code_lines[line..end_line]\nfirst_line, last_line = node_lines[0]?, node_lines[-1]?\nif first_line.nil? || last_line.nil?\n return\nend\nif first_line.size < column\n return\nend\nnode_lines[0] = first_line.sub(0...column, \"\")\nif line == end_line\n end_column = end_column - column\n last_line = node_lines[0]\nend\nif last_line.size < (end_column + 1)\n return\nend\nnode_lines[-1] = last_line.sub((end_column + 1)...last_line.size, \"\")\nnode_lines\n"}},{"id":"raise?(node)-instance-method","html_id":"raise?(node)-instance-method","name":"raise?","doc":"Returns true if node represents `raise` method call.","summary":"

Returns true if node represents raise method call.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":129,"url":null},"def":{"name":"raise?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"raise\")) && (node.args.size == 1)) && node.obj.nil?"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/AST/Variable","path":"Ameba/AST/Variable.html","kind":"class","full_name":"Ameba::AST::Variable","name":"Variable","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/AST/Reference","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the existence of the local variable.\nHolds the var node and variable assigments.","summary":"

Represents the existence of the local variable.

","class_methods":[],"constructors":[{"id":"new(node,scope)-class-method","html_id":"new(node,scope)-class-method","name":"new","doc":"Creates a new variable(in the scope).\n\n```\nVariable.new(node, scope)\n```\n","summary":"

Creates a new variable(in the scope).

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(node, scope)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"assign(node,scope)-instance-method","html_id":"assign(node,scope)-instance-method","name":"assign","doc":"Assigns the variable (creates a new assignment).\nVariable may have multiple assignments.\n\n```\nvariable = Variable.new(node, scope)\nvariable.assign(node1)\nvariable.assign(node2)\nvariable.assignment.size # => 2\n```\n","summary":"

Assigns the variable (creates a new assignment).

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":49,"url":null},"def":{"name":"assign","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"assignments << (Assignment.new(node, self, scope))\nupdate_assign_reference!\n"}},{"id":"assign_before_reference:Crystal::ASTNode?-instance-method","html_id":"assign_before_reference:Crystal::ASTNode?-instance-method","name":"assign_before_reference","doc":"Node of the first assignment which can be available before any reference.","summary":"

Node of the first assignment which can be available before any reference.

","abstract":false,"args":[],"args_string":" : Crystal::ASTNode?","args_html":" : Crystal::ASTNode?","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":18,"url":null},"def":{"name":"assign_before_reference","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode | ::Nil","visibility":"Public","body":"@assign_before_reference"}},{"id":"assignments:Array(Ameba::AST::Assignment)-instance-method","html_id":"assignments:Array(Ameba::AST::Assignment)-instance-method","name":"assignments","doc":"List of the assigments of this variable.","summary":"

List of the assigments of this variable.

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Assignment)","args_html":" : Array(Ameba::AST::Assignment)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":6,"url":null},"def":{"name":"assignments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@assignments"}},{"id":"captured_by_block?(scope=@scope)-instance-method","html_id":"captured_by_block?(scope=@scope)-instance-method","name":"captured_by_block?","doc":"Returns true if the current var is referenced in\nin the block. For example this variable is captured\nby block:\n\n```\na = 1\n3.times { |i| a = a + i }\n```\n\nAnd this variable is not captured by block.\n\n```\ni = 1\n3.times { |i| i + 1 }\n```","summary":"

Returns true if the current var is referenced in in the block.

","abstract":false,"args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":114,"url":null},"def":{"name":"captured_by_block?","args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.inner_scopes.each do |inner_scope|\n if inner_scope.block? && (inner_scope.references?(self))\n return true\n end\n if captured_by_block?(inner_scope)\n return true\n end\nend\nfalse\n"}},{"id":"declared_before?(node)-instance-method","html_id":"declared_before?(node)-instance-method","name":"declared_before?","doc":"Returns true if the variable is delcared before the `node`.","summary":"

Returns true if the variable is delcared before the #node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":160,"url":null},"def":{"name":"declared_before?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"var_location, node_location = location, node.location\nif var_location.nil? || node_location.nil?\n return\nend\n(var_location.line_number < node_location.line_number) || ((var_location.line_number == node_location.line_number) && var_location.column_number < node_location.column_number)\n"}},{"id":"end_location(*args,**options)-instance-method","html_id":"end_location(*args,**options)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":21,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options)"}},{"id":"end_location(*args,**options,&)-instance-method","html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":21,"url":null},"def":{"name":"end_location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"eql?(node)-instance-method","html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns true if the `node` represents exactly\nthe same Crystal node as `@node`.","summary":"

Returns true if the #node represents exactly the same Crystal node as @node.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":153,"url":null},"def":{"name":"eql?","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(node.is_a?(Crystal::Var) && (node.name == @node.name)) && (node.location == @node.location)"}},{"id":"ignored?-instance-method","html_id":"ignored?-instance-method","name":"ignored?","doc":"Returns true if the name starts with '_', false if not.","summary":"

Returns true if the name starts with '_', false if not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":147,"url":null},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"id":"location(*args,**options)-instance-method","html_id":"location(*args,**options)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":20,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options)"}},{"id":"location(*args,**options,&)-instance-method","html_id":"location(*args,**options,&)-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":20,"url":null},"def":{"name":"location","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"name(*args,**options)-instance-method","html_id":"name(*args,**options)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":22,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options)"}},{"id":"name(*args,**options,&)-instance-method","html_id":"name(*args,**options,&)-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":22,"url":null},"def":{"name":"name","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"node:Crystal::Var-instance-method","html_id":"node:Crystal::Var-instance-method","name":"node","doc":"The actual var node.","summary":"

The actual var node.

","abstract":false,"args":[],"args_string":" : Crystal::Var","args_html":" : Crystal::Var","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":12,"url":null},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var","visibility":"Public","body":"@node"}},{"id":"reference(node:Crystal::Var,scope:Scope)-instance-method","html_id":"reference(node:Crystal::Var,scope:Scope)-instance-method","name":"reference","doc":"Creates a reference to this variable in some scope.\n\n```\nvariable = Variable.new(node, scope)\nvariable.reference(var_node, some_scope)\n```\n","summary":"

Creates a reference to this variable in some scope.

","abstract":false,"args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::Var, scope : Scope)","args_html":"(node : Crystal::Var, scope : Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":73,"url":null},"def":{"name":"reference","args":[{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Reference.new(node, scope)).tap do |reference|\n references << reference\n scope.references << reference\nend"}},{"id":"reference_assignments!-instance-method","html_id":"reference_assignments!-instance-method","name":"reference_assignments!","doc":"Reference variable's assignments.\n\n```\nvariable = Variable.new(node, scope)\nvariable.assign(assign_node)\nvariable.reference_assignments!\n```","summary":"

Reference variable's assignments.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":87,"url":null},"def":{"name":"reference_assignments!","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"consumed_branches = Set(Branch).new\nassignments.reverse_each do |assignment|\n if consumed_branches.includes?(assignment.branch)\n next\n end\n assignment.referenced = true\n if assignment.branch\n else\n break\n end\n consumed_branches << assignment.branch.not_nil!\nend\n"}},{"id":"referenced?-instance-method","html_id":"referenced?-instance-method","name":"referenced?","doc":"Returns true if variable has any reference.\n\n```\nvariable = Variable.new(node, scope)\nvariable.reference(var_node)\nvariable.referenced? # => true\n```","summary":"

Returns true if variable has any reference.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":62,"url":null},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"references.any?"}},{"id":"references:Array(Ameba::AST::Reference)-instance-method","html_id":"references:Array(Ameba::AST::Reference)-instance-method","name":"references","doc":"List of the references of this variable.","summary":"

List of the references of this variable.

","abstract":false,"args":[],"args_string":" : Array(Ameba::AST::Reference)","args_html":" : Array(Ameba::AST::Reference)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":9,"url":null},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"id":"scope:Scope-instance-method","html_id":"scope:Scope-instance-method","name":"scope","doc":"Scope of this variable.","summary":"

Scope of this variable.

","abstract":false,"args":[],"args_string":" : Scope","args_html":" : Scope","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":15,"url":null},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"id":"special?-instance-method","html_id":"special?-instance-method","name":"special?","doc":"Returns true if it is a special variable, i.e `$?`.","summary":"

Returns true if it is a special variable, i.e $?.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":35,"url":null},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.special_var?"}},{"id":"target_of?(assign)-instance-method","html_id":"target_of?(assign)-instance-method","name":"target_of?","doc":"Returns true if the variable is a target (on the left) of the assignment,\nfalse otherwise.","summary":"

Returns true if the variable is a target (on the left) of the assignment, false otherwise.

","abstract":false,"args":[{"name":"assign","doc":null,"default_value":"","external_name":"assign","restriction":""}],"args_string":"(assign)","args_html":"(assign)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":135,"url":null},"def":{"name":"target_of?","args":[{"name":"assign","doc":null,"default_value":"","external_name":"assign","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case assign\nwhen Crystal::Assign\n eql?(assign.target)\nwhen Crystal::OpAssign\n eql?(assign.target)\nwhen Crystal::MultiAssign\n assign.targets.any? do |t|\n eql?(t)\n end\nwhen Crystal::UninitializedVar\n eql?(assign.var)\nelse\n false\nend"}},{"id":"to_s(*args,**options)-instance-method","html_id":"to_s(*args,**options)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":23,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options)"}},{"id":"to_s(*args,**options,&)-instance-method","html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":23,"url":null},"def":{"name":"to_s","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":{"name":"options","doc":null,"default_value":"","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"id":"used_in_macro?(scope=@scope)-instance-method","html_id":"used_in_macro?(scope=@scope)-instance-method","name":"used_in_macro?","doc":"Returns true if current variable potentially referenced in a macro literal,\nfalse if not.","summary":"

Returns true if current variable potentially referenced in a macro literal, false if not.

","abstract":false,"args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":125,"url":null},"def":{"name":"used_in_macro?","args":[{"name":"scope","doc":null,"default_value":"@scope","external_name":"scope","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.inner_scopes.each do |inner_scope|\n if (MacroLiteralFinder.new(inner_scope.node)).references?(node)\n return true\n end\nend\nif (outer_scope = scope.outer_scope) && (used_in_macro?(outer_scope))\n return true\nend\nfalse\n"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Config","path":"Ameba/Config.html","kind":"class","full_name":"Ameba::Config","name":"Config","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"AVAILABLE_FORMATTERS","name":"AVAILABLE_FORMATTERS","value":"{progress: Formatter::DotFormatter, todo: Formatter::TODOFormatter, flycheck: Formatter::FlycheckFormatter, silent: Formatter::BaseFormatter, disabled: Formatter::DisabledFormatter, json: Formatter::JSONFormatter}","doc":null,"summary":null},{"id":"DEFAULT_GLOBS","name":"DEFAULT_GLOBS","value":"[\"**/*.cr\", \"!lib\"] of ::String","doc":null,"summary":null},{"id":"PATH","name":"PATH","value":"\".ameba.yml\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A configuration entry for `Ameba::Runner`.\n\nConfig can be loaded from configuration YAML file and adjusted.\n\n```\nconfig = Config.load\nconfig.formatter = my_formatter\n```\n\nBy default config loads `.ameba.yml` file in a current directory.\n","summary":"

A configuration entry for Ameba::Runner.

","class_methods":[{"id":"formatter_names-class-method","html_id":"formatter_names-class-method","name":"formatter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/config.cr","line_number":86,"url":null},"def":{"name":"formatter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AVAILABLE_FORMATTERS.keys.join(\"|\")"}},{"id":"load(path=PATH,colors=true)-class-method","html_id":"load(path=PATH,colors=true)-class-method","name":"load","doc":"Loads YAML configuration file by `path`.\n\n```\nconfig = Ameba::Config.load\n```\n","summary":"

Loads YAML configuration file by path.

","abstract":false,"args":[{"name":"path","doc":null,"default_value":"PATH","external_name":"path","restriction":""},{"name":"colors","doc":null,"default_value":"true","external_name":"colors","restriction":""}],"args_string":"(path = PATH, colors = true)","args_html":"(path = PATH, colors = true)","location":{"filename":"src/ameba/config.cr","line_number":78,"url":null},"def":{"name":"load","args":[{"name":"path","doc":null,"default_value":"PATH","external_name":"path","restriction":""},{"name":"colors","doc":null,"default_value":"true","external_name":"colors","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n Colorize.enabled = colors\n content = File.exists?(path) ? File.read(path) : \"{}\"\n Config.new(YAML.parse(content))\nrescue e\n raise(\"Config file is invalid: #{e.message}\")\nend"}}],"constructors":[],"instance_methods":[{"id":"excluded:Array(String)-instance-method","html_id":"excluded:Array(String)-instance-method","name":"excluded","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/config.cr","line_number":56,"url":null},"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String))-instance-method","html_id":"excluded=(excluded:Array(String))-instance-method","name":"excluded=","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String)"}],"args_string":"(excluded : Array(String))","args_html":"(excluded : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":56,"url":null},"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"formatter-instance-method","html_id":"formatter-instance-method","name":"formatter","doc":"Returns a formatter to be used while inspecting files.\nIf formatter is not set, it will return default formatter.\n\n```\nconfig = Ameba::Config.load\nconfig.formatter = custom_formatter\nconfig.formatter\n```\n","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/config.cr","line_number":114,"url":null},"def":{"name":"formatter","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter || (@formatter = Formatter::DotFormatter.new)"}},{"id":"formatter=(formatter:Formatter::BaseFormatter?)-instance-method","html_id":"formatter=(formatter:Formatter::BaseFormatter?)-instance-method","name":"formatter=","doc":null,"summary":null,"abstract":false,"args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter | ::Nil"}],"args_string":"(formatter : Formatter::BaseFormatter?)","args_html":"(formatter : Formatter::BaseFormatter?)","location":{"filename":"src/ameba/config.cr","line_number":34,"url":null},"def":{"name":"formatter=","args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter = formatter"}},{"id":"formatter=(name:String|Symbol)-instance-method","html_id":"formatter=(name:String|Symbol)-instance-method","name":"formatter=","doc":"Sets formatter by name.\n\n```\nconfig = Ameba::Config.load\nconfig.formatter = :progress\n```\n","summary":"

Sets formatter by name.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String | Symbol"}],"args_string":"(name : String | Symbol)","args_html":"(name : String | Symbol)","location":{"filename":"src/ameba/config.cr","line_number":125,"url":null},"def":{"name":"formatter=","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String | Symbol"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if f = AVAILABLE_FORMATTERS[name]?\n @formatter = f.new\nelse\n raise(\"Unknown formatter `#{name}`. Use one of #{Config.formatter_names}.\")\nend"}},{"id":"globs:Array(String)-instance-method","html_id":"globs:Array(String)-instance-method","name":"globs","doc":"Returns a list of paths (with wildcards) to files.\nRepresents a list of sources to be inspected.\nIf globs are not set, it will return default list of files.\n\n```\nconfig = Ameba::Config.load\nconfig.globs = [\"**/*.cr\"]\nconfig.globs\n```","summary":"

Returns a list of paths (with wildcards) to files.

","abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/config.cr","line_number":47,"url":null},"def":{"name":"globs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@globs"}},{"id":"globs=(globs:Array(String))-instance-method","html_id":"globs=(globs:Array(String))-instance-method","name":"globs=","doc":"Returns a list of paths (with wildcards) to files.\nRepresents a list of sources to be inspected.\nIf globs are not set, it will return default list of files.\n\n```\nconfig = Ameba::Config.load\nconfig.globs = [\"**/*.cr\"]\nconfig.globs\n```","summary":"

Returns a list of paths (with wildcards) to files.

","abstract":false,"args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":"Array(String)"}],"args_string":"(globs : Array(String))","args_html":"(globs : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":47,"url":null},"def":{"name":"globs=","args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@globs = globs"}},{"id":"rules:Array(Rule::Base)-instance-method","html_id":"rules:Array(Rule::Base)-instance-method","name":"rules","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Rule::Base)","args_html":" : Array(Rule::Base)","location":{"filename":"src/ameba/config.cr","line_number":35,"url":null},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":{"filename":"src/ameba/config.cr","line_number":36,"url":null},"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":{"filename":"src/ameba/config.cr","line_number":36,"url":null},"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"sources-instance-method","html_id":"sources-instance-method","name":"sources","doc":"Returns a list of sources matching globs and excluded sections.\n\n```\nconfig = Ameba::Config.load\nconfig.sources # => list of default sources\nconfig.globs = [\"**/*.cr\"]\nconfig.excluded = [\"spec\"]\nconfig.sources # => list of sources pointing to files found by the wildcards\n```\n","summary":"

Returns a list of sources matching globs and excluded sections.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/config.cr","line_number":100,"url":null},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((find_files_by_globs(globs)) - (find_files_by_globs(excluded))).map do |path|\n Source.new(File.read(path), path)\nend"}},{"id":"update_rule(name,enabled=true,excluded=nil)-instance-method","html_id":"update_rule(name,enabled=true,excluded=nil)-instance-method","name":"update_rule","doc":"Updates rule properties.\n\n```\nconfig = Ameba::Config.load\nconfig.update_rule \"MyRuleName\", enabled: false\n```\n","summary":"

Updates rule properties.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"enabled","doc":null,"default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","doc":null,"default_value":"nil","external_name":"excluded","restriction":""}],"args_string":"(name, enabled = true, excluded = nil)","args_html":"(name, enabled = true, excluded = nil)","location":{"filename":"src/ameba/config.cr","line_number":140,"url":null},"def":{"name":"update_rule","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":""},{"name":"enabled","doc":null,"default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","doc":null,"default_value":"nil","external_name":"excluded","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"index = @rules.index do |r|\n r.name == name\nend\nif index\nelse\n raise(ArgumentError.new(\"Rule `#{name}` does not exist\"))\nend\nrule = @rules[index]\nrule.enabled = enabled\nrule.excluded = excluded\n@rules[index] = rule\n"}},{"id":"update_rules(names,**args)-instance-method","html_id":"update_rules(names,**args)-instance-method","name":"update_rules","doc":"Updates rules properties.\n\n```\nconfig = Ameba::Config.load\nconfig.update_rules %w(Rule1 Rule2), enabled: true\n```\n\nalso it allows to update groups of rules:\n\n```\nconfig.update_rules %w(Group1 Group2), enabled: true\n```\n","summary":"

Updates rules properties.

","abstract":false,"args":[{"name":"names","doc":null,"default_value":"","external_name":"names","restriction":""}],"args_string":"(names, **args)","args_html":"(names, **args)","location":{"filename":"src/ameba/config.cr","line_number":163,"url":null},"def":{"name":"update_rules","args":[{"name":"names","doc":null,"default_value":"","external_name":"names","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"names.try(&.each do |name|\n if group = @rule_groups[name]?\n group.each do |rule|\n update_rule(rule.name, **args)\n end\n else\n update_rule(name, **args)\n end\nend)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter","path":"Ameba/Formatter.html","kind":"module","full_name":"Ameba::Formatter","name":"Formatter","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes Ameba's formatters.","summary":"

A module that utilizes Ameba's formatters.

","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","path":"Ameba/Formatter/BaseFormatter.html","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/Formatter/DisabledFormatter","kind":"class","full_name":"Ameba::Formatter::DisabledFormatter","name":"DisabledFormatter"},{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},{"html_id":"ameba/Ameba/Formatter/FlycheckFormatter","kind":"class","full_name":"Ameba::Formatter::FlycheckFormatter","name":"FlycheckFormatter"},{"html_id":"ameba/Ameba/Formatter/JSONFormatter","kind":"class","full_name":"Ameba::Formatter::JSONFormatter","name":"JSONFormatter"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A base formatter for all formatters. It uses `output` IO\nto report results and also implements stub methods for\ncallbacks in `Ameba::Runner#run` method.","summary":"

A base formatter for all formatters.

","class_methods":[],"constructors":[{"id":"new(output=STDOUT)-class-method","html_id":"new(output=STDOUT)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(output = STDOUT)","args_html":"(output = STDOUT)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":13,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"config:Hash(Symbol,Bool|String)-instance-method","html_id":"config:Hash(Symbol,Bool|String)-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Hash(Symbol, Bool | String)","args_html":" : Hash(Symbol, Bool | String)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":11,"url":null},"def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config"}},{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Callback that indicates when inspection is finished.\nA list of inspected sources is passed as an argument.","summary":"

Callback that indicates when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":30,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"output:IO::FileDescriptor|IO::Memory-instance-method","html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":"TODO: allow other IOs","summary":"

TODO allow other IOs

","abstract":false,"args":[],"args_string":" : IO::FileDescriptor | IO::Memory","args_html":" : IO::FileDescriptor | IO::Memory","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":10,"url":null},"def":{"name":"output","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}},{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":22,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"source_started(source:Source)-instance-method","html_id":"source_started(source:Source)-instance-method","name":"source_started","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":26,"url":null},"def":{"name":"source_started","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"started(sources)-instance-method","html_id":"started(sources)-instance-method","name":"started","doc":"Callback that indicates when inspecting is started.\nA list of sources to inspect is passed as an argument.","summary":"

Callback that indicates when inspecting is started.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":18,"url":null},"def":{"name":"started","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/DisabledFormatter","path":"Ameba/Formatter/DisabledFormatter.html","kind":"class","full_name":"Ameba::Formatter::DisabledFormatter","name":"DisabledFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that shows all disabled lines by inline directives.","summary":"

A formatter that shows all disabled lines by inline directives.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Callback that indicates when inspection is finished.\nA list of inspected sources is passed as an argument.","summary":"

Callback that indicates when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":4,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"output << \"Disabled rules using inline directives: \\n\\n\"\nsources.each do |source|\n source.issues.select(&.disabled?).each do |e|\n if loc = e.location\n output << (\"#{source.path}:#{loc.line_number}\".colorize(:cyan))\n output << \" #{e.rule.name}\\n\"\n end\n end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/DotFormatter","path":"Ameba/Formatter/DotFormatter.html","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"},{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/Formatter/TODOFormatter","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that shows a progress of inspection in a terminal using dots.\nIt is similar to Crystal's dot formatter for specs.","summary":"

A formatter that shows a progress of inspection in a terminal using dots.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Reports a message when inspection is finished.","summary":"

Reports a message when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":26,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"output.flush\noutput << \"\\n\\n\"\nshow_affected_code = !config[:without_affected_code]?\nfailed_sources = sources.reject(&.valid?)\nfailed_sources.each do |source|\n source.issues.each do |issue|\n if issue.disabled?\n next\n end\n if ( location = issue.location).nil?\n next\n end\n output << (\"#{location}\\n\".colorize(:cyan))\n output << (\"[#{issue.rule.severity.symbol}] #{issue.rule.name}: #{issue.message}\\n\".colorize(:red))\n if show_affected_code && (code = affected_code(source, location))\n output << (code.colorize(:default))\n end\n output << \"\\n\"\n end\nend\noutput << (finished_in_message(@started_at, Time.utc))\noutput << (final_message(sources, failed_sources))\n"}},{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Reports a result of the inspection of a corresponding source.","summary":"

Reports a result of the inspection of a corresponding source.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":20,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"sym = source.valid? ? \".\".colorize(:green) : \"F\".colorize(:red)\n@mutex.synchronize do\n output << sym\nend\n"}},{"id":"started(sources)-instance-method","html_id":"started(sources)-instance-method","name":"started","doc":"Reports a message when inspection is started.","summary":"

Reports a message when inspection is started.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":13,"url":null},"def":{"name":"started","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@started_at = Time.utc\noutput << (started_message(sources.size))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/ExplainFormatter","path":"Ameba/Formatter/ExplainFormatter.html","kind":"class","full_name":"Ameba::Formatter::ExplainFormatter","name":"ExplainFormatter","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"HEADING","name":"HEADING","value":"\"## \"","doc":null,"summary":null},{"id":"LINE_BREAK","name":"LINE_BREAK","value":"\"\\n\"","doc":null,"summary":null},{"id":"PREFIX","name":"PREFIX","value":"\" \"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that shows the detailed explanation of the issue at\na specific location.","summary":"

A formatter that shows the detailed explanation of the issue at a specific location.

","class_methods":[],"constructors":[{"id":"new(output,loc)-class-method","html_id":"new(output,loc)-class-method","name":"new","doc":"Creates a new instance of ExplainFormatter.\nAccepts *output* which indicates the io where the explanation will be wrtitten to.\nSecond argument is *location* which indicates the location to explain.\n\n```\nExplainFormatter.new output,\n {file: path, line: line_number, column: column_number}\n```\n","summary":"

Creates a new instance of ExplainFormatter.

","abstract":false,"args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""}],"args_string":"(output, loc)","args_html":"(output, loc)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":25,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output, loc)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Reports the explainations at the *@location*.","summary":"

Reports the explainations at the @location.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":30,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source = sources.find do |s|\n s.path == @location.filename\nend\nif source\nelse\n return\nend\nsource.issues.each do |issue|\n if ((location = issue.location) && (location.line_number == @location.line_number)) && (location.column_number == @location.column_number)\n explain(source, issue)\n end\nend\n"}},{"id":"location:Crystal::Location-instance-method","html_id":"location:Crystal::Location-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::Location","args_html":" : Crystal::Location","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":14,"url":null},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"id":"output:IO::FileDescriptor|IO::Memory-instance-method","html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : IO::FileDescriptor | IO::Memory","args_html":" : IO::FileDescriptor | IO::Memory","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":13,"url":null},"def":{"name":"output","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/FlycheckFormatter","path":"Ameba/Formatter/FlycheckFormatter.html","kind":"class","full_name":"Ameba::Formatter::FlycheckFormatter","name":"FlycheckFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":5,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.issues.each do |e|\n if e.disabled?\n next\n end\n if loc = e.location\n @mutex.synchronize do\n output.printf(\"%s:%d:%d: %s: [%s] %s\\n\", source.path, loc.line_number, loc.column_number, e.rule.severity.symbol, e.rule.name, e.message.gsub(\"\\n\", \" \"))\n end\n end\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/JSONFormatter","path":"Ameba/Formatter/JSONFormatter.html","kind":"class","full_name":"Ameba::Formatter::JSONFormatter","name":"JSONFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that produces the result in a json format.\n\nExample:\n\n```\n{\n \"metadata\": {\n \"ameba_version\": \"x.x.x\",\n \"crystal_version\": \"x.x.x\",\n },\n \"sources\": [\n {\n \"issues\": [\n {\n \"location\": {\n \"column\": 7,\n \"line\": 17,\n },\n \"end_location\": {\n \"column\": 20,\n \"line\": 17,\n },\n \"message\": \"Useless assignment to variable `a`\",\n \"rule_name\": \"UselessAssign\",\n \"severity\": \"Convention\",\n },\n {\n \"location\": {\n \"column\": 7,\n \"line\": 18,\n },\n \"end_location\": {\n \"column\": 8,\n \"line\": 18,\n },\n \"message\": \"Useless assignment to variable `a`\",\n \"rule_name\": \"UselessAssign\",\n },\n {\n \"location\": {\n \"column\": 7,\n \"line\": 19,\n },\n \"end_location\": {\n \"column\": 9,\n \"line\": 19,\n },\n \"message\": \"Useless assignment to variable `a`\",\n \"rule_name\": \"UselessAssign\",\n \"severity\": \"Convention\",\n },\n ],\n \"path\": \"src/ameba/formatter/json_formatter.cr\",\n },\n ],\n \"summary\": {\n \"issues_count\": 3,\n \"target_sources_count\": 1,\n },\n}\n```\n","summary":"

A formatter that produces the result in a json format.

","class_methods":[],"constructors":[{"id":"new(output=STDOUT)-class-method","html_id":"new(output=STDOUT)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(output = STDOUT)","args_html":"(output = STDOUT)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":67,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Callback that indicates when inspection is finished.\nA list of inspected sources is passed as an argument.","summary":"

Callback that indicates when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":87,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@result.to_json(@output)"}},{"id":"source_finished(source:Source)-instance-method","html_id":"source_finished(source:Source)-instance-method","name":"source_finished","doc":"Callback that indicates when source inspection is finished.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is finished.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":75,"url":null},"def":{"name":"source_finished","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"json_source = AsJSON::Source.new(source.path)\nsource.issues.each do |e|\n if e.disabled?\n next\n end\n json_source.issues << (AsJSON::Issue.new(e.rule.name, e.rule.severity.to_s, e.location, e.end_location, e.message))\n __temp_28 = @result.summary\n __temp_28.issues_count = __temp_28.issues_count + 1\nend\n@result.sources << json_source\n"}},{"id":"started(sources)-instance-method","html_id":"started(sources)-instance-method","name":"started","doc":"Callback that indicates when inspecting is started.\nA list of sources to inspect is passed as an argument.","summary":"

Callback that indicates when inspecting is started.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":71,"url":null},"def":{"name":"started","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@result.summary.target_sources_count = sources.size"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/TODOFormatter","path":"Ameba/Formatter/TODOFormatter.html","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},"ancestors":[{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"},{"html_id":"ameba/Ameba/Formatter/BaseFormatter","kind":"class","full_name":"Ameba::Formatter::BaseFormatter","name":"BaseFormatter"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":"A formatter that creates a todo config.\nBasically, it takes all issues reported and disables corresponding rules\nor excludes failed sources from these rules.","summary":"

A formatter that creates a todo config.

","class_methods":[],"constructors":[{"id":"new(output=STDOUT)-class-method","html_id":"new(output=STDOUT)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(output = STDOUT)","args_html":"(output = STDOUT)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":6,"url":null},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"finished(sources)-instance-method","html_id":"finished(sources)-instance-method","name":"finished","doc":"Reports a message when inspection is finished.","summary":"

Reports a message when inspection is finished.

","abstract":false,"args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":9,"url":null},"def":{"name":"finished","args":[{"name":"sources","doc":null,"default_value":"","external_name":"sources","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"super(sources)\nissues = sources.map(&.issues).flatten\nif issues.any? do |issue|\n !issue.disabled?\nend\nelse\n @output << \"No issues found. File is not generated.\\n\"\n return\nend\nif issues.any? do |issue|\n issue.syntax?\nend\n @output << \"Unable to generate TODO file. Please fix syntax issues.\\n\"\n return\nend\nfile = generate_todo_config(issues)\n@output << \"Created #{file.path}\\n\"\nfile\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Formatter/Util","path":"Ameba/Formatter/Util.html","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Formatter/DotFormatter","kind":"class","full_name":"Ameba::Formatter::DotFormatter","name":"DotFormatter"},{"html_id":"ameba/Ameba/Formatter/ExplainFormatter","kind":"class","full_name":"Ameba::Formatter::ExplainFormatter","name":"ExplainFormatter"}],"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"affected_code(source,location,max_length=100,placeholder="...",prompt=">")-instance-method","html_id":"affected_code(source,location,max_length=100,placeholder="...",prompt=">")-instance-method","name":"affected_code","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"max_length","doc":null,"default_value":"100","external_name":"max_length","restriction":""},{"name":"placeholder","doc":null,"default_value":"\" ...\"","external_name":"placeholder","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(source, location, max_length = 100, placeholder = " ...", prompt = "> ")","args_html":"(source, location, max_length = 100, placeholder = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":3,"url":null},"def":{"name":"affected_code","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"max_length","doc":null,"default_value":"100","external_name":"max_length","restriction":""},{"name":"placeholder","doc":null,"default_value":"\" ...\"","external_name":"placeholder","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"line, column = location.line_number, location.column_number\naffected_line = source.lines[line - 1]?\nif affected_line.nil? || affected_line.strip.empty?\n return\nend\nif affected_line.size > max_length && column < max_length\n affected_line = affected_line[0, (max_length - placeholder.size) - 1] + placeholder\nend\nstripped = affected_line.lstrip\nposition = (column - (affected_line.size - stripped.size)) + prompt.size\nString.build do |str|\n ((str << prompt) << stripped) << \"\\n\"\n str << (\" \" * (position - 1))\n str << (\"^\".colorize(:yellow))\nend\n"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/GlobUtils","path":"Ameba/GlobUtils.html","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Config","kind":"class","full_name":"Ameba::Config","name":"Config"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Helper module that is utilizes helpers for working with globs.","summary":"

Helper module that is utilizes helpers for working with globs.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"expand(globs)-instance-method","html_id":"expand(globs)-instance-method","name":"expand","doc":"Expands globs. Globs can point to files or even directories.\n\n```\nexpand([\"spec/*.cr\", \"src\"]) # => all files in src folder + first level specs\n```\n","summary":"

Expands globs.

","abstract":false,"args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":24,"url":null},"def":{"name":"expand","args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"globs.map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.flatten.uniq!"}},{"id":"find_files_by_globs(globs)-instance-method","html_id":"find_files_by_globs(globs)-instance-method","name":"find_files_by_globs","doc":"Returns all files that match specified globs.\nGlobs can have wildcards or be rejected:\n\n```\nfind_files_by_globs([\"**/*.cr\", \"!lib\"])\n```\n","summary":"

Returns all files that match specified globs.

","abstract":false,"args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":11,"url":null},"def":{"name":"find_files_by_globs","args":[{"name":"globs","doc":null,"default_value":"","external_name":"globs","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"rejected = rejected_globs(globs)\nselected = globs - rejected\n(expand(selected)) - (expand(rejected.map! do |p|\n p[1..-1]\nend))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/InlineComments","path":"Ameba/InlineComments.html","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"COMMENT_DIRECTIVE_REGEX","name":"COMMENT_DIRECTIVE_REGEX","value":"/# ameba:(?\\w+) (?\\w+(?:\\/\\w+)?(?:,? \\w+(?:\\/\\w+)?)*)/","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes inline comments parsing and processing logic.","summary":"

A module that utilizes inline comments parsing and processing logic.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"comment?(line_number:Int32)-instance-method","html_id":"comment?(line_number:Int32)-instance-method","name":"comment?","doc":"Returns true if the line at the given `line_number` is a comment.","summary":"

Returns true if the line at the given line_number is a comment.

","abstract":false,"args":[{"name":"line_number","doc":null,"default_value":"","external_name":"line_number","restriction":"Int32"}],"args_string":"(line_number : Int32)","args_html":"(line_number : Int32)","location":{"filename":"src/ameba/inline_comments.cr","line_number":80,"url":null},"def":{"name":"comment?","args":[{"name":"line_number","doc":null,"default_value":"","external_name":"line_number","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if line = lines[line_number]?\n comment?(line)\nend"}},{"id":"location_disabled?(location,rule)-instance-method","html_id":"location_disabled?(location,rule)-instance-method","name":"location_disabled?","doc":"Returns true if current location is disabled for a particular rule,\nfalse otherwise.\n\nLocation is disabled in two cases:\n 1. The line of the location ends with a comment directive.\n 2. The line above the location is a comment directive.\n\nFor example, here are two examples of disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\nTime.epoch(1483859302)\n\nTime.epoch(1483859302) # ameba:disable Style/LargeNumbers\n```\n\nBut here are examples which are not considered as disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\n#\nTime.epoch(1483859302)\n\nif use_epoch? # ameba:disable Style/LargeNumbers\n Time.epoch(1483859302)\nend\n```\n","summary":"

Returns true if current location is disabled for a particular rule, false otherwise.

","abstract":false,"args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""}],"args_string":"(location, rule)","args_html":"(location, rule)","location":{"filename":"src/ameba/inline_comments.cr","line_number":40,"url":null},"def":{"name":"location_disabled?","args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if Rule::SPECIAL.includes?(rule.name)\n return false\nend\nif line_number = location.try do |__arg0|\n __arg0.line_number.try(&.-(1))\nend\nelse\n return false\nend\nif line = lines[line_number]?\nelse\n return false\nend\n(line_disabled?(line, rule)) || (((line_number > 0 && (prev_line = lines[line_number - 1])) && (comment?(prev_line))) && (line_disabled?(prev_line, rule)))\n"}},{"id":"parse_inline_directive(line)-instance-method","html_id":"parse_inline_directive(line)-instance-method","name":"parse_inline_directive","doc":"Parses inline comment directive. Returns a tuple that consists of\nan action and parsed rules if directive found, nil otherwise.\n\n```\nline = \"# ameba:disable Rule1, Rule2\"\ndirective = parse_inline_directive(line)\ndirective[:action] # => \"disable\"\ndirective[:rules] # => [\"Rule1\", \"Rule2\"]\n```\n\nIt ignores the directive if it is commented out.\n\n```\nline = \"# # ameba:disable Rule1, Rule2\"\nparse_inline_directive(line) # => nil\n```\n","summary":"

Parses inline comment directive.

","abstract":false,"args":[{"name":"line","doc":null,"default_value":"","external_name":"line","restriction":""}],"args_string":"(line)","args_html":"(line)","location":{"filename":"src/ameba/inline_comments.cr","line_number":69,"url":null},"def":{"name":"parse_inline_directive","args":[{"name":"line","doc":null,"default_value":"","external_name":"line","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if directive = COMMENT_DIRECTIVE_REGEX.match(line)\n if commented_out?(line.gsub(directive[0], \"\"))\n return\n end\n {action: directive[\"action\"], rules: directive[\"rules\"].split(/[\\s,]/, remove_empty: true)}\nend"}}],"macros":[],"types":[{"html_id":"ameba/Ameba/InlineComments/Action","path":"Ameba/InlineComments/Action.html","kind":"enum","full_name":"Ameba::InlineComments::Action","name":"Action","abstract":false,"superclass":null,"ancestors":[{"html_id":"ameba/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"ameba/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Disable","name":"Disable","value":"0","doc":null,"summary":null},{"id":"Enable","name":"Enable","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},"doc":"Available actions in the inline comments","summary":"

Available actions in the inline comments

","class_methods":[],"constructors":[],"instance_methods":[{"id":"disable?-instance-method","html_id":"disable?-instance-method","name":"disable?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/inline_comments.cr","line_number":8,"url":null},"def":{"name":"disable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disable"}},{"id":"enable?-instance-method","html_id":"enable?-instance-method","name":"enable?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/inline_comments.cr","line_number":9,"url":null},"def":{"name":"enable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Enable"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Issue","path":"Ameba/Issue.html","kind":"struct","full_name":"Ameba::Issue","name":"Issue","abstract":false,"superclass":{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents an issue reported by Ameba.","summary":"

Represents an issue reported by Ameba.

","class_methods":[],"constructors":[{"id":"new(rule:Rule::Base,location:Crystal::Location?,end_location:Crystal::Location?,message:String,status:Symbol?)-class-method","html_id":"new(rule:Rule::Base,location:Crystal::Location?,end_location:Crystal::Location?,message:String,status:Symbol?)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":"Rule::Base"},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"},{"name":"status","doc":null,"default_value":"","external_name":"status","restriction":"Symbol | ::Nil"}],"args_string":"(rule : Rule::Base, location : Crystal::Location?, end_location : Crystal::Location?, message : String, status : Symbol?)","args_html":"(rule : Rule::Base, location : Crystal::Location?, end_location : Crystal::Location?, message : String, status : Symbol?)","location":{"filename":"src/ameba/issue.cr","line_number":3,"url":null},"def":{"name":"new","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":"Rule::Base"},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"},{"name":"status","doc":null,"default_value":"","external_name":"status","restriction":"Symbol | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rule, location, end_location, message, status)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"clone-instance-method","html_id":"clone-instance-method","name":"clone","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":3,"url":null},"def":{"name":"clone","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(@rule.clone, @location.clone, @end_location.clone, @message.clone, @status.clone)"}},{"id":"copy_with(rule_rule=@rule,location_location=@location,end_location_end_location=@end_location,message_message=@message,status_status=@status)-instance-method","html_id":"copy_with(rule_rule=@rule,location_location=@location,end_location_end_location=@end_location,message_message=@message,status_status=@status)-instance-method","name":"copy_with","doc":null,"summary":null,"abstract":false,"args":[{"name":"_rule","doc":null,"default_value":"@rule","external_name":"rule","restriction":""},{"name":"_location","doc":null,"default_value":"@location","external_name":"location","restriction":""},{"name":"_end_location","doc":null,"default_value":"@end_location","external_name":"end_location","restriction":""},{"name":"_message","doc":null,"default_value":"@message","external_name":"message","restriction":""},{"name":"_status","doc":null,"default_value":"@status","external_name":"status","restriction":""}],"args_string":"(rule _rule = @rule, location _location = @location, end_location _end_location = @end_location, message _message = @message, status _status = @status)","args_html":"(rule _rule = @rule, location _location = @location, end_location _end_location = @end_location, message _message = @message, status _status = @status)","location":{"filename":"src/ameba/issue.cr","line_number":3,"url":null},"def":{"name":"copy_with","args":[{"name":"_rule","doc":null,"default_value":"@rule","external_name":"rule","restriction":""},{"name":"_location","doc":null,"default_value":"@location","external_name":"location","restriction":""},{"name":"_end_location","doc":null,"default_value":"@end_location","external_name":"end_location","restriction":""},{"name":"_message","doc":null,"default_value":"@message","external_name":"message","restriction":""},{"name":"_status","doc":null,"default_value":"@status","external_name":"status","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(_rule, _location, _end_location, _message, _status)"}},{"id":"disabled?-instance-method","html_id":"disabled?-instance-method","name":"disabled?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":18,"url":null},"def":{"name":"disabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"status == (:disabled)"}},{"id":"end_location:Crystal::Location?-instance-method","html_id":"end_location:Crystal::Location?-instance-method","name":"end_location","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":null,"def":{"name":"end_location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@end_location"}},{"id":"location:Crystal::Location?-instance-method","html_id":"location:Crystal::Location?-instance-method","name":"location","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":null,"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@location"}},{"id":"message:String-instance-method","html_id":"message:String-instance-method","name":"message","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"id":"rule:Rule::Base-instance-method","html_id":"rule:Rule::Base-instance-method","name":"rule","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":null,"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"id":"status:Symbol?-instance-method","html_id":"status:Symbol?-instance-method","name":"status","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Symbol?","args_html":" : Symbol?","location":null,"def":{"name":"status","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Symbol | ::Nil","visibility":"Public","body":"@status"}},{"id":"syntax?-instance-method","html_id":"syntax?-instance-method","name":"syntax?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":22,"url":null},"def":{"name":"syntax?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"rule.is_a?(Rule::Lint::Syntax)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Reportable","path":"Ameba/Reportable.html","kind":"module","full_name":"Ameba::Reportable","name":"Reportable","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a module used to report issues.","summary":"

Represents a module used to report issues.

","class_methods":[],"constructors":[],"instance_methods":[{"id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,**args)-instance-method","html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for *location* and *end_location* defined by line and column numbers.","summary":"

Adds a new issue for location and end_location defined by line and column numbers.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, **args)","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":30,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nend_location = Crystal::Location.new(path, *end_location)\nadd_issue(rule, location, end_location, message, **args)\n"}},{"id":"add_issue(rule,location,end_location,message,status=nil)-instance-method","html_id":"add_issue(rule,location,end_location,message,status=nil)-instance-method","name":"add_issue","doc":"Adds a new issue to the list of issues.","summary":"

Adds a new issue to the list of issues.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":""}],"args_string":"(rule, location, end_location, message, status = nil)","args_html":"(rule, location, end_location, message, status = nil)","location":{"filename":"src/ameba/reportable.cr","line_number":8,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"end_location","doc":null,"default_value":"","external_name":"end_location","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = :disabled)\nend\nissues << (Issue.new(rule, location, end_location, message, status))\n"}},{"id":"add_issue(rule,location:Tuple(Int32,Int32),message,**args)-instance-method","html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for *location* defined by line and column numbers.","summary":"

Adds a new issue for location defined by line and column numbers.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, location : Tuple(Int32, Int32), message, **args)","args_html":"(rule, location : Tuple(Int32, Int32), message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":24,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":"Tuple(Int32, Int32)"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, **args)\n"}},{"id":"add_issue(rule,node:Crystal::ASTNode,message,**args)-instance-method","html_id":"add_issue(rule,node:Crystal::ASTNode,message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for AST *node*.","summary":"

Adds a new issue for AST node.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, **args)","args_html":"(rule, node : Crystal::ASTNode, message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":14,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"add_issue(rule, node.location, node.end_location, message, **args)"}},{"id":"add_issue(rule,token:Crystal::Token,message,**args)-instance-method","html_id":"add_issue(rule,token:Crystal::Token,message,**args)-instance-method","name":"add_issue","doc":"Adds a new issue for Crystal *token*.","summary":"

Adds a new issue for Crystal token.

","abstract":false,"args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"Crystal::Token"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(rule, token : Crystal::Token, message, **args)","args_html":"(rule, token : Crystal::Token, message, **args)","location":{"filename":"src/ameba/reportable.cr","line_number":19,"url":null},"def":{"name":"add_issue","args":[{"name":"rule","doc":null,"default_value":"","external_name":"rule","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"Crystal::Token"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"add_issue(rule, token.location, nil, message, **args)"}},{"id":"issues-instance-method","html_id":"issues-instance-method","name":"issues","doc":"List of reported issues.","summary":"

List of reported issues.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/reportable.cr","line_number":5,"url":null},"def":{"name":"issues","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@issues"}},{"id":"valid?-instance-method","html_id":"valid?-instance-method","name":"valid?","doc":"Returns true if the list of not disabled issues is empty, false otherwise.","summary":"

Returns true if the list of not disabled issues is empty, false otherwise.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/reportable.cr","line_number":37,"url":null},"def":{"name":"valid?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"issues.reject(&.disabled?).empty?"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule","path":"Ameba/Rule.html","kind":"module","full_name":"Ameba::Rule","name":"Rule","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"SPECIAL","name":"SPECIAL","value":"[Lint::Syntax.rule_name, Lint::UnneededDisableDirective.rule_name]","doc":"List of names of the special rules, which\nbehave differently than usual rules.","summary":"

List of names of the special rules, which behave differently than usual rules.

"}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":null,"summary":null,"class_methods":[{"id":"rules-class-method","html_id":"rules-class-method","name":"rules","doc":"Returns a list of all available rules.\n\n```\nAmeba::Rule.rules # => [Rule1, Rule2, ....]\n```\n","summary":"

Returns a list of all available rules.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":194,"url":null},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Base.subclasses"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Base","path":"Ameba/Rule/Base.html","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base","abstract":true,"superclass":{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"}],"extended_modules":[],"subclasses":[{"html_id":"ameba/Ameba/Rule/Layout/LineLength","kind":"struct","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace"},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","kind":"struct","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"struct","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","kind":"struct","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"struct","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","kind":"struct","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays"},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","kind":"struct","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar"},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","kind":"struct","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber"},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","kind":"struct","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax"},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","kind":"struct","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"struct","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","kind":"struct","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","kind":"struct","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign"},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","kind":"struct","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen"},{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","kind":"struct","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity"},{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"struct","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"struct","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"struct","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"},{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","kind":"struct","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Style/IsANil","kind":"struct","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil"},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","kind":"struct","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers"},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","kind":"struct","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","kind":"struct","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","kind":"struct","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"struct","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","kind":"struct","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext"},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","kind":"struct","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn"},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","kind":"struct","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","kind":"struct","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","kind":"struct","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","kind":"struct","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue"}],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":"Represents a base of all rules. In other words, all rules\ninherits from this struct:\n\n```\nstruct MyRule < Ameba::Rule::Base\n def test(source)\n if invalid?(source)\n issue_for line, column, \"Something wrong.\"\n end\n end\n\n private def invalid?(source)\n # ...\n end\nend\n```\n\nEnforces rules to implement an abstract `#test` method which\nis designed to test the source passed in. If source has issues\nthat are tested by this rule, it should add an issue.\n","summary":"

Represents a base of all rules.

","class_methods":[{"id":"parsed_doc-class-method","html_id":"parsed_doc-class-method","name":"parsed_doc","doc":"Returns documentation for this rule if any.\n\n```\nmodule Ameba\n # This is a test rule.\n # Does nothing.\n struct MyRule < Ameba::Rule::Base\n def test(source)\n end\n end\nend\n\nMyRule.parsed_doc # => \"This is a test rule.\\nDoes nothing.\"\n```","summary":"

Returns documentation for this rule if any.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":157,"url":null},"def":{"name":"parsed_doc","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source = File.read(path_to_source_file)\nnodes = (Crystal::Parser.new(source)).tap(&.wants_doc = true).parse\ntype_name = (rule_name.split(\"/\")).last?\n(DocFinder.new(nodes, type_name)).doc\n"}}],"constructors":[{"id":"new-class-method","html_id":"new-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":30,"url":null},"def":{"name":"new","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"x = allocate\nif x.responds_to?(:finalize)\n ::GC.add_finalizer(x)\nend\nx\n"}}],"instance_methods":[{"id":"==(other)-instance-method","html_id":"==(other)-instance-method","name":"==","doc":"Returns `true` if this struct is equal to *other*.\n\nBoth structs' instance vars are compared to each other. Thus, two\nstructs are considered equal if each of their instance variables are\nequal. Subclasses should override this method to provide specific\nequality semantics.\n\n```\nstruct Point\n def initialize(@x : Int32, @y : Int32)\n end\nend\n\np1 = Point.new 1, 2\np2 = Point.new 1, 2\np3 = Point.new 3, 4\n\np1 == p2 # => true\np1 == p3 # => false\n```","summary":"

Returns true if this struct is equal to other.

","abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/rule/base.cr","line_number":113,"url":null},"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name == other.try(&.name)"}},{"id":"catch(source:Source)-instance-method","html_id":"catch(source:Source)-instance-method","name":"catch","doc":"A convenient addition to `#test` method that does the same\nbut returns a passed in `source` as an addition.\n\n```\nsource = MyRule.new.catch(source)\nsource.valid?\n```\n","summary":"

A convenient addition to #test method that does the same but returns a passed in source as an addition.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":54,"url":null},"def":{"name":"catch","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.tap do |s|\n test(s)\nend"}},{"id":"excluded?(source)-instance-method","html_id":"excluded?(source)-instance-method","name":"excluded?","doc":"Checks whether the source is excluded from this rule.\nIt searches for a path in `excluded` property which matches\nthe one of the given source.\n\n```\nmy_rule.excluded?(source) # => true or false\n```\n","summary":"

Checks whether the source is excluded from this rule.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/base.cr","line_number":95,"url":null},"def":{"name":"excluded?","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"excluded.try(&.any? do |path|\n (source.matches_path?(path)) || (Dir.glob(path)).any? do |glob|\n source.matches_path?(glob)\n end\nend)"}},{"id":"group-instance-method","html_id":"group-instance-method","name":"group","doc":"Returns a group this rule belong to.\n\n```\nstruct MyGroup::MyRule < Ameba::Rule::Base\n # ...\nend\n\nMyGroup::MyRule.new.group # => \"MyGroup\"\n```\n","summary":"

Returns a group this rule belong to.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":83,"url":null},"def":{"name":"group","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).group_name"}},{"id":"hash-instance-method","html_id":"hash-instance-method","name":"hash","doc":"Generates an `UInt64` hash value for this object.\n\nThis method must have the property that `a == b` implies `a.hash == b.hash`.\n\nThe hash value is used along with `==` by the `Hash` class to determine if two objects\nreference the same hash key.\n\nSubclasses must not override this method. Instead, they must define `hash(hasher)`,\nthough usually the macro `def_hash` can be used to generate this method.","summary":"

Generates an UInt64 hash value for this object.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":117,"url":null},"def":{"name":"hash","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.hash"}},{"id":"name-instance-method","html_id":"name-instance-method","name":"name","doc":"Returns a name of this rule, which is basically a class name.\n\n```\nstruct MyRule < Ameba::Rule::Base\n def test(source)\n end\nend\n\nMyRule.new.name # => \"MyRule\"\n```\n","summary":"

Returns a name of this rule, which is basically a class name.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":69,"url":null},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).rule_name"}},{"id":"special?-instance-method","html_id":"special?-instance-method","name":"special?","doc":"Returns true if this rule is special and behaves differently than\nusual rules.\n\n```\nmy_rule.special? # => true or false\n```\n","summary":"

Returns true if this rule is special and behaves differently than usual rules.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/rule/base.cr","line_number":109,"url":null},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"SPECIAL.includes?(name)"}},{"id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","html_id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","doc":null,"default_value":"","external_name":"opts","restriction":""}],"args_string":"(source : Source, node : Crystal::ASTNode, *opts)","args_html":"(source : Source, node : Crystal::ASTNode, *opts)","location":{"filename":"src/ameba/rule/base.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","doc":null,"default_value":"","external_name":"opts","restriction":""}],"double_splat":null,"splat_index":2,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"test(source:Source)-instance-method","html_id":"test(source:Source)-instance-method","name":"test","doc":"This method is designed to test the source passed in. If source has issues\nthat are tested by this rule, it should add an issue.\n\nBe default it uses a node visitor to traverse all the nodes in the source.\nMust be overriten for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":38,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":"Source"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::NodeVisitor.new(self, source)"}}],"macros":[{"id":"issue_for(*args)-macro","html_id":"issue_for(*args)-macro","name":"issue_for","doc":null,"summary":null,"abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","location":{"filename":"src/ameba/rule/base.cr","line_number":121,"url":null},"def":{"name":"issue_for","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"block_arg":null,"visibility":"Public","body":" source.add_issue self, \n{{ *args }}\n\n \n"}}],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout","path":"Ameba/Rule/Layout.html","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Layout/LineLength","path":"Ameba/Rule/Layout/LineLength.html","kind":"struct","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Line too long\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```\n","summary":"

A rule that disallows lines longer than #max_length number of symbols.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```\n","summary":"

A rule that disallows lines longer than #max_length number of symbols.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":12,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"max_length:Int32-instance-method","html_id":"max_length:Int32-instance-method","name":"max_length","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","args_html":" : Int32","location":null,"def":{"name":"max_length","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@max_length"}},{"id":"max_length=(max_length:Int32)-instance-method","html_id":"max_length=(max_length:Int32)-instance-method","name":"max_length=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_length","doc":null,"default_value":"","external_name":"max_length","restriction":"Int32"}],"args_string":"(max_length : Int32)","args_html":"(max_length : Int32)","location":null,"def":{"name":"max_length=","args":[{"name":"max_length","doc":null,"default_value":"","external_name":"max_length","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_length = max_length"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":21,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line.size > max_length\n else\n next\n end\n issue_for({index + 1, max_length + 1}, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","path":"Ameba/Rule/Layout/TrailingBlankLines.html","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Excessive trailing newline detected\"","doc":null,"summary":null},{"id":"MSG_FINAL_NEWLINE","name":"MSG_FINAL_NEWLINE","value":"\"Trailing newline missing\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing blank lines at the end of the source file.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing blank lines at the end of the source file.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":11,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":19,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source_lines = source.lines\nif source_lines.empty?\n return\nend\nlast_source_line = source_lines.last\nsource_lines_size = source_lines.size\nif (source_lines_size == 1) && last_source_line.empty?\n return\nend\nlast_line_not_empty = !last_source_line.empty?\nif source_lines_size >= 1 && ((source_lines.last(2)).join.strip.empty? || last_line_not_empty)\n issue_for({source_lines_size - 1, 1}, last_line_not_empty ? MSG_FINAL_NEWLINE : MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","path":"Ameba/Rule/Layout/TrailingWhitespace.html","kind":"struct","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Trailing whitespace detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing whitespaces.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing whitespaces.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing whitespaces.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```\n","summary":"

A rule that disallows trailing whitespaces.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":11,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":18,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line =~ (/\\s$/)\n else\n next\n end\n issue_for({index + 1, line.size}, MSG)\nend"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Lint","path":"Ameba/Rule/Lint.html","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","path":"Ameba/Rule/Lint/BadDirective.html","kind":"struct","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"ALL_GROUP_NAMES","name":"ALL_GROUP_NAMES","value":"Rule.rules.map(&.group_name).uniq!","doc":null,"summary":null},{"id":"ALL_RULE_NAMES","name":"ALL_RULE_NAMES","value":"Rule.rules.map(&.rule_name)","doc":null,"summary":null},{"id":"AVAILABLE_ACTIONS","name":"AVAILABLE_ACTIONS","value":"InlineComments::Action.names.map(&.downcase)","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports incorrect comment directives for Ameba.\n\nFor example, the user can mistakenly add a directive\nto disable a rule that even doesn't exist:\n\n```\n# ameba:disable BadRuleName\ndef foo\n :bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/BadDirective:\n Enabled: true\n```\n","summary":"

A rule that reports incorrect comment directives for Ameba.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports incorrect comment directives for Ameba.\n\nFor example, the user can mistakenly add a directive\nto disable a rule that even doesn't exist:\n\n```\n# ameba:disable BadRuleName\ndef foo\n :bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/BadDirective:\n Enabled: true\n```\n","summary":"

A rule that reports incorrect comment directives for Ameba.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":21,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":30,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type == (:COMMENT)\n else\n next\n end\n if directive = source.parse_inline_directive(token.value.to_s)\n else\n next\n end\n check_action(source, token, directive[:action])\n check_rules(source, token, directive[:rules])\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","path":"Ameba/Rule/Lint/ComparisonToBoolean.html","kind":"struct","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison to a boolean is pointless\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows comparison to booleans.\n\nFor example, these are considered invalid:\n\n```\nfoo == true\nbar != false\nfalse === baz\n```\n\nThis is because these expressions evaluate to `true` or `false`, so you\ncould get the same result by using either the variable directly,\nor negating the variable.\n\nYAML configuration example:\n\n```\nLint/ComparisonToBoolean:\n Enabled: true\n```\n","summary":"

A rule that disallows comparison to booleans.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows comparison to booleans.\n\nFor example, these are considered invalid:\n\n```\nfoo == true\nbar != false\nfalse === baz\n```\n\nThis is because these expressions evaluate to `true` or `false`, so you\ncould get the same result by using either the variable directly,\nor negating the variable.\n\nYAML configuration example:\n\n```\nLint/ComparisonToBoolean:\n Enabled: true\n```\n","summary":"

A rule that disallows comparison to booleans.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":31,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"comparison = ([\"==\", \"!=\", \"===\"] of ::String).includes?(node.name)\nto_boolean = node.args.first?.try do |__arg0|\n __arg0.is_a?(Crystal::BoolLiteral)\nend || node.obj.is_a?(Crystal::BoolLiteral)\nif comparison && to_boolean\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","path":"Ameba/Rule/Lint/DebuggerStatement.html","kind":"struct","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possible forgotten debugger statement detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows calls to debugger.\n\nThis is because we don't want debugger breakpoints accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebuggerStatement:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to debugger.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows calls to debugger.\n\nThis is because we don't want debugger breakpoints accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebuggerStatement:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to debugger.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":14,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":21,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if ((node.name == \"debugger\") && node.args.empty?) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","path":"Ameba/Rule/Lint/EmptyEnsure.html","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty `ensure` block detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows empty ensure statement.\n\nFor example, this is considered invalid:\n\n```\ndef some_method\n do_some_stuff\nensure\nend\n\nbegin\n do_some_stuff\nensure\nend\n```\n\nAnd it should be written as this:\n\n\n```\ndef some_method\n do_some_stuff\nensure\n do_something_else\nend\n\nbegin\n do_some_stuff\nensure\n do_something_else\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyEnsure\n Enabled: true\n```\n","summary":"

A rule that disallows empty ensure statement.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows empty ensure statement.\n\nFor example, this is considered invalid:\n\n```\ndef some_method\n do_some_stuff\nensure\nend\n\nbegin\n do_some_stuff\nensure\nend\n```\n\nAnd it should be written as this:\n\n\n```\ndef some_method\n do_some_stuff\nensure\n do_something_else\nend\n\nbegin\n do_some_stuff\nensure\n do_something_else\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyEnsure\n Enabled: true\n```\n","summary":"

A rule that disallows empty ensure statement.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":42,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ExceptionHandler)-instance-method","html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":49,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node_ensure = node.ensure\nif node_ensure.nil? || (!node_ensure.nop?)\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","path":"Ameba/Rule/Lint/EmptyExpression.html","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid empty expression %s\"","doc":null,"summary":null},{"id":"MSG_EXRS","name":"MSG_EXRS","value":"\"Avoid empty expressions\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows empty expressions.\n\nThis is considered invalid:\n\n```\nfoo = ()\n\nif ()\n bar\nend\n```\n\nAnd this is valid:\n\n```\nfoo = (some_expression)\n\nif (some_expression)\n bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyExpression:\n Enabled: true\n```\n","summary":"

A rule that disallows empty expressions.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows empty expressions.\n\nThis is considered invalid:\n\n```\nfoo = ()\n\nif ()\n bar\nend\n```\n\nAnd this is valid:\n\n```\nfoo = (some_expression)\n\nif (some_expression)\n bar\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyExpression:\n Enabled: true\n```\n","summary":"

A rule that disallows empty expressions.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::NilLiteral)-instance-method","html_id":"test(source,node:Crystal::NilLiteral)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(source, node : Crystal::NilLiteral)","args_html":"(source, node : Crystal::NilLiteral)","location":{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::NilLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"exp = (node_source(node, source.lines)).try(&.join)\nif exp.nil? || (exp == \"nil\")\n return\nend\nissue_for(node, MSG % exp)\n"}},{"id":"test(source,node:Crystal::Expressions)-instance-method","html_id":"test(source,node:Crystal::Expressions)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(source, node : Crystal::Expressions)","args_html":"(source, node : Crystal::Expressions)","location":{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":50,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Expressions"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (node.expressions.size == 1) && node.expressions.first.nop?\n issue_for(node, MSG_EXRS)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","path":"Ameba/Rule/Lint/EmptyLoop.html","kind":"struct","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty loop detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows empty loops.\n\nThis is considered invalid:\n\n```\nwhile false\nend\n\nuntil 10\nend\n\nloop do\n # nothing here\nend\n```\n\nAnd this is valid:\n\n```\na = 1\nwhile a < 10\n a += 1\nend\n\nuntil socket_opened?\nend\n\nloop do\n do_something_here\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyLoop:\n Enabled: true\n```","summary":"

A rule that disallows empty loops.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows empty loops.\n\nThis is considered invalid:\n\n```\nwhile false\nend\n\nuntil 10\nend\n\nloop do\n # nothing here\nend\n```\n\nAnd this is valid:\n\n```\na = 1\nwhile a < 10\n a += 1\nend\n\nuntil socket_opened?\nend\n\nloop do\n do_something_here\nend\n```\n\nYAML configuration example:\n\n```\nLint/EmptyLoop:\n Enabled: true\n```","summary":"

A rule that disallows empty loops.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":40,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":49,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if loop?(node)\nelse\n return\nend\ncheck_node(source, node, node.block)\n"}},{"id":"test(source,node:Crystal::While)-instance-method","html_id":"test(source,node:Crystal::While)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":55,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}},{"id":"test(source,node:Crystal::Until)-instance-method","html_id":"test(source,node:Crystal::Until)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(source, node : Crystal::Until)","args_html":"(source, node : Crystal::Until)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":59,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Until"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","path":"Ameba/Rule/Lint/HashDuplicatedKey.html","kind":"struct","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated keys in hash literal: %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows duplicated keys in hash literals.\n\nThis is considered invalid:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2, \"foo\" => 3}\n```\n\nAnd it has to written as this instead:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2}\n```\n\nYAML configuration example:\n\n```\nLint/HashDuplicatedKey:\n Enabled: true\n```\n","summary":"

A rule that disallows duplicated keys in hash literals.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows duplicated keys in hash literals.\n\nThis is considered invalid:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2, \"foo\" => 3}\n```\n\nAnd it has to written as this instead:\n\n```\nh = {\"foo\" => 1, \"bar\" => 2}\n```\n\nYAML configuration example:\n\n```\nLint/HashDuplicatedKey:\n Enabled: true\n```\n","summary":"

A rule that disallows duplicated keys in hash literals.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::HashLiteral)-instance-method","html_id":"test(source,node:Crystal::HashLiteral)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(source, node : Crystal::HashLiteral)","args_html":"(source, node : Crystal::HashLiteral)","location":{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":30,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::HashLiteral"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (keys = duplicated_keys(node.entries)).any?\nelse\n return\nend\nissue_for(node, MSG % (keys.join(\", \")))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","path":"Ameba/Rule/Lint/LiteralInCondition.html","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in conditional\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless conditional statements that contain a literal\nin place of a variable or predicate function.\n\nThis is because a conditional construct with a literal predicate will\nalways result in the same behaviour at run time, meaning it can be\nreplaced with either the body of the construct, or deleted entirely.\n\nThis is considered invalid:\n```\nif \"something\"\n :ok\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInCondition:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless conditional statements that contain a literal\nin place of a variable or predicate function.\n\nThis is because a conditional construct with a literal predicate will\nalways result in the same behaviour at run time, meaning it can be\nreplaced with either the body of the construct, or deleted entirely.\n\nThis is considered invalid:\n```\nif \"something\"\n :ok\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInCondition:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"check_node(source,node)-instance-method","html_id":"check_node(source,node)-instance-method","name":"check_node","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"args_string":"(source, node)","args_html":"(source, node)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":33,"url":null},"def":{"name":"check_node","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if literal?(node.cond)\nelse\n return\nend\nissue_for(node, MSG)\n"}},{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::If)-instance-method","html_id":"test(source,node:Crystal::If)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"args_string":"(source, node : Crystal::If)","args_html":"(source, node : Crystal::If)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":38,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::If"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::Unless)-instance-method","html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::Case)-instance-method","html_id":"test(source,node:Crystal::Case)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(source, node : Crystal::Case)","args_html":"(source, node : Crystal::Case)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Case"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","path":"Ameba/Rule/Lint/LiteralInInterpolation.html","kind":"struct","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in interpolation\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless string interpolations\nthat contain a literal value instead of a variable or function.\n\nFor example:\n\n```\n\"Hello, #{:Ary}\"\n\"There are #{4} cats\"\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInInterpolation\n Enabled: true\n```\n","summary":"

A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless string interpolations\nthat contain a literal value instead of a variable or function.\n\nFor example:\n\n```\n\"Hello, #{:Ary}\"\n\"There are #{4} cats\"\n```\n\nYAML configuration example:\n\n```\nLint/LiteralInInterpolation\n Enabled: true\n```\n","summary":"

A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":19,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::StringInterpolation)-instance-method","html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(source, node : Crystal::StringInterpolation)","args_html":"(source, node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":28,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"node.expressions.select do |e|\n (!e.is_a?(Crystal::StringLiteral)) && (literal?(e))\nend.each do |n|\n issue_for(n, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","path":"Ameba/Rule/Lint/PercentArrays.html","kind":"struct","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Symbols `%s` may be unwanted in %s array literals\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows some unwanted symbols in percent array literals.\n\nFor example, this is usually written by mistake:\n\n```\n%i(:one, :two)\n%w(\"one\", \"two\")\n```\n\nAnd the expected example is:\n\n```\n%i(one two)\n%w(one two)\n```\n\nYAML configuration example:\n\n```\nLint/PercentArrays:\n Enabled: true\n StringArrayUnwantedSymbols: ',\"'\n SymbolArrayUnwantedSymbols: ',:'\n```\n","summary":"

A rule that disallows some unwanted symbols in percent array literals.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows some unwanted symbols in percent array literals.\n\nFor example, this is usually written by mistake:\n\n```\n%i(:one, :two)\n%w(\"one\", \"two\")\n```\n\nAnd the expected example is:\n\n```\n%i(one two)\n%w(one two)\n```\n\nYAML configuration example:\n\n```\nLint/PercentArrays:\n Enabled: true\n StringArrayUnwantedSymbols: ',\"'\n SymbolArrayUnwantedSymbols: ',:'\n```\n","summary":"

A rule that disallows some unwanted symbols in percent array literals.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":27,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"string_array_unwanted_symbols:String-instance-method","html_id":"string_array_unwanted_symbols:String-instance-method","name":"string_array_unwanted_symbols","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"string_array_unwanted_symbols","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@string_array_unwanted_symbols"}},{"id":"string_array_unwanted_symbols=(string_array_unwanted_symbols:String)-instance-method","html_id":"string_array_unwanted_symbols=(string_array_unwanted_symbols:String)-instance-method","name":"string_array_unwanted_symbols=","doc":null,"summary":null,"abstract":false,"args":[{"name":"string_array_unwanted_symbols","doc":null,"default_value":"","external_name":"string_array_unwanted_symbols","restriction":"String"}],"args_string":"(string_array_unwanted_symbols : String)","args_html":"(string_array_unwanted_symbols : String)","location":null,"def":{"name":"string_array_unwanted_symbols=","args":[{"name":"string_array_unwanted_symbols","doc":null,"default_value":"","external_name":"string_array_unwanted_symbols","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@string_array_unwanted_symbols = string_array_unwanted_symbols"}},{"id":"symbol_array_unwanted_symbols:String-instance-method","html_id":"symbol_array_unwanted_symbols:String-instance-method","name":"symbol_array_unwanted_symbols","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"symbol_array_unwanted_symbols","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@symbol_array_unwanted_symbols"}},{"id":"symbol_array_unwanted_symbols=(symbol_array_unwanted_symbols:String)-instance-method","html_id":"symbol_array_unwanted_symbols=(symbol_array_unwanted_symbols:String)-instance-method","name":"symbol_array_unwanted_symbols=","doc":null,"summary":null,"abstract":false,"args":[{"name":"symbol_array_unwanted_symbols","doc":null,"default_value":"","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"args_string":"(symbol_array_unwanted_symbols : String)","args_html":"(symbol_array_unwanted_symbols : String)","location":null,"def":{"name":"symbol_array_unwanted_symbols=","args":[{"name":"symbol_array_unwanted_symbols","doc":null,"default_value":"","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@symbol_array_unwanted_symbols = symbol_array_unwanted_symbols"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"issue = start_token = nil\n(Tokenizer.new(source)).run do |token|\n case token.type\n when :STRING_ARRAY_START, :SYMBOL_ARRAY_START\n start_token = token.dup\n when :STRING\n if start_token && issue.nil?\n issue = array_entry_invalid?(token.value, start_token.not_nil!.raw)\n end\n when :STRING_ARRAY_END, :SYMBOL_ARRAY_END\n if issue\n issue_for(start_token.not_nil!, issue.not_nil!)\n end\n issue = start_token = nil\n else\n end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","path":"Ameba/Rule/Lint/RandZero.html","kind":"struct","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"%s always returns 0\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```\n","summary":"

A rule that disallows rand(0) and rand(1) calls.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```\n","summary":"

A rule that disallows rand(0) and rand(1) calls.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":26,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":33,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (((((node.name == \"rand\") && (node.args.size == 1)) && (arg = node.args.first)) && (arg.is_a?(Crystal::NumberLiteral))) && (value = arg.value)) && ((value == \"0\") || (value == \"1\"))\nelse\n return\nend\nissue_for(node, MSG % node)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","path":"Ameba/Rule/Lint/RedundantStringCoercion.html","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant use of `Object#to_s` in interpolation\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoersion\n Enabled: true\n```\n","summary":"

A rule that disallows string conversion in string interpolation, which is redundant.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoersion\n Enabled: true\n```\n","summary":"

A rule that disallows string conversion in string interpolation, which is redundant.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":24,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::StringInterpolation)-instance-method","html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(source, node : Crystal::StringInterpolation)","args_html":"(source, node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":33,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::StringInterpolation"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(string_coercion_nodes(node)).each do |n|\n issue_for(n.name_location, n.end_location, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","path":"Ameba/Rule/Lint/RedundantWithIndex.html","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n```\ncollection.each.with_index do |e|\n # ...\nend\n\ncollection.each_with_index do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithIndex:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant with_index calls.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n```\ncollection.each.with_index do |e|\n # ...\nend\n\ncollection.each_with_index do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithIndex:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant with_index calls.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":30,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":35,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"args, block = node.args, node.block\nif (args.size > 1 || block.nil?) || (with_index_arg?(block.not_nil!))\n return\nend\ncase node.name\nwhen \"with_index\"\n report(source, node, \"Remove redundant with_index\")\nwhen \"each_with_index\"\n report(source, node, \"Use each instead of each_with_index\")\nelse\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","path":"Ameba/Rule/Lint/RedundantWithObject.html","kind":"struct","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant each_with_object calls.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant each_with_object calls.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":31,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (((node.name != \"each_with_object\") || (node.args.size != 1)) || node.block.nil?) || (with_index_arg?(node.block.not_nil!))\n return\nend\nissue_for(node.name_location, node.name_end_location, \"Use each instead of each_with_object\")\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","path":"Ameba/Rule/Lint/ShadowedArgument.html","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Argument `%s` is assigned before it is used\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```\n","summary":"

A rule that disallows shadowed arguments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```\n","summary":"

A rule that disallows shadowed arguments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":39,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,scope:AST::Scope)-instance-method","html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node, scope : AST::Scope)","args_html":"(source, node, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":50,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.arguments.each do |arg|\n if assign = arg.variable.assign_before_reference\n else\n next\n end\n issue_for(assign, MSG % arg.name)\nend"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","path":"Ameba/Rule/Lint/ShadowedException.html","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Exception handler has shadowed exceptions: %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows a rescued exception that get shadowed by a\nless specific exception being rescued before a more specific\nexception is rescued.\n\nFor example, this is invalid:\n\n```\nbegin\n do_something\nrescue Exception\n handle_exception\nrescue ArgumentError\n handle_argument_error_exception\nend\n```\n\nAnd it has to be written as follows:\n\n```\nbegin\n do_something\nrescue ArgumentError\n handle_argument_error_exception\nrescue Exception\n handle_exception\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedException:\n Enabled: true\n```\n","summary":"

A rule that disallows a rescued exception that get shadowed by a less specific exception being rescued before a more specific exception is rescued.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows a rescued exception that get shadowed by a\nless specific exception being rescued before a more specific\nexception is rescued.\n\nFor example, this is invalid:\n\n```\nbegin\n do_something\nrescue Exception\n handle_exception\nrescue ArgumentError\n handle_argument_error_exception\nend\n```\n\nAnd it has to be written as follows:\n\n```\nbegin\n do_something\nrescue ArgumentError\n handle_argument_error_exception\nrescue Exception\n handle_exception\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedException:\n Enabled: true\n```\n","summary":"

A rule that disallows a rescued exception that get shadowed by a less specific exception being rescued before a more specific exception is rescued.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":37,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ExceptionHandler)-instance-method","html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":44,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if excs = node.rescues\nelse\n return\nend\nif (excs = shadowed(excs.map(&.types))).any?\n issue_for(node, MSG % (excs.join(\", \")))\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","path":"Ameba/Rule/Lint/ShadowingOuterLocalVar.html","kind":"struct","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowing outer local variable `%s`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows the usage of the same name as outer local variables\nfor block or proc arguments.\n\nFor example, this is considered incorrect:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |foo| # shadowing outer `foo`\n end\nend\n```\n\nand should be written as:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |bar|\n end\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowingOuterLocalVar:\n Enabled: true\n```\n","summary":"

A rule that disallows the usage of the same name as outer local variables for block or proc arguments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the usage of the same name as outer local variables\nfor block or proc arguments.\n\nFor example, this is considered incorrect:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |foo| # shadowing outer `foo`\n end\nend\n```\n\nand should be written as:\n\n```\ndef some_method\n foo = 1\n\n 3.times do |bar|\n end\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowingOuterLocalVar:\n Enabled: true\n```\n","summary":"

A rule that disallows the usage of the same name as outer local variables for block or proc arguments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":34,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"find_shadowing(source, scope)"}},{"id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":50,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"find_shadowing(source, scope)"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":42,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","path":"Ameba/Rule/Lint/SharedVarInFiber.html","kind":"struct","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shared variable `%s` is used in fiber\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows using shared variables in fibers,\nwhich are mutated during iterations.\n\nIn most cases it leads to unexpected behaviour and is undesired.\n\nFor example, having this example:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n spawn { channel.send n }\nend\n\n3.times { puts channel.receive } # => # 3, 3, 3\n```\n\nThe problem is there is only one shared between fibers variable `n`\nand when `channel.receive` is executed its value is `3`.\n\nTo solve this, the code above needs to be rewritten to the following:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n m = n\n spawn do { channel.send m }\nend\n\n3.times { puts channel.receive } # => # 1, 2, 3\n```\n\nThis rule is able to find the shared variables between fibers, which are mutated\nduring iterations. So it reports the issue on the first sample and passes on\nthe second one.\n\nThere are also other technics to solve the problem above which are\n[officially documented](https://crystal-lang.org/reference/guides/concurrency.html)\n\nYAML configuration example:\n\n```\nLint/SharedVarInFiber:\n Enabled: true\n```\n","summary":"

A rule that disallows using shared variables in fibers, which are mutated during iterations.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows using shared variables in fibers,\nwhich are mutated during iterations.\n\nIn most cases it leads to unexpected behaviour and is undesired.\n\nFor example, having this example:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n spawn { channel.send n }\nend\n\n3.times { puts channel.receive } # => # 3, 3, 3\n```\n\nThe problem is there is only one shared between fibers variable `n`\nand when `channel.receive` is executed its value is `3`.\n\nTo solve this, the code above needs to be rewritten to the following:\n\n```\nn = 0\nchannel = Channel(Int32).new\n\nwhile n < 3\n n = n + 1\n m = n\n spawn do { channel.send m }\nend\n\n3.times { puts channel.receive } # => # 1, 2, 3\n```\n\nThis rule is able to find the shared variables between fibers, which are mutated\nduring iterations. So it reports the issue on the first sample and passes on\nthe second one.\n\nThere are also other technics to solve the problem above which are\n[officially documented](https://crystal-lang.org/reference/guides/concurrency.html)\n\nYAML configuration example:\n\n```\nLint/SharedVarInFiber:\n Enabled: true\n```\n","summary":"

A rule that disallows using shared variables in fibers, which are mutated during iterations.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":53,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,scope:AST::Scope)-instance-method","html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node, scope : AST::Scope)","args_html":"(source, node, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":64,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if scope.spawn_block?\nelse\n return\nend\nscope.references.each do |ref|\n if ( variable = scope.find_variable(ref.name)).nil?\n next\n end\n if (variable.scope == scope) || (!(mutated_in_loop?(variable)))\n next\n end\n issue_for(ref.node, MSG % variable.name)\nend\n"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":60,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","path":"Ameba/Rule/Lint/Syntax.html","kind":"struct","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports invalid Crystal syntax.\n\nFor example, this syntax is invalid:\n\n```\ndef hello\n do_something\nrescue Exception => e\nend\n```\n\nAnd should be properly written:\n\n```\ndef hello\n do_something\nrescue e : Exception\nend\n```\n","summary":"

A rule that reports invalid Crystal syntax.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports invalid Crystal syntax.\n\nFor example, this syntax is invalid:\n\n```\ndef hello\n do_something\nrescue Exception => e\nend\n```\n\nAnd should be properly written:\n\n```\ndef hello\n do_something\nrescue e : Exception\nend\n```\n","summary":"

A rule that reports invalid Crystal syntax.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/syntax.cr","line_number":22,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Ameba::Severity","visibility":"Public","body":"@severity"}},{"id":"severity=(severity:Ameba::Severity)-instance-method","html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":"Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":"Ameba::Severity"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/syntax.cr","line_number":28,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n source.ast\nrescue e : Crystal::SyntaxException\n issue_for({e.line_number, e.column_number}, e.message.to_s)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","path":"Ameba/Rule/Lint/UnneededDisableDirective.html","kind":"struct","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unnecessary disabling of %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unneeded disable directives.\nFor example, this is considered invalid:\n\n```\n# ameba:disable Style/PredicateName\ndef comment?\n do_something\nend\n```\n\nas the predicate name is correct and the comment directive does not\nhave any effect, the snippet should be written as the following:\n\n```\ndef comment?\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnneededDisableDirective\n Enabled: true\n```\n","summary":"

A rule that reports unneeded disable directives.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unneeded disable directives.\nFor example, this is considered invalid:\n\n```\n# ameba:disable Style/PredicateName\ndef comment?\n do_something\nend\n```\n\nas the predicate name is correct and the comment directive does not\nhave any effect, the snippet should be written as the following:\n\n```\ndef comment?\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnneededDisableDirective\n Enabled: true\n```\n","summary":"

A rule that reports unneeded disable directives.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":35,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type == (:COMMENT)\n else\n next\n end\n if directive = source.parse_inline_directive(token.value.to_s)\n else\n next\n end\n if names = unneeded_disables(source, directive, token.location)\n else\n next\n end\n if names.any?\n else\n next\n end\n issue_for(token, MSG % (names.join(\", \")))\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","path":"Ameba/Rule/Lint/UnreachableCode.html","kind":"struct","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unreachable code detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unreachable code.\n\nFor example, this is considered invalid:\n\n```\ndef method(a)\n return 42\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break\n a += 1\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method(a)\n return 42 if a == 0\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break a > 3\n a += 1\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnreachableCode:\n Enabled: true\n```\n","summary":"

A rule that reports unreachable code.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unreachable code.\n\nFor example, this is considered invalid:\n\n```\ndef method(a)\n return 42\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break\n a += 1\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method(a)\n return 42 if a == 0\n a + 1\nend\n```\n\n```\na = 1\nloop do\n break a > 3\n a += 1\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnreachableCode:\n Enabled: true\n```\n","summary":"

A rule that reports unreachable code.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":45,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","html_id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"flow_expression","doc":null,"default_value":"","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"args_string":"(source, node, flow_expression : AST::FlowExpression)","args_html":"(source, node, flow_expression : AST::FlowExpression)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":58,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"flow_expression","doc":null,"default_value":"","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if unreachable_node = flow_expression.unreachable_nodes.first?\n issue_for(unreachable_node, MSG)\nend"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":54,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::FlowExpressionVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","path":"Ameba/Rule/Lint/UnusedArgument.html","kind":"struct","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unused argument `%s`. If it's necessary, use `%s` as an argument name to indicate that it won't be used.\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unused arguments.\nFor example, this is considered invalid:\n\n```\ndef method(a, b, c)\n a + b\nend\n```\nand should be written as:\n\n```\ndef method(a, b)\n a + b\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedArgument:\n Enabled: true\n IgnoreDefs: true\n IgnoreBlocks: false\n IgnoreProcs: false\n```\n","summary":"

A rule that reports unused arguments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unused arguments.\nFor example, this is considered invalid:\n\n```\ndef method(a, b, c)\n a + b\nend\n```\nand should be written as:\n\n```\ndef method(a, b)\n a + b\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedArgument:\n Enabled: true\n IgnoreDefs: true\n IgnoreBlocks: false\n IgnoreProcs: false\n```\n","summary":"

A rule that reports unused arguments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"ignore_blocks:Bool-instance-method","html_id":"ignore_blocks:Bool-instance-method","name":"ignore_blocks","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"ignore_blocks","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@ignore_blocks"}},{"id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","html_id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","name":"ignore_blocks=","doc":null,"summary":null,"abstract":false,"args":[{"name":"ignore_blocks","doc":null,"default_value":"","external_name":"ignore_blocks","restriction":"Bool"}],"args_string":"(ignore_blocks : Bool)","args_html":"(ignore_blocks : Bool)","location":null,"def":{"name":"ignore_blocks=","args":[{"name":"ignore_blocks","doc":null,"default_value":"","external_name":"ignore_blocks","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ignore_blocks = ignore_blocks"}},{"id":"ignore_defs:Bool-instance-method","html_id":"ignore_defs:Bool-instance-method","name":"ignore_defs","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"ignore_defs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"id":"ignore_defs=(ignore_defs:Bool)-instance-method","html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","doc":null,"summary":null,"abstract":false,"args":[{"name":"ignore_defs","doc":null,"default_value":"","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","location":null,"def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","doc":null,"default_value":"","external_name":"ignore_defs","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"id":"ignore_procs:Bool-instance-method","html_id":"ignore_procs:Bool-instance-method","name":"ignore_procs","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"ignore_procs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@ignore_procs"}},{"id":"ignore_procs=(ignore_procs:Bool)-instance-method","html_id":"ignore_procs=(ignore_procs:Bool)-instance-method","name":"ignore_procs=","doc":null,"summary":null,"abstract":false,"args":[{"name":"ignore_procs","doc":null,"default_value":"","external_name":"ignore_procs","restriction":"Bool"}],"args_string":"(ignore_procs : Bool)","args_html":"(ignore_procs : Bool)","location":null,"def":{"name":"ignore_procs=","args":[{"name":"ignore_procs","doc":null,"default_value":"","external_name":"ignore_procs","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ignore_procs = ignore_procs"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":44,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ignore_procs || (find_unused_arguments(source, scope))"}},{"id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":48,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ignore_blocks || (find_unused_arguments(source, scope))"}},{"id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Def, scope : AST::Scope)","args_html":"(source, node : Crystal::Def, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":52,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ignore_defs || (find_unused_arguments(source, scope))"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":40,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","path":"Ameba/Rule/Lint/UselessAssign.html","kind":"struct","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless assignment to variable `%s`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless assignments.\n\nFor example, this is considered invalid:\n\n```\ndef method\n var = 1\n do_something\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method\n var = 1\n do_something(var)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessAssign:\n Enabled: true\n```\n","summary":"

A rule that disallows useless assignments.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless assignments.\n\nFor example, this is considered invalid:\n\n```\ndef method\n var = 1\n do_something\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef method\n var = 1\n do_something(var)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessAssign:\n Enabled: true\n```\n","summary":"

A rule that disallows useless assignments.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":29,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node,scope:AST::Scope)-instance-method","html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node, scope : AST::Scope)","args_html":"(source, node, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":40,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":""},{"name":"scope","doc":null,"default_value":"","external_name":"scope","restriction":"AST::Scope"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"scope.variables.each do |var|\n if (var.captured_by_block? || var.used_in_macro?) || var.ignored?\n next\n end\n var.assignments.each do |assign|\n if assign.referenced? || assign.transformed?\n next\n end\n issue_for(assign.target_node, MSG % var.name)\n end\nend"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","path":"Ameba/Rule/Lint/UselessConditionInWhen.html","kind":"struct","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless condition in when detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows useless conditions in when clause\nwhere it is guaranteed to always return the same result.\n\nFor example, this is considered invalid:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io) if local?\nend\n```\n\nAnd has to be written as the following:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessConditionInWhen:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows useless conditions in when clause\nwhere it is guaranteed to always return the same result.\n\nFor example, this is considered invalid:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io) if local?\nend\n```\n\nAnd has to be written as the following:\n\n```\ncase\nwhen utc?\n io << \" UTC\"\nwhen local?\n Format.new(\" %:z\").format(self, io)\nend\n```\n\nYAML configuration example:\n\n```\nLint/UselessConditionInWhen:\n Enabled: true\n```\n","summary":"

A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":34,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::When)-instance-method","html_id":"test(source,node:Crystal::When)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"args_string":"(source, node : Crystal::When)","args_html":"(source, node : Crystal::When)","location":{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":54,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::When"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ConditionInWhenVisitor.new(self, source, node)"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Metrics","path":"Ameba/Rule/Metrics.html","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","path":"Ameba/Rule/Metrics/CyclomaticComplexity.html","kind":"struct","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Cyclomatic complexity too high [%d/%d]\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Metrics","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics"},"doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```\n","summary":"

A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```\n","summary":"

A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":12,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"max_complexity:Int32-instance-method","html_id":"max_complexity:Int32-instance-method","name":"max_complexity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","args_html":" : Int32","location":null,"def":{"name":"max_complexity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@max_complexity"}},{"id":"max_complexity=(max_complexity:Int32)-instance-method","html_id":"max_complexity=(max_complexity:Int32)-instance-method","name":"max_complexity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_complexity","doc":null,"default_value":"","external_name":"max_complexity","restriction":"Int32"}],"args_string":"(max_complexity : Int32)","args_html":"(max_complexity : Int32)","location":null,"def":{"name":"max_complexity=","args":[{"name":"max_complexity","doc":null,"default_value":"","external_name":"max_complexity","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_complexity = max_complexity"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":20,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"complexity = (AST::CountingVisitor.new(node)).count\nif complexity > max_complexity && (location = node.name_location)\n issue_for(location, def_name_end_location(node), MSG % {complexity, max_complexity})\nend\n"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Performance","path":"Ameba/Rule/Performance.html","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","path":"Ameba/Rule/Performance/AnyAfterFilter.html","kind":"struct","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"ANY_NAME","name":"ANY_NAME","value":"\"any?\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `#{ANY_NAME} {...}` instead of `%s {...}.#{ANY_NAME}`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of any? calls that follow filters.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of any? calls that follow filters.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"filter_names:Array(String)-instance-method","html_id":"filter_names:Array(String)-instance-method","name":"filter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"filter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@filter_names"}},{"id":"filter_names=(filter_names:Array(String))-instance-method","html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","location":null,"def":{"name":"filter_names=","args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@filter_names = filter_names"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":37,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (node.name == ANY_NAME) && (obj = node.obj)\nelse\n return\nend\nif ((node.block.nil? && obj.is_a?(Crystal::Call)) && (filter_names.includes?(obj.name))) && (!obj.block.nil?)\n issue_for(obj.name_location, node.name_end_location, MSG % obj.name)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","path":"Ameba/Rule/Performance/FirstLastAfterFilter.html","kind":"struct","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"first\", \"last\", \"first?\", \"last?\"] of ::String","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `find {...}` instead of `%s {...}.%s`\"","doc":null,"summary":null},{"id":"MSG_REVERSE","name":"MSG_REVERSE","value":"\"Use `reverse_each.find {...}` instead of `%s {...}.%s`\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```\n","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```\n","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":27,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"filter_names:Array(String)-instance-method","html_id":"filter_names:Array(String)-instance-method","name":"filter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"filter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@filter_names"}},{"id":"filter_names=(filter_names:Array(String))-instance-method","html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","location":null,"def":{"name":"filter_names=","args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@filter_names = filter_names"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":46,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (CALL_NAMES.includes?(node.name)) && (obj = node.obj)\nelse\n return\nend\nif node.args.any?\n return\nend\nif ((node.block.nil? && obj.is_a?(Crystal::Call)) && (filter_names.includes?(obj.name))) && (!obj.block.nil?)\n message = node.name.includes?(CALL_NAMES.first) ? MSG : MSG_REVERSE\n issue_for(obj.name_location, node.name_end_location, message % {obj.name, node.name})\nend\n"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":37,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor])"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","path":"Ameba/Rule/Performance/SizeAfterFilter.html","kind":"struct","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `count {...}` instead of `%s {...}.#{SIZE_NAME}`.\"","doc":null,"summary":null},{"id":"SIZE_NAME","name":"SIZE_NAME","value":"\"size\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of size calls that follow filter.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```\n","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":34,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"filter_names:Array(String)-instance-method","html_id":"filter_names:Array(String)-instance-method","name":"filter_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"filter_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@filter_names"}},{"id":"filter_names=(filter_names:Array(String))-instance-method","html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","location":null,"def":{"name":"filter_names=","args":[{"name":"filter_names","doc":null,"default_value":"","external_name":"filter_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@filter_names = filter_names"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Call)-instance-method","html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":52,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Call"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (node.name == SIZE_NAME) && (obj = node.obj)\nelse\n return\nend\nif (obj.is_a?(Crystal::Call) && (filter_names.includes?(obj.name))) && (!obj.block.nil?)\n issue_for(obj.name_location, node.name_end_location, MSG % obj.name)\nend\n"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":43,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor])"}}],"macros":[],"types":[]}]},{"html_id":"ameba/Ameba/Rule/Style","path":"Ameba/Rule/Style.html","kind":"module","full_name":"Ameba::Rule::Style","name":"Style","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","path":"Ameba/Rule/Style/ConstantNames.html","kind":"struct","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Constant name should be screaming-cased: %s, not %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces constant names to be in screaming case.\n\nFor example, these constant names are considered valid:\n\n```\nLUCKY_NUMBERS = [3, 7, 11]\nDOCUMENTATION_URL = \"http://crystal-lang.org/docs\"\n```\n\nAnd these are invalid names:\n\n```\nmyBadConstant = 1\nWrong_NAME = 2\n```\n\nYAML configuration example:\n\n```\nStyle/ConstantNames:\n Enabled: true\n```\n","summary":"

A rule that enforces constant names to be in screaming case.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces constant names to be in screaming case.\n\nFor example, these constant names are considered valid:\n\n```\nLUCKY_NUMBERS = [3, 7, 11]\nDOCUMENTATION_URL = \"http://crystal-lang.org/docs\"\n```\n\nAnd these are invalid names:\n\n```\nmyBadConstant = 1\nWrong_NAME = 2\n```\n\nYAML configuration example:\n\n```\nStyle/ConstantNames:\n Enabled: true\n```\n","summary":"

A rule that enforces constant names to be in screaming case.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/constant_names.cr","line_number":25,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Assign)-instance-method","html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/style/constant_names.cr","line_number":32,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Assign"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\n name = target.names.first\n expected = name.upcase\n if (expected == name) || (name.camelcase == name)\n return\n end\n issue_for(target, MSG % {expected, name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/IsANil","path":"Ameba/Rule/Style/IsANil.html","kind":"struct","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `nil?` instead of `is_a?(Nil)`\"","doc":null,"summary":null},{"id":"PATH_NIL_NAMES","name":"PATH_NIL_NAMES","value":"[\"Nil\"] of ::String","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a? Nil\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a? Nil\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```\n","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":23,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::IsA)-instance-method","html_id":"test(source,node:Crystal::IsA)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(source, node : Crystal::IsA)","args_html":"(source, node : Crystal::IsA)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":31,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::IsA"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.nil_check?\n return\nend\nconst = node.const\nif const.is_a?(Crystal::Path) && (const.names == PATH_NIL_NAMES)\n issue_for(const, MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","path":"Ameba/Rule/Style/LargeNumbers.html","kind":"struct","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Large numbers should be written with underscores: %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n10000\n141592654\n5.12345\n```\n\nAnd has to be rewritten as the following:\n\n```\n10_000\n141_592_654\n5.123_45\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 5 # i.e. integers higher than 9999\n```\n","summary":"

A rule that disallows usage of large numbers without underscore.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n10000\n141592654\n5.12345\n```\n\nAnd has to be rewritten as the following:\n\n```\n10_000\n141_592_654\n5.123_45\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 5 # i.e. integers higher than 9999\n```\n","summary":"

A rule that disallows usage of large numbers without underscore.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":30,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"int_min_digits:Int32-instance-method","html_id":"int_min_digits:Int32-instance-method","name":"int_min_digits","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","args_html":" : Int32","location":null,"def":{"name":"int_min_digits","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@int_min_digits"}},{"id":"int_min_digits=(int_min_digits:Int32)-instance-method","html_id":"int_min_digits=(int_min_digits:Int32)-instance-method","name":"int_min_digits=","doc":null,"summary":null,"abstract":false,"args":[{"name":"int_min_digits","doc":null,"default_value":"","external_name":"int_min_digits","restriction":"Int32"}],"args_string":"(int_min_digits : Int32)","args_html":"(int_min_digits : Int32)","location":null,"def":{"name":"int_min_digits=","args":[{"name":"int_min_digits","doc":null,"default_value":"","external_name":"int_min_digits","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@int_min_digits = int_min_digits"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source)-instance-method","html_id":"test(source)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":39,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if (token.type == (:NUMBER)) && (decimal?(token.raw))\n else\n next\n end\n parsed = parse_number(token.raw)\n if (allowed?(*parsed)) && ((expected = underscored(*parsed)) != token.raw)\n issue_for(token, MSG % expected)\n end\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","path":"Ameba/Rule/Style/MethodNames.html","kind":"struct","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Method name should be underscore-cased: %s, not %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces method names to be in underscored case.\n\nFor example, these are considered valid:\n\n```\nclass Person\n def first_name\n end\n\n def date_of_birth\n end\n\n def homepage_url\n end\nend\n```\n\nAnd these are invalid method names:\n\n```\nclass Person\n def firstName\n end\n\n def date_of_Birth\n end\n\n def homepageURL\n end\nend\n```\n\nYAML configuration example:\n\n```\nStyle/MethodNames:\n Enabled: true\n```\n","summary":"

A rule that enforces method names to be in underscored case.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces method names to be in underscored case.\n\nFor example, these are considered valid:\n\n```\nclass Person\n def first_name\n end\n\n def date_of_birth\n end\n\n def homepage_url\n end\nend\n```\n\nAnd these are invalid method names:\n\n```\nclass Person\n def firstName\n end\n\n def date_of_Birth\n end\n\n def homepageURL\n end\nend\n```\n\nYAML configuration example:\n\n```\nStyle/MethodNames:\n Enabled: true\n```\n","summary":"

A rule that enforces method names to be in underscored case.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/method_names.cr","line_number":41,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/method_names.cr","line_number":48,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (expected = node.name.underscore) == node.name\n return\nend\nline_number = node.location.try(&.line_number)\ncolumn_number = node.name_location.try(&.column_number)\nif line_number.nil? || column_number.nil?\n return\nend\nissue_for({line_number, column_number}, {line_number, (column_number + node.name.size) - 1}, MSG % {expected, node.name})\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","path":"Ameba/Rule/Style/NegatedConditionsInUnless.html","kind":"struct","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid negated conditions in unless blocks\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows negated conditions in unless.\n\nFor example, this is considered invalid:\n\n```\nunless !s.empty?\n :ok\nend\n```\n\nAnd should be rewritten to the following:\n\n```\nif s.emtpy?\n :ok\nend\n```\n\nIt is pretty difficult to wrap your head around a block of code\nthat is executed if a negated condition is NOT met.\n\nYAML configuration example:\n\n```\nStyle/NegatedConditionsInUnless:\n Enabled: true\n```\n","summary":"

A rule that disallows negated conditions in unless.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows negated conditions in unless.\n\nFor example, this is considered invalid:\n\n```\nunless !s.empty?\n :ok\nend\n```\n\nAnd should be rewritten to the following:\n\n```\nif s.emtpy?\n :ok\nend\n```\n\nIt is pretty difficult to wrap your head around a block of code\nthat is executed if a negated condition is NOT met.\n\nYAML configuration example:\n\n```\nStyle/NegatedConditionsInUnless:\n Enabled: true\n```\n","summary":"

A rule that disallows negated conditions in unless.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":30,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Unless)-instance-method","html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":37,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if negated_condition?(node.cond)\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","path":"Ameba/Rule/Style/PredicateName.html","kind":"struct","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s?' over '%s'\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows tautological predicate names, meaning those that\nstart with the prefix `has_` or the prefix `is_`. Ignores if the alternative isn't valid Crystal code (e.g. `is_404?`).\n\nFavour these:\n\n```\ndef valid?(x)\nend\n\ndef picture?(x)\nend\n```\n\nOver these:\n\n```\ndef is_valid?(x)\nend\n\ndef has_picture?(x)\nend\n```\n\nYAML configuration example:\n\n```\nStyle/PredicateName:\n Enabled: true\n```\n","summary":"

A rule that disallows tautological predicate names, meaning those that start with the prefix has_ or the prefix is_.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows tautological predicate names, meaning those that\nstart with the prefix `has_` or the prefix `is_`. Ignores if the alternative isn't valid Crystal code (e.g. `is_404?`).\n\nFavour these:\n\n```\ndef valid?(x)\nend\n\ndef picture?(x)\nend\n```\n\nOver these:\n\n```\ndef is_valid?(x)\nend\n\ndef has_picture?(x)\nend\n```\n\nYAML configuration example:\n\n```\nStyle/PredicateName:\n Enabled: true\n```\n","summary":"

A rule that disallows tautological predicate names, meaning those that start with the prefix has_ or the prefix is_.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":32,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled:Bool)-instance-method","html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":40,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.name =~ (/^(is|has)_(\\w+)\\?/)\n alternative = $~[2]\n if alternative =~ (/^[a-z][a-zA-Z_0-9]*$/)\n else\n return\n end\n issue_for(node, MSG % {alternative, node.name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","path":"Ameba/Rule/Style/RedundantBegin.html","kind":"struct","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `begin` block detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant begin blocks.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```\n","summary":"

A rule that disallows redundant begin blocks.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":59,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":67,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if redundant_begin?(source, node)\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","path":"Ameba/Rule/Style/RedundantNext.html","kind":"struct","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `next` detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant next expressions. A `next` keyword allows\na block to skip to the next iteration early, however, it is considered\nredundant in cases where it is the last expression in a block or combines\ninto the node which is the last in a block.\n\nFor example, this is considered invalid:\n\n```\nblock do |v|\n next v + 1\nend\n```\n\n```\nblock do |v|\n case v\n when .nil?\n next \"nil\"\n when .blank?\n next \"blank\"\n else\n next \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\nblock do |v|\n v + 1\nend\n```\n\n```\nblock do |v|\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwhich yield tuple literals i.e.\n\n```\nblock do\n next a, b\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n {a, b}\nend\n```\n\n2. *allow_empty_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwithout arguments. Sometimes such statements are used to yild the `nil` value explicitly.\n\n```\nblock do\n @foo = :empty\n next\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantNext:\n Enabled: true\n AllowMultiNext: true\n AllowEmptyNext: true\n```","summary":"

A rule that disallows redundant next expressions.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant next expressions. A `next` keyword allows\na block to skip to the next iteration early, however, it is considered\nredundant in cases where it is the last expression in a block or combines\ninto the node which is the last in a block.\n\nFor example, this is considered invalid:\n\n```\nblock do |v|\n next v + 1\nend\n```\n\n```\nblock do |v|\n case v\n when .nil?\n next \"nil\"\n when .blank?\n next \"blank\"\n else\n next \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\nblock do |v|\n v + 1\nend\n```\n\n```\nblock do |v|\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwhich yield tuple literals i.e.\n\n```\nblock do\n next a, b\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n {a, b}\nend\n```\n\n2. *allow_empty_next*, default: true\n\nAllows end-user to configure whether to report or not the next statements\nwithout arguments. Sometimes such statements are used to yild the `nil` value explicitly.\n\n```\nblock do\n @foo = :empty\n next\nend\n```\n\nIf this param equals to `false`, the block above will be forced to be written as:\n\n```\nblock do\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantNext:\n Enabled: true\n AllowMultiNext: true\n AllowEmptyNext: true\n```","summary":"

A rule that disallows redundant next expressions.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":99,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"allow_empty_next:Bool-instance-method","html_id":"allow_empty_next:Bool-instance-method","name":"allow_empty_next","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_empty_next","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_empty_next"}},{"id":"allow_empty_next=(allow_empty_next:Bool)-instance-method","html_id":"allow_empty_next=(allow_empty_next:Bool)-instance-method","name":"allow_empty_next=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_empty_next","doc":null,"default_value":"","external_name":"allow_empty_next","restriction":"Bool"}],"args_string":"(allow_empty_next : Bool)","args_html":"(allow_empty_next : Bool)","location":null,"def":{"name":"allow_empty_next=","args":[{"name":"allow_empty_next","doc":null,"default_value":"","external_name":"allow_empty_next","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_empty_next = allow_empty_next"}},{"id":"allow_multi_next:Bool-instance-method","html_id":"allow_multi_next:Bool-instance-method","name":"allow_multi_next","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_multi_next","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_multi_next"}},{"id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","html_id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","name":"allow_multi_next=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_multi_next","doc":null,"default_value":"","external_name":"allow_multi_next","restriction":"Bool"}],"args_string":"(allow_multi_next : Bool)","args_html":"(allow_multi_next : Bool)","location":null,"def":{"name":"allow_multi_next=","args":[{"name":"allow_multi_next","doc":null,"default_value":"","external_name":"allow_multi_next","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_multi_next = allow_multi_next"}},{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","html_id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"args_string":"(source, node : Crystal::Next, visitor : AST::RedundantControlExpressionVisitor)","args_html":"(source, node : Crystal::Next, visitor : AST::RedundantControlExpressionVisitor)","location":{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":112,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if allow_multi_next && node.exp.is_a?(Crystal::TupleLiteral)\n return\nend\nif allow_empty_next && (node.exp.nil? || node.exp.not_nil!.nop?)\n return\nend\nsource.try(&.add_issue(self, node, MSG))\n"}},{"id":"test(source,node:Crystal::Block)-instance-method","html_id":"test(source,node:Crystal::Block)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(source, node : Crystal::Block)","args_html":"(source, node : Crystal::Block)","location":{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":108,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Block"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","path":"Ameba/Rule/Style/RedundantReturn.html","kind":"struct","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `return` detected\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant return expressions.\n\nFor example, this is considered invalid:\n\n```\ndef foo\n return :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n return \"nil\"\n when .blank?\n return \"blank\"\n else\n return \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef foo\n :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwhich return tuple literals i.e.\n\n```\ndef method(a, b)\n return a, b\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method(a, b)\n {a, b}\nend\n```\n\n2. *allow_empty_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwithout arguments. Sometimes such returns are used to return the `nil` value explicitly.\n\n```\ndef method\n @foo = :empty\n return\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantReturn:\n Enabled: true\n AllowMutliReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant return expressions.\n\nFor example, this is considered invalid:\n\n```\ndef foo\n return :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n return \"nil\"\n when .blank?\n return \"blank\"\n else\n return \"empty\"\n end\nend\n```\n\nAnd has to be written as the following:\n\n```\ndef foo\n :bar\nend\n```\n\n```\ndef bar(arg)\n case arg\n when .nil?\n \"nil\"\n when .blank?\n \"blank\"\n else\n \"empty\"\n end\nend\n```\n\n### Configuration params\n\n1. *allow_multi_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwhich return tuple literals i.e.\n\n```\ndef method(a, b)\n return a, b\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method(a, b)\n {a, b}\nend\n```\n\n2. *allow_empty_return*, default: true\n\nAllows end-user to configure whether to report or not the return statements\nwithout arguments. Sometimes such returns are used to return the `nil` value explicitly.\n\n```\ndef method\n @foo = :empty\n return\nend\n```\n\nIf this param equals to `false`, the method above has to be written as:\n\n```\ndef method\n @foo = :empty\n nil\nend\n```\n\n### YAML config example\n\n```\nStyle/RedundantReturn:\n Enabled: true\n AllowMutliReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":96,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"allow_empty_return:Bool-instance-method","html_id":"allow_empty_return:Bool-instance-method","name":"allow_empty_return","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_empty_return","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_empty_return"}},{"id":"allow_empty_return=(allow_empty_return:Bool)-instance-method","html_id":"allow_empty_return=(allow_empty_return:Bool)-instance-method","name":"allow_empty_return=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_empty_return","doc":null,"default_value":"","external_name":"allow_empty_return","restriction":"Bool"}],"args_string":"(allow_empty_return : Bool)","args_html":"(allow_empty_return : Bool)","location":null,"def":{"name":"allow_empty_return=","args":[{"name":"allow_empty_return","doc":null,"default_value":"","external_name":"allow_empty_return","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_empty_return = allow_empty_return"}},{"id":"allow_multi_return:Bool-instance-method","html_id":"allow_multi_return:Bool-instance-method","name":"allow_multi_return","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"allow_multi_return","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@allow_multi_return"}},{"id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","html_id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","name":"allow_multi_return=","doc":null,"summary":null,"abstract":false,"args":[{"name":"allow_multi_return","doc":null,"default_value":"","external_name":"allow_multi_return","restriction":"Bool"}],"args_string":"(allow_multi_return : Bool)","args_html":"(allow_multi_return : Bool)","location":null,"def":{"name":"allow_multi_return=","args":[{"name":"allow_multi_return","doc":null,"default_value":"","external_name":"allow_multi_return","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@allow_multi_return = allow_multi_return"}},{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","html_id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"args_string":"(source, node : Crystal::Return, visitor : AST::RedundantControlExpressionVisitor)","args_html":"(source, node : Crystal::Return, visitor : AST::RedundantControlExpressionVisitor)","location":{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":109,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","doc":null,"default_value":"","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if allow_multi_return && node.exp.is_a?(Crystal::TupleLiteral)\n return\nend\nif allow_empty_return && (node.exp.nil? || node.exp.not_nil!.nop?)\n return\nend\nsource.try(&.add_issue(self, node, MSG))\n"}},{"id":"test(source,node:Crystal::Def)-instance-method","html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":105,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Def"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","path":"Ameba/Rule/Style/TypeNames.html","kind":"struct","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Type name should be camelcased: %s, but it was %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces type names in camelcase manner.\n\nFor example, these are considered valid:\n\n```\nclass ParseError < Exception\nend\n\nmodule HTTP\n class RequestHandler\n end\nend\n\nalias NumericValue = Float32 | Float64 | Int32 | Int64\n\nlib LibYAML\nend\n\nstruct TagDirective\nend\n\nenum Time::DayOfWeek\nend\n```\n\nAnd these are invalid type names\n\n```\nclass My_class\nend\n\nmodule HTT_p\nend\n\nalias Numeric_value = Int32\n\nlib Lib_YAML\nend\n\nstruct Tag_directive\nend\n\nenum Time_enum::Day_of_week\nend\n```\n\nYAML configuration example:\n\n```\nStyle/TypeNames:\n Enabled: true\n```\n","summary":"

A rule that enforces type names in camelcase manner.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces type names in camelcase manner.\n\nFor example, these are considered valid:\n\n```\nclass ParseError < Exception\nend\n\nmodule HTTP\n class RequestHandler\n end\nend\n\nalias NumericValue = Float32 | Float64 | Int32 | Int64\n\nlib LibYAML\nend\n\nstruct TagDirective\nend\n\nenum Time::DayOfWeek\nend\n```\n\nAnd these are invalid type names\n\n```\nclass My_class\nend\n\nmodule HTT_p\nend\n\nalias Numeric_value = Int32\n\nlib Lib_YAML\nend\n\nstruct Tag_directive\nend\n\nenum Time_enum::Day_of_week\nend\n```\n\nYAML configuration example:\n\n```\nStyle/TypeNames:\n Enabled: true\n```\n","summary":"

A rule that enforces type names in camelcase manner.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":55,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::ClassDef)-instance-method","html_id":"test(source,node:Crystal::ClassDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(source, node : Crystal::ClassDef)","args_html":"(source, node : Crystal::ClassDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":70,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::Alias)-instance-method","html_id":"test(source,node:Crystal::Alias)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(source, node : Crystal::Alias)","args_html":"(source, node : Crystal::Alias)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":74,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Alias"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::LibDef)-instance-method","html_id":"test(source,node:Crystal::LibDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(source, node : Crystal::LibDef)","args_html":"(source, node : Crystal::LibDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":78,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::LibDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::EnumDef)-instance-method","html_id":"test(source,node:Crystal::EnumDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(source, node : Crystal::EnumDef)","args_html":"(source, node : Crystal::EnumDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":82,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::EnumDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::ModuleDef)-instance-method","html_id":"test(source,node:Crystal::ModuleDef)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ModuleDef)","args_html":"(source, node : Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/style/type_names.cr","line_number":86,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ModuleDef"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","path":"Ameba/Rule/Style/UnlessElse.html","kind":"struct","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour if over unless with else\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of an else block with the unless.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of an else block with the unless.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":46,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Unless)-instance-method","html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":53,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Unless"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.else.nop?\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","path":"Ameba/Rule/Style/VariableNames.html","kind":"struct","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Var name should be underscore-cased: %s, not %s\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that enforces variable names to be in underscored case.\n\nFor example, these variable names are considered valid:\n\n```\nvar_name = 1\nname = 2\n_another_good_name = 3\n```\n\nAnd these are invalid variable names:\n\n```\nmyBadNamedVar = 1\nwrong_Name = 2\n```\n\nYAML configuration example:\n\n```\nStyle/VariableNames:\n Enabled: true\n```\n","summary":"

A rule that enforces variable names to be in underscored case.

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces variable names to be in underscored case.\n\nFor example, these variable names are considered valid:\n\n```\nvar_name = 1\nname = 2\n_another_good_name = 3\n```\n\nAnd these are invalid variable names:\n\n```\nmyBadNamedVar = 1\nwrong_Name = 2\n```\n\nYAML configuration example:\n\n```\nStyle/VariableNames:\n Enabled: true\n```\n","summary":"

A rule that enforces variable names to be in underscored case.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":26,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::Var)-instance-method","html_id":"test(source,node:Crystal::Var)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(source, node : Crystal::Var)","args_html":"(source, node : Crystal::Var)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":39,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::Var"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::InstanceVar)-instance-method","html_id":"test(source,node:Crystal::InstanceVar)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(source, node : Crystal::InstanceVar)","args_html":"(source, node : Crystal::InstanceVar)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":43,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::InstanceVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}},{"id":"test(source,node:Crystal::ClassVar)-instance-method","html_id":"test(source,node:Crystal::ClassVar)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(source, node : Crystal::ClassVar)","args_html":"(source, node : Crystal::ClassVar)","location":{"filename":"src/ameba/rule/style/variable_names.cr","line_number":47,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::ClassVar"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"check_node(source, node)"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","path":"Ameba/Rule/Style/WhileTrue.html","kind":"struct","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},"ancestors":[{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"},{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/Ameba/Rule/Base","kind":"struct","full_name":"Ameba::Rule::Base","name":"Base"},{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"While statement using true literal as condition\"","doc":null,"summary":null}],"included_modules":[{"html_id":"ameba/YAML/Serializable","kind":"module","full_name":"YAML::Serializable","name":"Serializable"},{"html_id":"ameba/YAML/Serializable/Strict","kind":"module","full_name":"YAML::Serializable::Strict","name":"Strict"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","class_methods":[],"constructors":[{"id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":null,"def":{"name":"new","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"id":"new(config=nil)-class-method","html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```\n","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":29,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"nil","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (raw = config.try(&.raw)).is_a?(Hash)\n yaml = raw[rule_name]?.try(&.to_yaml)\nend\nfrom_yaml(yaml || \"{}\")\n"}}],"instance_methods":[{"id":"description:String-instance-method","html_id":"description:String-instance-method","name":"description","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":null,"def":{"name":"description","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@description"}},{"id":"description=(description:String)-instance-method","html_id":"description=(description:String)-instance-method","name":"description=","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","location":null,"def":{"name":"description=","args":[{"name":"description","doc":null,"default_value":"","external_name":"description","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@description = description"}},{"id":"enabled:Bool-instance-method","html_id":"enabled:Bool-instance-method","name":"enabled","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"enabled","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled"}},{"id":"enabled=(enabled)-instance-method","html_id":"enabled=(enabled)-instance-method","name":"enabled=","doc":null,"summary":null,"abstract":false,"args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"args_string":"(enabled)","args_html":"(enabled)","location":null,"def":{"name":"enabled=","args":[{"name":"enabled","doc":null,"default_value":"","external_name":"enabled","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@enabled = enabled"}},{"id":"excluded:Array(String)?-instance-method","html_id":"excluded:Array(String)?-instance-method","name":"excluded","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","args_html":" : Array(String)?","location":null,"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"id":"excluded=(excluded:Array(String)?)-instance-method","html_id":"excluded=(excluded:Array(String)?)-instance-method","name":"excluded=","doc":null,"summary":null,"abstract":false,"args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String)?)","args_html":"(excluded : Array(String)?)","location":null,"def":{"name":"excluded=","args":[{"name":"excluded","doc":null,"default_value":"","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@excluded = excluded"}},{"id":"severity:Ameba::Severity-instance-method","html_id":"severity:Ameba::Severity-instance-method","name":"severity","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Ameba::Severity","args_html":" : Ameba::Severity","location":null,"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"id":"severity=(severity)-instance-method","html_id":"severity=(severity)-instance-method","name":"severity=","doc":null,"summary":null,"abstract":false,"args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"args_string":"(severity)","args_html":"(severity)","location":null,"def":{"name":"severity=","args":[{"name":"severity","doc":null,"default_value":"","external_name":"severity","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity = severity"}},{"id":"test(source,node:Crystal::While)-instance-method","html_id":"test(source,node:Crystal::While)-instance-method","name":"test","doc":null,"summary":null,"abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":36,"url":null},"def":{"name":"test","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"Crystal::While"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.cond.true_literal?\nelse\n return\nend\nissue_for(node, MSG)\n"}}],"macros":[],"types":[]}]}]},{"html_id":"ameba/Ameba/Runner","path":"Ameba/Runner.html","kind":"class","full_name":"Ameba::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a runner for inspecting sources files.\nHolds a list of rules to do inspection based on,\nlist of sources to run inspection on and a formatter\nto prepare a report.\n\n```\nconfig = Ameba::Config.load\nrunner = Ameba::Runner.new config\nrunner.run.success? # => true or false\n```\n","summary":"

Represents a runner for inspecting sources files.

","class_methods":[],"constructors":[{"id":"new(config:Config)-class-method","html_id":"new(config:Config)-class-method","name":"new","doc":"Instantiates a runner using a `config`.\n\n```\nconfig = Ameba::Config.load\nconfig.files = files\nconfig.formatter = formatter\n\nAmeba::Runner.new config\n```\n","summary":"

Instantiates a runner using a config.

","abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","args_html":"(config : Config)","location":{"filename":"src/ameba/runner.cr","line_number":42,"url":null},"def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"explain(location,output=STDOUT)-instance-method","html_id":"explain(location,output=STDOUT)-instance-method","name":"explain","doc":"Explains an issue at a specified *location*.\n\nRunner should perform inspection before doing the explain.\nThis is necessary to be able to find the issue at a specified location.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.explain({file: file, line: l, column: c})\n```\n","summary":"

Explains an issue at a specified location.

","abstract":false,"args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"args_string":"(location, output = STDOUT)","args_html":"(location, output = STDOUT)","location":{"filename":"src/ameba/runner.cr","line_number":118,"url":null},"def":{"name":"explain","args":[{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""},{"name":"output","doc":null,"default_value":"STDOUT","external_name":"output","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(Formatter::ExplainFormatter.new(output, location)).finished(@sources)"}},{"id":"run-instance-method","html_id":"run-instance-method","name":"run","doc":"Performs the inspection. Iterates through all sources and test it using\nlist of rules. If a specific rule fails on a specific source, it adds\nan issue to that source.\n\nThis action also notifies formatter when inspection is started/finished,\nand when a specific source started/finished to be inspected.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run # => returns runner again\n```\n","summary":"

Performs the inspection.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":69,"url":null},"def":{"name":"run","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n @formatter.started(@sources)\n channels = @sources.map do\n Channel(Exception | ::Nil).new\n end\n @sources.each_with_index do |source, idx|\n channel = channels[idx]\n spawn do\n begin\n run_source(source)\n rescue e\n channel.send(e)\n else\n channel.send(nil)\n end\n end\n end\n channels.each do |c|\n e = c.receive\n if e.nil?\n else\n raise(e)\n end\n end\n self\nensure\n @formatter.finished(@sources)\nend"}},{"id":"sources:Array(Source)-instance-method","html_id":"sources:Array(Source)-instance-method","name":"sources","doc":"A list of sources to run inspection on.","summary":"

A list of sources to run inspection on.

","abstract":false,"args":[],"args_string":" : Array(Source)","args_html":" : Array(Source)","location":{"filename":"src/ameba/runner.cr","line_number":18,"url":null},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Source)","visibility":"Public","body":"@sources"}},{"id":"success?-instance-method","html_id":"success?-instance-method","name":"success?","doc":"Indicates whether the last inspection successful or not.\nIt returns true if no issues matching severity in sources found, false otherwise.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.success? # => true or false\n```\n","summary":"

Indicates whether the last inspection successful or not.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":131,"url":null},"def":{"name":"success?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sources.all? do |source|\n source.issues.reject(&.disabled?).none? do |issue|\n issue.rule.severity <= @severity\n end\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Severity","path":"Ameba/Severity.html","kind":"enum","full_name":"Ameba::Severity","name":"Severity","abstract":false,"superclass":null,"ancestors":[{"html_id":"ameba/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"ameba/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"ameba/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Error","name":"Error","value":"0","doc":null,"summary":null},{"id":"Warning","name":"Warning","value":"1","doc":null,"summary":null},{"id":"Convention","name":"Convention","value":"2","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":null,"summary":null,"class_methods":[{"id":"parse(name:String)-class-method","html_id":"parse(name:String)-class-method","name":"parse","doc":"Creates Severity by the name.\n\n```\nSeverity.parse(\"convention\") # => Severity::Convention\nSeverity.parse(\"foo-bar\") # => Exception: Incorrect severity name\n```\n","summary":"

Creates Severity by the name.

","abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/severity.cr","line_number":23,"url":null},"def":{"name":"parse","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"begin\n super(name)\nrescue ArgumentError\n raise(\"Incorrect severity name #{name}. Try one of #{values}\")\nend"}}],"constructors":[],"instance_methods":[{"id":"convention?-instance-method","html_id":"convention?-instance-method","name":"convention?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":5,"url":null},"def":{"name":"convention?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Convention"}},{"id":"error?-instance-method","html_id":"error?-instance-method","name":"error?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":3,"url":null},"def":{"name":"error?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Error"}},{"id":"symbol-instance-method","html_id":"symbol-instance-method","name":"symbol","doc":"Returns a symbol uniquely indicating severity.\n\n```\nSeverity::Warning.symbol # => 'W'\n```","summary":"

Returns a symbol uniquely indicating severity.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":12,"url":null},"def":{"name":"symbol","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"to_s[0]"}},{"id":"warning?-instance-method","html_id":"warning?-instance-method","name":"warning?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/severity.cr","line_number":4,"url":null},"def":{"name":"warning?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Warning"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/SeverityYamlConverter","path":"Ameba/SeverityYamlConverter.html","kind":"class","full_name":"Ameba::SeverityYamlConverter","name":"SeverityYamlConverter","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Converter for `YAML.mapping` which converts severity enum to and from YAML.","summary":"

Converter for YAML.mapping which converts severity enum to and from YAML.

","class_methods":[{"id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","html_id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"from_yaml","doc":null,"summary":null,"abstract":false,"args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":{"filename":"src/ameba/severity.cr","line_number":32,"url":null},"def":{"name":"from_yaml","args":[{"name":"ctx","doc":null,"default_value":"","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","doc":null,"default_value":"","external_name":"node","restriction":"YAML::Nodes::Node"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if node.is_a?(YAML::Nodes::Scalar)\nelse\n raise(\"Severity must be a scalar, not #{node.class}\")\nend\ncase value = node.value\nwhen String\n Severity.parse(value)\nwhen Nil\n nil\nelse\n raise(\"Incorrect severity: #{value}\")\nend\n"}},{"id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","html_id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","name":"to_yaml","doc":null,"summary":null,"abstract":false,"args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":"Severity"},{"name":"yaml","doc":null,"default_value":"","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"args_string":"(value : Severity, yaml : YAML::Nodes::Builder)","args_html":"(value : Severity, yaml : YAML::Nodes::Builder)","location":{"filename":"src/ameba/severity.cr","line_number":45,"url":null},"def":{"name":"to_yaml","args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":"Severity"},{"name":"yaml","doc":null,"default_value":"","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"yaml.scalar(value)"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Source","path":"Ameba/Source.html","kind":"class","full_name":"Ameba::Source","name":"Source","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"An entity that represents a Crystal source file.\nHas path, lines of code and issues reported by rules.","summary":"

An entity that represents a Crystal source file.

","class_methods":[],"constructors":[{"id":"new(code:String,path="")-class-method","html_id":"new(code:String,path="")-class-method","name":"new","doc":"Creates a new source by `code` and `path`.\n\nFor example:\n\n```\npath = \"./src/source.cr\"\nAmeba::Source.new File.read(path), path\n```\n","summary":"

Creates a new source by #code and #path.

","abstract":false,"args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""}],"args_string":"(code : String, path = "")","args_html":"(code : String, path = "")","location":{"filename":"src/ameba/source.cr","line_number":27,"url":null},"def":{"name":"new","args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(code, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"ast-instance-method","html_id":"ast-instance-method","name":"ast","doc":"Returns AST nodes constructed by `Crystal::Parser`.\n\n```\nsource = Ameba::Source.new code, path\nsource.ast\n```\n","summary":"

Returns AST nodes constructed by Crystal::Parser.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/source.cr","line_number":52,"url":null},"def":{"name":"ast","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ast || (@ast = (Crystal::Parser.new(code)).tap do |parser|\n parser.wants_doc = true\nend.tap do |parser|\n parser.filename = @path\nend.parse)"}},{"id":"code:String-instance-method","html_id":"code:String-instance-method","name":"code","doc":"Crystal code (content of a source file).","summary":"

Crystal code (content of a source file).

","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":12,"url":null},"def":{"name":"code","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@code"}},{"id":"fullpath-instance-method","html_id":"fullpath-instance-method","name":"fullpath","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/source.cr","line_number":60,"url":null},"def":{"name":"fullpath","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@fullpath || (@fullpath = File.expand_path(@path))"}},{"id":"lines-instance-method","html_id":"lines-instance-method","name":"lines","doc":"Returns lines of code splitted by new line character.\nSince `code` is immutable and can't be changed, this\nmethod caches lines in an instance variable, so calling\nit second time will not perform a split, but will return\nlines instantly.\n\n```\nsource = Ameba::Source.new \"a = 1\\nb = 2\", path\nsource.lines # => [\"a = 1\", \"b = 2\"]\n```\n","summary":"

Returns lines of code splitted by new line character.

","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/source.cr","line_number":41,"url":null},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@lines || (@lines = @code.split(\"\\n\"))"}},{"id":"matches_path?(filepath)-instance-method","html_id":"matches_path?(filepath)-instance-method","name":"matches_path?","doc":"Returns true if *filepath* matches the source's path, false if it does not.","summary":"

Returns true if filepath matches the source's path, false if it does not.

","abstract":false,"args":[{"name":"filepath","doc":null,"default_value":"","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/ameba/source.cr","line_number":65,"url":null},"def":{"name":"matches_path?","args":[{"name":"filepath","doc":null,"default_value":"","external_name":"filepath","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(path == filepath) || (path == (File.expand_path(filepath)))"}},{"id":"path:String-instance-method","html_id":"path:String-instance-method","name":"path","doc":"Path to the source file.","summary":"

Path to the source file.

","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":9,"url":null},"def":{"name":"path","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@path"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Tokenizer","path":"Ameba/Tokenizer.html","kind":"class","full_name":"Ameba::Tokenizer","name":"Tokenizer","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents Crystal syntax tokenizer based on `Crystal::Lexer`.\n\n```\nsource = Ameba::Source.new code, path\ntokenizer = Ameba::Tokenizer.new(source)\ntokenizer.run do |token|\n puts token\nend\n```\n","summary":"

Represents Crystal syntax tokenizer based on Crystal::Lexer.

","class_methods":[],"constructors":[{"id":"new(lexer:Crystal::Lexer)-class-method","html_id":"new(lexer:Crystal::Lexer)-class-method","name":"new","doc":"Instantiates Tokenizer using a `lexer`.\n\n```\nlexer = Crystal::Lexer.new(code)\nAmeba::Tokenizer.new(lexer)\n```\n","summary":"

Instantiates Tokenizer using a lexer.

","abstract":false,"args":[{"name":"lexer","doc":null,"default_value":"","external_name":"lexer","restriction":"Crystal::Lexer"}],"args_string":"(lexer : Crystal::Lexer)","args_html":"(lexer : Crystal::Lexer)","location":{"filename":"src/ameba/tokenizer.cr","line_number":37,"url":null},"def":{"name":"new","args":[{"name":"lexer","doc":null,"default_value":"","external_name":"lexer","restriction":"Crystal::Lexer"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(lexer)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(source)-class-method","html_id":"new(source)-class-method","name":"new","doc":"Instantiates Tokenizer using a `source`.\n\n```\nsource = Ameba::Source.new code, path\nAmeba::Tokenizer.new(source)\n```\n","summary":"

Instantiates Tokenizer using a source.

","abstract":false,"args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/tokenizer.cr","line_number":22,"url":null},"def":{"name":"new","args":[{"name":"source","doc":null,"default_value":"","external_name":"source","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"run(&block:Crystal::Token->_)-instance-method","html_id":"run(&block:Crystal::Token->_)-instance-method","name":"run","doc":"Runs the tokenizer and yields each token as a block argument.\n\n```\nAmeba::Tokenizer.new(source).run do |token|\n puts token\nend\n```\n","summary":"

Runs the tokenizer and yields each token as a block argument.

","abstract":false,"args":[],"args_string":"(&block : Crystal::Token -> _)","args_html":"(&block : Crystal::Token -> _)","location":{"filename":"src/ameba/tokenizer.cr","line_number":48,"url":null},"def":{"name":"run","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(Crystal::Token -> _)"},"return_type":"","visibility":"Public","body":"begin\n run_normal_state(@lexer, &block)\n true\nrescue e : Crystal::SyntaxException\n false\nend"}}],"macros":[],"types":[]}]}]}}) \ No newline at end of file