+ + module Ameba::Spec + +
+ + + + + + + + + + + + + + + + + + ++ + + + Defined in: +
+ + + + ameba/spec/annotated_source.cr + + ++ + + + ameba/spec/be_valid.cr + + +
+ + + + + + + + + + + + + + +
diff --git a/Ameba.html b/Ameba.html index 729a2d92..6b43fc80 100644 --- a/Ameba.html +++ b/Ameba.html @@ -606,6 +606,41 @@ +
config
parameter.
@node
.
return
:
return
:
return
:
@node
.
@node
.
@node
.
@node
.
@node
.
@node
.
@node
.
Ameba::
-
+
ameba/formatter/base_formatter.cr
@@ -824,7 +859,7 @@ callbacks in Ameba::
- [View source]
+ [View source]
@@ -854,7 +889,7 @@ callbacks in Ameba::
- [View source]
+ [View source]
@@ -876,7 +911,7 @@ A list of inspected sources is passed as an argument.
- [View source]
+ [View source]
@@ -897,7 +932,7 @@ A list of inspected sources is passed as an argument.
- [View source]
+ [View source]
@@ -919,7 +954,7 @@ A corresponding source is passed as an argument.
- [View source]
+ [View source]
@@ -941,7 +976,7 @@ A corresponding source is passed as an argument.
- [View source]
+ [View source]
@@ -963,7 +998,7 @@ A list of sources to inspect is passed as an argument.
- [View source]
+ [View source]
diff --git a/Ameba/Formatter/DisabledFormatter.html b/Ameba/Formatter/DisabledFormatter.html
index 434132e3..fa8a1151 100644
--- a/Ameba/Formatter/DisabledFormatter.html
+++ b/Ameba/Formatter/DisabledFormatter.html
@@ -606,6 +606,41 @@
def_hash
can be used to generate this meth
def_hash
can be used to generate this meth
map
.
-
+
ameba/rule/performance/map_instead_of_block.cr
@@ -1055,7 +1090,7 @@ that follow map
.
map
.
map
.
has_
or the prefix is_
. Ignores
-
+
ameba/rule/style/predicate_name.cr
@@ -993,7 +1028,7 @@ start with the prefix has_
or the prefix is_
. Ignores
has_
or the prefix is_
. Ignores
nil
-
+
ameba/rule/style/redundant_next.cr
@@ -1128,7 +1163,7 @@ without arguments. Sometimes such statements are used to yild the nil
- [View source]
+ [View source]
@@ -1326,7 +1361,7 @@ without arguments. Sometimes such statements are used to yild the nil
- [View source]
+ [View source]
@@ -1342,7 +1377,7 @@ without arguments. Sometimes such statements are used to yild the nil
- [View source]
+ [View source]
diff --git a/Ameba/Rule/Style/RedundantReturn.html b/Ameba/Rule/Style/RedundantReturn.html
index cf9ebcb3..398fa1fb 100644
--- a/Ameba/Rule/Style/RedundantReturn.html
+++ b/Ameba/Rule/Style/RedundantReturn.html
@@ -606,6 +606,41 @@
nil
-
+
ameba/rule/style/redundant_return.cr
@@ -1122,7 +1157,7 @@ without arguments. Sometimes such returns are used to return the nil
nil
nil
if
, so the previous invalid example would become this:
-
+
ameba/rule/style/unless_else.cr
@@ -1013,7 +1048,7 @@ an if
, so the previous invalid example would become this:
if
, so the previous invalid example would become this:
Ameba::Spec::Util
Ameba::Reportable
Parsed representation of code annotated with the # ^^^ error: Message
style
"[...]"
+ /\A\s*(# )?(\^+|\^{})( error:)? /
+ " # error: "
+ NOTE Annotations are sorted so that reconstructing the annotation text via #to_s
is deterministic.
Annotates the source code with the Ameba issues provided.
Separates annotation lines from code lines.
Returns false
(other can only be a Value
here).
Each entry is the line number, annotation prefix, and message.
Constructs an annotated source string (like what we parse).
NOTE Annotations are sorted so that reconstructing the annotation
+text via #to_s
is deterministic.
Annotates the source code with the Ameba issues provided.
+NOTE Annotations are sorted so that reconstructing the annotation
+text via #to_s
is deterministic.
Separates annotation lines from code lines. Tracks the real +code line number that each annotation corresponds to.
+Returns false
(other can only be a Value
here).
Each entry is the line number, annotation prefix, and message. +The prefix is empty if the annotation is at the end of a code line.
+Constructs an annotated source string (like what we parse).
+Reconstructs a deterministic annotated source string. This is +useful for eliminating semantically irrelevant annotation +ordering differences.
+source1 = AnnotatedSource.parse(<<-CRYSTAL)
+line1
+^ Annotation 1
+ ^^ Annotation 2
+CRYSTAL
+
+source2 = AnnotatedSource.parse(<<-CRYSTAL)
+line1
+ ^^ Annotation 2
+^ Annotation 1
+CRYSTAL
+
+source1.to_s == source2.to_s # => true
+ This mixin makes it easier to specify strict issue expectations +in a declarative and visual fashion. Just type out the code that +should generate an issue, annotate code by writing '^'s +underneath each character that should be highlighted, and follow +the carets with a string (separated by a space) that is the +message of the issue. You can include multiple issues in +one code snippet.
+Usage:
+expect_issue subject, %(
+ def foo
+ a do
+ b
+ end.c
+ # ^^^^^ error: Avoid chaining a method call on a do...end block.
+ end
+)
+Equivalent assertion without #expect_issue
:
source = Source.new %(
+ def foo
+ a do
+ b
+ end.c
+ end
+), "source.cr"
+subject.catch(source).should_not be_valid
+source.issues.size.should be(1)
+
+issue = source.issues.first
+issue.location.to_s.should eq "source.cr:4:3"
+issue.end_location.to_s.should eq "source.cr:4:7"
+issue.message.should eq(
+ "Avoid chaining a method call on a do...end block."
+)
+If you do not want to specify an issue then use the
+companion method #expect_no_issues
. This method is a much
+simpler assertion since it just inspects the code and checks
+that there were no issues. The #expect_issue
method has
+to do more work by parsing out lines that contain carets.
Ameba::Spec::Util
Ameba's entry module.
","class_methods":[],"constructors":[],"instance_methods":[{"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```","summary":"Initializes Ameba::Runner
and runs it.
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
.
Represents the argument of some node.
","class_methods":[],"constructors":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L35"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L40"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L17"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L24"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L20"},"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":[{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L7"}],"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":[{"html_id":"new(node,variable,scope)-class-method","name":"new","doc":"Creates a new assignment.\n\n```\nAssignment.new(node, variable, scope)\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":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L24"},"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"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L60"},"def":{"name":"in_branch?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!branch.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L50"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L40"},"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?)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L65"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L22"},"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"}},{"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```","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":97,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L97"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L14"},"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":[{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/base_visitor.cr#L6"}],"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":[{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/base_visitor.cr#L18"},"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":[{"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
.
Represents the branch in Crystal code.
","class_methods":[{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L65"},"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"}},{"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":56,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L56"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L33"},"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":[{"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.
See Object#hash(hasher)
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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L47"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.loop?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L17"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L20"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L22"},"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":[{"filename":"src/ameba/ast/branchable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L15"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L35"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L18"},"def":{"name":"branches","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@branches"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L39"},"def":{"name":"loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((loop?(node)) || parent.try(&.loop?)) || false"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L21"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L24"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L26"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L26"},"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":[{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L8"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L5"},"def":{"name":"macro_condition","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L44"},"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":[{"filename":"src/ameba/ast/flow_expression.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L18"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L36"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L50"},"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\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":[{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/flow_expression_visitor.cr#L12"},"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":[{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L10"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L6"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L6"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L5"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L5"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L7"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L7"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L8"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/node_visitor.cr#L39"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/node_visitor.cr#L42"},"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":[{"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.
A visit callback for Crystal::IsA
node.
A visit callback for Crystal::Assign
node.
A visit callback for Crystal::Call
node.
A visit callback for Crystal::Block
node.
A visit callback for Crystal::Case
node.
A visit callback for Crystal::ClassDef
node.
A visit callback for Crystal::ClassVar
node.
A visit callback for Crystal::Def
node.
A visit callback for Crystal::EnumDef
node.
A visit callback for Crystal::ExceptionHandler
node.
A visit callback for Crystal::Expressions
node.
A visit callback for Crystal::HashLiteral
node.
A visit callback for Crystal::If
node.
A visit callback for Crystal::InstanceVar
node.
A visit callback for Crystal::LibDef
node.
A visit callback for Crystal::ModuleDef
node.
A visit callback for Crystal::NilLiteral
node.
A visit callback for Crystal::StringInterpolation
node.
A visit callback for Crystal::Unless
node.
A visit callback for Crystal::Var
node.
A visit callback for Crystal::When
node.
A visit callback for Crystal::While
node.
A visit callback for Crystal::Until
node.
A class that utilizes a logic to traverse AST nodes and fire a source test callback if a redundant Crystal::ControlExpression
is reached.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"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":[{"filename":"src/ameba/ast/variabling/reference.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/reference.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/reference.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/reference.cr#L8"},"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":[{"filename":"src/ameba/ast/scope.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L39"},"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":[{"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.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L59"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L70"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L49"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L155"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L14"},"def":{"name":"arguments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@arguments"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L90"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L119"},"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 |__arg6|\n __arg6.name == name\nend && ivariables.find do |__arg7|\n __arg7.name == \"@#{name}\"\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L96"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L145"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L30"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L30"},"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"}},{"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
.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L80"},"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 |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L114"},"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?)))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L23"},"def":{"name":"inner_scopes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@inner_scopes"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L17"},"def":{"name":"ivariables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ivariables"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L26"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L11"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"html_id":"references?(variable:Variable,check_inner_scopes=true)-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"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(variable : Variable, check_inner_scopes = true)","args_html":"(variable : Variable, check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":137,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L137"},"def":{"name":"references?","args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variable.references.any? do |reference|\n if reference.scope == self\n return true\n end\n check_inner_scopes && inner_scopes.any?(&.references?(variable))\nend || variable.used_in_macro?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L107"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L150"},"def":{"name":"top_level?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"outer_scope.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L126"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"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":[{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/scope_visitor.cr#L12"},"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/TopLevelNodesVisitor","path":"Ameba/AST/TopLevelNodesVisitor.html","kind":"class","full_name":"Ameba::AST::TopLevelNodesVisitor","name":"TopLevelNodesVisitor","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":[{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"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":"AST Visitor that visits certain nodes at a top level, which\ncan characterize the source (i.e. require statements, modules etc.)","summary":"AST Visitor that visits certain nodes at a top level, which can characterize the source (i.e.
","class_methods":[],"constructors":[{"html_id":"new(scope:Crystal::ASTNode)-class-method","name":"new","doc":"Creates a new instance of visitor","summary":"Creates a new instance of 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/top_level_nodes_visitor.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"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":[{"html_id":"require_nodes:Array(Crystal::Require)-instance-method","name":"require_nodes","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Crystal::Require)","args_html":" : Array(Crystal::Require)","location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is Crystal::Expressions traverse the children.","summary":"If a top level node is Crystal::Expressions traverse the children.
","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/top_level_nodes_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L18"},"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":"true"}},{"html_id":"visit(node:Crystal::ASTNode)-instance-method","name":"visit","doc":"A general visit method for rest of the nodes.\nReturns false meaning all child nodes will not be traversed.","summary":"A general visit method for rest of the nodes.
","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/top_level_nodes_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L24"},"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":"false"}}],"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":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L2"}],"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/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","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":[{"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.
Returns true if node represents exit
method call.
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":67,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L67"},"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"}},{"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).","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":105,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L105"},"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"}},{"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.
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":151,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L151"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L33"},"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\nsource_between(loc, end_loc, code_lines)\n"}},{"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.
Returns the source code from loc to end_loc (inclusive).
","abstract":false,"args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String?","args_html":"(loc, end_loc, code_lines) : String?","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L42"},"def":{"name":"source_between","args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","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":"String | ::Nil","visibility":"Public","body":"line, 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.join('\\n')\n"}}],"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":[{"filename":"src/ameba/ast/variabling/variable.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L4"}],"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":[{"html_id":"new(node,scope)-class-method","name":"new","doc":"Creates a new variable(in the scope).\n\n```\nVariable.new(node, scope)\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":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L30"},"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":[{"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```","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L47"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@assignments"}},{"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":111,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L111"},"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, check_inner_scopes: false))\n return true\n end\n if captured_by_block?(inner_scope)\n return true\n end\nend\nfalse\n"}},{"html_id":"declared_before?(node)-instance-method","name":"declared_before?","doc":"Returns true if the variable is declared before the `node`.","summary":"Returns true if the variable is declared before the #node
.
Returns true if the #node
represents exactly the same Crystal node as @node
.
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":145,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L145"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L20"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var","visibility":"Public","body":"@node"}},{"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```","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":70,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L70"},"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"}},{"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":84,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L84"},"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 branch = assignment.branch\n else\n break\n end\n consumed_branches << branch\nend\n"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L60"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!references.empty?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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 $?
.
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":133,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L133"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L23"},"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"}},{"html_id":"used_in_macro?(scope=@scope)-instance-method","name":"used_in_macro?","doc":"Returns true if current variable potentially referenced in a macro,\nfalse if not.","summary":"Returns true if current variable potentially referenced in a macro, 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":122,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L122"},"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 (MacroReferenceFinder.new(inner_scope.node, node.name)).references\n return true\n end\nend\nif (MacroReferenceFinder.new(scope.node, node.name)).references\n return true\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":[{"filename":"src/ameba/config.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L15"}],"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
.
Loads YAML configuration file by path
.
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":55,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L55"},"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@excluded"}},{"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":55,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L55"},"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"}},{"html_id":"formatter:Formatter::BaseFormatter-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":" : Formatter::BaseFormatter","args_html":" : Formatter::BaseFormatter","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L113"},"def":{"name":"formatter","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Formatter::BaseFormatter","visibility":"Public","body":"if (value = @formatter).nil?\n @formatter = (Formatter::DotFormatter.new)\nelse\n value\nend"}},{"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```","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":123,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L123"},"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"}},{"html_id":"formatter=(formatter:Formatter::BaseFormatter)-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":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L113"},"def":{"name":"formatter=","args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter = formatter"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L46"},"def":{"name":"globs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@globs"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L46"},"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L34"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L35"},"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L35"},"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"}},{"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```","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":99,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L99"},"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"}},{"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```","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":137,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L137"},"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":"rule = @rules.find do |__arg2|\n __arg2.name == name\nend\nif rule\nelse\n raise(ArgumentError.new(\"Rule `#{name}` does not exist\"))\nend\nrule.tap(&.enabled = enabled).tap(&.excluded = excluded)\n"}},{"html_id":"update_rules(names,enabled=true,excluded=nil)-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```","summary":"Updates rules properties.
","abstract":false,"args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"(names, enabled = true, excluded = nil)","args_html":"(names, enabled = true, excluded = nil)","location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L158"},"def":{"name":"update_rules","args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"names.try(&.each do |name|\n if rules = @rule_groups[name]?\n rules.each do |rule|\n rule.enabled = enabled\n rule.excluded = excluded\n end\n else\n update_rule(name, enabled, excluded)\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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L4"},{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/disabled_formatter.cr#L1"},{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L3"},{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L3"},{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/flycheck_formatter.cr#L1"},{"filename":"src/ameba/formatter/json_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L3"},{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L1"}],"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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L8"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L13"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L30"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L10"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L22"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L26"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L18"},"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":[{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/disabled_formatter.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/disabled_formatter.cr#L4"},"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":[{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L6"}],"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":[{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L27"},"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.puts(location.colorize(:cyan))\n output.puts(\"[#{issue.rule.severity.symbol}] #{issue.rule.name}: #{issue.message}\".colorize(:red))\n if show_affected_code && (code = affected_code(source, location, issue.end_location))\n output << (code.colorize(:default))\n end\n output.puts\n end\nend\noutput.puts(finished_in_message(@started_at, Time.monotonic))\noutput.puts(final_message(sources, failed_sources))\n"}},{"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":21,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L21"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L13"},"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.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\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":[{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L6"}],"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":"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":[{"html_id":"new(output,location)-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```","summary":"Creates a new instance of ExplainFormatter.
","abstract":false,"args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"args_string":"(output, location)","args_html":"(output, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L23"},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output, location)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L28"},"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 |__arg0|\n __arg0.path == @location.filename\nend\nif source\nelse\n return\nend\nissue = source.issues.find do |__arg1|\n __arg1.location == @location\nend\nif issue\nelse\n return\nend\nexplain(source, issue)\n"}},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L12"},"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":[{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/flycheck_formatter.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/flycheck_formatter.cr#L5"},"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":[{"filename":"src/ameba/formatter/json_formatter.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L66"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L67"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L87"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L75"},"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_46 = @result.summary\n __temp_46.issues_count = __temp_46.issues_count + 1\nend\n@result.sources << json_source\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L71"},"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":[{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L5"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L6"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L9"},"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.flat_map(&.issues)\nif issues.any? do |issue|\n !issue.disabled?\nend\nelse\n @output.puts(\"No issues found. File is not generated.\")\n return\nend\nif issues.any?(&.syntax?)\n @output.puts(\"Unable to generate TODO file. Please fix syntax issues.\")\n return\nend\nfile = generate_todo_config(issues)\n@output.puts(\"Created #{file.path}\")\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":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L2"}],"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":[{"html_id":"affected_code(source,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L43"},"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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","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":"lines = source.lines\nlineno, column = location.line_number, location.column_number\nif affected_line = lines[lineno - 1]?.presence\nelse\n return\nend\nif column < max_length\n affected_line = trim(affected_line, max_length, ellipsis)\nend\nshow_context = context_lines > 0\nif show_context\n pre_context, post_context = context(lines, lineno, context_lines)\n position = prompt.size + column\n position = position - 1\nelse\n affected_line_size, affected_line = affected_line.size, affected_line.lstrip\n position = (column - (affected_line_size - affected_line.size)) + prompt.size\n position = position - 1\nend\nString.build do |str|\n if show_context\n pre_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\n str << prompt\n str.puts(affected_line.colorize(:white))\n str << (\" \" * position)\n str << (\"^\".colorize(:yellow))\n if end_location\n end_lineno = end_location.line_number\n end_column = end_location.column_number\n if (end_lineno == lineno) && end_column > column\n end_position = end_column - column\n end_position = end_position - 1\n str << ((\"-\" * end_position).colorize(:dark_gray))\n str << (\"^\".colorize(:yellow))\n end\n end\n str.puts\n if show_context\n post_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\nend\n"}},{"html_id":"context(lines,lineno,context_lines=3,remove_empty=true)-instance-method","name":"context","doc":null,"summary":null,"abstract":false,"args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"args_string":"(lines, lineno, context_lines = 3, remove_empty = true)","args_html":"(lines, lineno, context_lines = 3, remove_empty = true)","location":{"filename":"src/ameba/formatter/util.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L17"},"def":{"name":"context","args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"pre_context, post_context = [] of ::String, [] of ::String\nlines.each_with_index do |line, i|\n case i + 1\n when (lineno - context_lines)...lineno\n pre_context << line\n when (lineno + 1)..(lineno + context_lines)\n post_context << line\n end\nend\nif remove_empty\n while pre_context.first?.try(&.blank?)\n pre_context.shift\n end\n while post_context.last?.try(&.blank?)\n post_context.pop\n end\nend\n{pre_context, post_context}\n"}},{"html_id":"deansify(message:String?):String?-instance-method","name":"deansify","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String?) : String?","args_html":"(message : String?) : String?","location":{"filename":"src/ameba/formatter/util.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L3"},"def":{"name":"deansify","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"message.try do |__arg0|\n (__arg0.gsub(/\\x1b[^m]*m/, \"\")).presence\nend"}},{"html_id":"trim(str,max_length=120,ellipsis=\"...\")-instance-method","name":"trim","doc":null,"summary":null,"abstract":false,"args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"args_string":"(str, max_length = 120, ellipsis = \" ...\")","args_html":"(str, max_length = 120, ellipsis = " ...")","location":{"filename":"src/ameba/formatter/util.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L7"},"def":{"name":"trim","args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (str.size - ellipsis.size) > max_length\n str = str[0, max_length]\n if str.size > ellipsis.size\n str = str[0...(-ellipsis.size)] + ellipsis\n end\nend\nstr\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":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/glob_utils.cr#L3"}],"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":[{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/glob_utils.cr#L22"},"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.flat_map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.uniq!"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/glob_utils.cr#L10"},"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!(&.[](1..-1))))\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":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L3"}],"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:(?A module that utilizes inline comments parsing and processing logic.
","class_methods":[],"constructors":[],"instance_methods":[{"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.
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":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L39"},"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.name.in?(Rule::SPECIAL)\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"}},{"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```","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":67,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L67"},"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":[{"filename":"src/ameba/inline_comments.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L8"},"def":{"name":"disable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disable"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L9"},"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":[{"filename":"src/ameba/issue.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L3"}],"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":[{"html_id":"new(rule,location,end_location,message,status:Status?=nil)-class-method","name":"new","doc":null,"summary":null,"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":"Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Status? = nil)","args_html":"(rule, location, end_location, message, status : Status? = nil)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L27"},"def":{"name":"new","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":"Status | ::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":[{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location?-instance-method","name":"end_location","doc":"End location of the issue.","summary":"End location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L16"},"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"}},{"html_id":"location:Crystal::Location?-instance-method","name":"location","doc":"Location of the issue.","summary":"Location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@location"}},{"html_id":"message:String-instance-method","name":"message","doc":"Issue message.","summary":"Issue message.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L19"},"def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"html_id":"rule:Rule::Base-instance-method","name":"rule","doc":"A rule that triggers this issue.","summary":"A rule that triggers this issue.
","abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L10"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"Issue status.
","abstract":false,"args":[],"args_string":" : Status","args_html":" : Status","location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L22"},"def":{"name":"status","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Status","visibility":"Public","body":"@status"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L31"},"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/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","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":[{"filename":"src/ameba/issue.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0","doc":null,"summary":null},{"id":"Disabled","name":"Disabled","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"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":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Enabled"}}],"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":[{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L3"}],"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":[{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L28"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status?=nil):Issue-instance-method","name":"add_issue","doc":"Adds a new issue for Crystal AST *node*.","summary":"Adds a new issue for Crystal 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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L18"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node.location, node.end_location, message, status)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L23"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L36"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nend_location = Crystal::Location.new(path, *end_location)\nadd_issue(rule, location, end_location, message, status)\n"}},{"html_id":"add_issue(rule,location,end_location,message,status:Issue::Status?=nil):Issue-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":"Issue::Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L8"},"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":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(rule, location, end_location, message, status)).tap do |issue|\n issues << issue\nend\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L5"},"def":{"name":"issues","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@issues"}},{"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.
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":[{"html_id":"rules-class-method","name":"rules","doc":"Returns a list of all available rules.\n\n```\nAmeba::Rule.rules # => [Rule1, Rule2, ....]\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":200,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L200"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Base.inherited_rules"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Base","path":"Ameba/Rule/Base.html","kind":"class","full_name":"Ameba::Rule::Base","name":"Base","abstract":true,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/base.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L29"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement"},{"html_id":"ameba/Ameba/Rule/Lint/DuplicatedRequire","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","kind":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays"},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar"},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","kind":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber"},{"html_id":"ameba/Ameba/Rule/Lint/SpecFocus","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus"},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax"},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","kind":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","kind":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign"},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","kind":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen"},{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","kind":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","kind":"class","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter"},{"html_id":"ameba/Ameba/Rule/Style/IsANil","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil"},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers"},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","kind":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext"},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","kind":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn"},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","kind":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","kind":"class","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Style/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","kind":"class","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```\nclass 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.","summary":"Represents a base of all rules.
","class_methods":[{"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 class 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":161,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L161"},"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":[],"instance_methods":[{"html_id":"==(other)-instance-method","name":"==","doc":"Returns `false` (other can only be a `Value` here).","summary":"Returns false
(other can only be a Value
here).
A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
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":90,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L90"},"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)"}},{"html_id":"group-instance-method","name":"group","doc":"Returns a group this rule belong to.\n\n```\nclass MyGroup::MyRule < Ameba::Rule::Base\n # ...\nend\n\nMyGroup::MyRule.new.group # => \"MyGroup\"\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":79,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L79"},"def":{"name":"group","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).group_name"}},{"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.
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":66,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L66"},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).rule_name"}},{"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```","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":103,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L103"},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.in?(SPECIAL)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L41"},"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":""}},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L37"},"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":[{"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)","args_html":"(*args)","location":{"filename":"src/ameba/rule/base.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L115"},"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":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/line_length.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_blank_lines.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/line_length.cr#L11"}],"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```","summary":"A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows trailing blank lines at the end of the source file.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"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_empty = last_source_line.empty?\nif source_lines_size >= 1 && ((source_lines.last(2)).join.blank? || (!last_line_empty))\n issue_for({source_lines_size - 1, 1}, last_line_empty ? MSG : MSG_FINAL_NEWLINE)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","path":"Ameba/Rule/Layout/TrailingWhitespace.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"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```","summary":"A rule that disallows trailing whitespaces.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":17,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"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 issue_for({index + 1, line.size}, MSG)\n end\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":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L1"},{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L1"},{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L1"},{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L1"},{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L1"},{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L1"},{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L1"},{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/rand_zero.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_string_coercion.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_with_index.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_with_object.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L1"},{"filename":"src/ameba/rule/lint/syntax.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L1"},{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L1"},{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L1"},{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"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/AmbiguousAssignment","path":"Ameba/Rule/Lint/AmbiguousAssignment.html","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\" => \"-=\", \"=+\" => \"+=\", \"=!\" => \"!=\"}","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\"","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":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand assignments.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand 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/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/lint/ambiguous_assignment.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L35"},"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 op_end_location = node.value.location\nelse\n return\nend\nop_location = Crystal::Location.new(op_end_location.filename, op_end_location.line_number, op_end_location.column_number - 1)\nop_text = source_between(op_location, op_end_location, source.lines)\nif op_text\nelse\n return\nend\nif MISTAKES.has_key?(op_text)\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % MISTAKES[op_text])\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","path":"Ameba/Rule/Lint/BadDirective.html","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L20"}],"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```","summary":"A rule that reports incorrect comment directives for Ameba.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L29"},"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":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"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},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] 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/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```","summary":"A rule that disallows comparison to booleans.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L31"},"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 = node.name.in?(OP_NAMES)\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\n issue_for(node, MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","path":"Ameba/Rule/Lint/DebuggerStatement.html","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L13"}],"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```","summary":"A rule that disallows calls to debugger.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L13"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L20"},"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/DuplicatedRequire","path":"Ameba/Rule/Lint/DuplicatedRequire.html","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require 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 duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","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/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L16"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/duplicated_require.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L23"},"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":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if processed_require_strings.includes?(node.string)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","path":"Ameba/Rule/Lint/EmptyEnsure.html","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L41"}],"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```","summary":"A rule that disallows empty ensure statement.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L41"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L30"}],"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```","summary":"A rule that disallows empty expressions.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L41"},"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)\nif exp.in?(nil, \"nil\")\n return\nend\nissue_for(node, MSG % exp)\n"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L40"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L49"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L55"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L59"},"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":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"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```","summary":"A rule that disallows duplicated keys in hash literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"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)).empty?\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":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L22"}],"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```","summary":"A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L22"},"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":[{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L32"},"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)\n issue_for(node, MSG)\nend"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L36"},"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)"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L40"},"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)"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L44"},"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":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"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```","summary":"A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L26"}],"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```","summary":"A rule that disallows some unwanted symbols in percent array literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L26"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L36"},"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 end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","path":"Ameba/Rule/Lint/RandZero.html","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/rand_zero.cr#L25"}],"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```","summary":"A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows string conversion in string interpolation, which is redundant.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"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":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_with_index.cr#L29"}],"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```","summary":"A rule that disallows redundant with_index
calls.
A rule that disallows redundant with_index
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows shadowed arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":38,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L38"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L49"},"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L45"},"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":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"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```","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":[{"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)"}},{"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```","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":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L36"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L43"},"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.try(&.map(&.types))\nelse\n return\nend\nif (excs = shadowed(excs)).empty?\n return\nend\nissue_for(node, MSG % (excs.join(\", \")))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","path":"Ameba/Rule/Lint/ShadowingOuterLocalVar.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"}],"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```","summary":"A rule that disallows the usage of the same name as outer local variables for block or proc arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L45"},"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)"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L49"},"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)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L41"},"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":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"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```","summary":"A rule that disallows using shared variables in fibers, which are mutated during iterations.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":52,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":63,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"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"}},{"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":59,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"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/SpecFocus","path":"Ameba/Rule/Lint/SpecFocus.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\"","doc":null,"summary":null},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] 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/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","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/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L47"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/spec_focus.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L61"},"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.in?(SPEC_ITEM_NAMES)\nelse\n return\nend\nif node.block\nelse\n return\nend\narg = node.named_args.try(&.find() do |__arg1|\n __arg1.name == \"focus\"\nend)\nif arg\n issue_for(arg, MSG)\nend\n"}},{"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/spec_focus.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L55"},"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":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","path":"Ameba/Rule/Lint/Syntax.html","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/syntax.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L21"}],"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```","summary":"A rule that reports invalid Crystal syntax.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":21,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L21"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"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```","summary":"A rule that reports unneeded disable directives.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"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.empty?\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":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L44"}],"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```","summary":"A rule that reports unreachable code.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L44"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":57,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L57"},"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"}},{"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":53,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L53"},"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":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L27"}],"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```","summary":"A rule that reports unused arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L43"},"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))"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L47"},"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))"}},{"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":51,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L51"},"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))"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L39"},"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":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L28"}],"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```","summary":"A rule that disallows useless assignments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L28"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L39"},"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.ignored? || var.used_in_macro?) || var.captured_by_block?\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"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L35"},"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":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"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```","summary":"A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"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":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"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```","summary":"A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
A general base class for performance rules.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A general base class for performance rules.","summary":"A general base class for performance rules.
","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/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/base.cr#L5"},"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":[{"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```","summary":"A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
All these methods are allocating a new object
"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\"","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 chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","class_methods":[],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"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":[{"html_id":"call_names:Array(String)-instance-method","name":"call_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"call_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","location":null,"def":{"name":"call_names=","args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@call_names = call_names"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/chained_call_with_no_bang.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/chained_call_with_no_bang.cr#L68"},"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 (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif node.name.in?(call_names)\nelse\n return\nend\nif (obj.name.in?(call_names)) || (obj.name.in?(ALLOCATING_METHOD_NAMES))\nelse\n return\nend\nissue_for(node.name_location, node.name_end_location, MSG % {node.name, obj.name})\n"}},{"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/chained_call_with_no_bang.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/chained_call_with_no_bang.cr#L59"},"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/CompactAfterMap","path":"Ameba/Rule/Performance/CompactAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"COMPACT_NAME","name":"COMPACT_NAME","value":"\"compact\"","doc":null,"summary":null},{"id":"MAP_NAME","name":"MAP_NAME","value":"\"map\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\"","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 `compact` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.match(/^A./)).compact\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].compact_map(&.match(/^A./))\n```\n\nYAML configuration example:\n\n```\nPerformance/CompactAfterMap:\n Enabled: true\n```","summary":"This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
A rule that enforces constant names to be in screaming case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/constant_names.cr#L24"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/constant_names.cr#L31"},"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 name.in?(expected, name.camelcase)\n return\n end\n issue_for(target, MSG % {expected, name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","path":"Ameba/Rule/Style/IsAFilter.html","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s(%s)` instead 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/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"This rule is used to identify usage of `is_a?/nil?` calls within filters.\n\nFor example, this is considered invalid:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(&.is_a?(Regex::MatchData)) # => true\nmatches.one?(&.nil?) # => true\n\ntypeof(matches.reject(&.nil?)) # => Array(Regex::MatchData | Nil)\ntypeof(matches.select(&.is_a?(Regex::MatchData))) # => Array(Regex::MatchData | Nil)\n```\n\nAnd it should be written as this:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(Regex::MatchData) # => true\nmatches.one?(Nil) # => true\n\ntypeof(matches.reject(Nil)) # => Array(Regex::MatchData)\ntypeof(matches.select(Regex::MatchData)) # => Array(Regex::MatchData)\n```\n\nYAML configuration example:\n\n```\nStyle/IsAFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n - any?\n - all?\n - none?\n - one?\n```","summary":"This rule is used to identify usage of is_a?/nil?
calls within filters.
This rule is used to identify usage of is_a?/nil?
calls within filters.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows usage of large numbers without underscore.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/large_numbers.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/large_numbers.cr#L38"},"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":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L40"}],"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```","summary":"A rule that enforces method names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L47"},"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 && column_number\nelse\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":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"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```","summary":"A rule that disallows negated conditions in unless.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","path":"Ameba/Rule/Style/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/predicate_name.cr#L31"}],"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```","summary":"A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows redundant begin blocks.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":58,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_begin.cr#L58"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_begin.cr#L67"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","path":"Ameba/Rule/Style/RedundantNext.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L99"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L99"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L113"},"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"}},{"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":109,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L109"},"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":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L96"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L96"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":110,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L110"},"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"}},{"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":106,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L106"},"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":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L54"}],"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```","summary":"A rule that enforces type names in camelcase manner.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":54,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L54"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":69,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L69"},"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)"}},{"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":73,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L73"},"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)"}},{"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":77,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L77"},"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)"}},{"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":81,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L81"},"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)"}},{"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":85,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L85"},"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":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/unless_else.cr#L45"}],"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```","summary":"A rule that disallows the use of an else
block with the unless
.
A rule that disallows the use of an else
block with the unless
.
A rule that enforces variable names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":25,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L25"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L38"},"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)"}},{"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":42,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L42"},"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)"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L46"},"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/VerboseBlock","path":"Ameba/Rule/Style/VerboseBlock.html","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%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":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","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/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"html_id":"exclude_calls_with_block:Bool-instance-method","name":"exclude_calls_with_block","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_calls_with_block","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","location":null,"def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks:Bool-instance-method","name":"exclude_multiple_line_blocks","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_multiple_line_blocks","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","location":null,"def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_operators:Bool-instance-method","name":"exclude_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","location":null,"def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_prefix_operators:Bool-instance-method","name":"exclude_prefix_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_prefix_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","location":null,"def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_setters:Bool-instance-method","name":"exclude_setters","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_setters","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","location":null,"def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"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"}},{"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"}},{"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 | ::Nil","visibility":"Public","body":"@max_length"}},{"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 | ::Nil"}],"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 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Int32?-instance-method","name":"max_line_length","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32?","args_html":" : Int32?","location":null,"def":{"name":"max_line_length","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32 | ::Nil","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Int32?)-instance-method","name":"max_line_length=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"args_string":"(max_line_length : Int32?)","args_html":"(max_line_length : Int32?)","location":null,"def":{"name":"max_line_length=","args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_line_length = max_line_length"}},{"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"}},{"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"}},{"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/style/verbose_block.cr","line_number":189,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L189"},"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 (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\nif arg.name.starts_with?(\"__arg\")\n return\nend\nif (body = block.body).is_a?(Crystal::Call)\nelse\n return\nend\nobj = body.obj\nwhile obj.is_a?(Crystal::Call)\n obj = obj.obj\nend\nif obj == arg\nelse\n return\nend\nif (reference_count(body, arg)) > 1\n return\nend\nissue_for_valid(source, node, body)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","path":"Ameba/Rule/Style/WhileTrue.html","kind":"class","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/while_true.cr#L28"}],"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```","summary":"A rule that disallows the use of while true
instead of using the idiomatic loop
A rule that disallows the use of while true
instead of using the idiomatic loop
Represents a runner for inspecting sources files.
","class_methods":[],"constructors":[{"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```","summary":"Instantiates a runner using a config
.
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":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L113"},"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)"}},{"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```","summary":"Performs the inspection.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L66"},"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 |chan|\n chan.receive.try do |e|\n raise(e)\n end\n end\n self\nensure\n @formatter.finished(@sources)\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L18"},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Source)","visibility":"Public","body":"@sources"}},{"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```","summary":"Indicates whether the last inspection successful or not.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":125,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L125"},"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 |__arg4|\n __arg4.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":[{"filename":"src/ameba/severity.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L2"}],"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":[{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L26"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L5"},"def":{"name":"convention?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Convention"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L3"},"def":{"name":"error?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Error"}},{"html_id":"symbol:Char-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":" : Char","args_html":" : Char","location":{"filename":"src/ameba/severity.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L12"},"def":{"name":"symbol","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Char","visibility":"Public","body":"case self\nin Error\n 'E'\nin Warning\n 'W'\nin Convention\n 'C'\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L4"},"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":[{"filename":"src/ameba/severity.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L34"}],"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.
An entity that represents a Crystal source file.
","class_methods":[],"constructors":[{"html_id":"new(code,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```","summary":"Creates a new source by #code
and #path
.
Returns AST nodes constructed by Crystal::Parser
.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L12"},"def":{"name":"code","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L52"},"def":{"name":"fullpath","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"if (value = @fullpath).nil?\n @fullpath = (File.expand_path(path))\nelse\n value\nend"}},{"html_id":"lines:Array(String)-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":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/source.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L36"},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"if (value = @lines).nil?\n @lines = (code.split('\\n'))\nelse\n value\nend"}},{"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.
Path to the source file.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L9"},"def":{"name":"path","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"spec?-instance-method","name":"spec?","doc":"Returns `true` if the source is a spec file, `false` otherwise.","summary":"Returns true
if the source is a spec file, false
otherwise.
Represents Crystal syntax tokenizer based on Crystal::Lexer
.
Instantiates Tokenizer using a lexer
.
Instantiates Tokenizer using a source
.
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":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/tokenizer.cr#L45"},"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 +{"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 * [Watch a tutorial](#watch-a-tutorial)\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/reference/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\n129 inspected, 2 failures\n```\n\n### Watch a tutorial\n\n\n\n[🎬 Watch the LuckyCast showing how to use Ameba](https://luckycasts.com/videos/ameba)\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":[{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"},{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"},{"html_id":"ameba/Ameba/Spec/BeValid","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid"}],"locations":[],"repository_name":"ameba","program":true,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Spec/BeValid","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid"},{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"}],"extended_modules":[{"html_id":"ameba/Ameba/Spec/BeValid","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid"},{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"}],"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":[{"filename":"src/ameba.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba.cr#L23"},{"filename":"src/ameba/glob_utils.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L1"},{"filename":"src/ameba/inline_comments.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L1"},{"filename":"src/ameba/issue.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L1"},{"filename":"src/ameba/reportable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L1"},{"filename":"src/ameba/runner.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L1"},{"filename":"src/ameba/severity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L1"},{"filename":"src/ameba/source.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/support.cr#L7"},{"filename":"src/ameba/tokenizer.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/tokenizer.cr#L3"}],"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/runner/work/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```","summary":"Ameba's entry module.
","class_methods":[],"constructors":[],"instance_methods":[{"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```","summary":"Initializes Ameba::Runner
and runs it.
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
.
Represents the argument of some node.
","class_methods":[],"constructors":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L35"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L40"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L17"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L24"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L20"},"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":[{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L7"}],"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":[{"html_id":"new(node,variable,scope)-class-method","name":"new","doc":"Creates a new assignment.\n\n```\nAssignment.new(node, variable, scope)\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":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L24"},"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"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L60"},"def":{"name":"in_branch?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!branch.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L50"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L40"},"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?)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L65"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L22"},"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"}},{"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```","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":97,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L97"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L14"},"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":[{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/base_visitor.cr#L6"}],"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":[{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/base_visitor.cr#L18"},"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":[{"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
.
Represents the branch in Crystal code.
","class_methods":[{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L65"},"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"}},{"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":56,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L56"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L33"},"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":[{"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.
See Object#hash(hasher)
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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L47"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.loop?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L17"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L20"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L22"},"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":[{"filename":"src/ameba/ast/branchable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L15"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L35"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L18"},"def":{"name":"branches","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@branches"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L39"},"def":{"name":"loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((loop?(node)) || parent.try(&.loop?)) || false"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L21"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L24"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L26"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L26"},"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":[{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L8"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L5"},"def":{"name":"macro_condition","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L44"},"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":[{"filename":"src/ameba/ast/flow_expression.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L18"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L36"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L50"},"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\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":[{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/flow_expression_visitor.cr#L12"},"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":[{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L10"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L6"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L6"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L5"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L5"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L7"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L7"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L8"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/node_visitor.cr#L39"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/node_visitor.cr#L42"},"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":[{"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.
A visit callback for Crystal::IsA
node.
A visit callback for Crystal::Assign
node.
A visit callback for Crystal::Call
node.
A visit callback for Crystal::Block
node.
A visit callback for Crystal::Case
node.
A visit callback for Crystal::ClassDef
node.
A visit callback for Crystal::ClassVar
node.
A visit callback for Crystal::Def
node.
A visit callback for Crystal::EnumDef
node.
A visit callback for Crystal::ExceptionHandler
node.
A visit callback for Crystal::Expressions
node.
A visit callback for Crystal::HashLiteral
node.
A visit callback for Crystal::If
node.
A visit callback for Crystal::InstanceVar
node.
A visit callback for Crystal::LibDef
node.
A visit callback for Crystal::ModuleDef
node.
A visit callback for Crystal::NilLiteral
node.
A visit callback for Crystal::StringInterpolation
node.
A visit callback for Crystal::Unless
node.
A visit callback for Crystal::Var
node.
A visit callback for Crystal::When
node.
A visit callback for Crystal::While
node.
A visit callback for Crystal::Until
node.
A class that utilizes a logic to traverse AST nodes and fire a source test callback if a redundant Crystal::ControlExpression
is reached.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"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":[{"filename":"src/ameba/ast/variabling/reference.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/reference.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/reference.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/reference.cr#L8"},"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":[{"filename":"src/ameba/ast/scope.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L39"},"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":[{"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.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L59"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L70"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L49"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L155"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L14"},"def":{"name":"arguments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@arguments"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L90"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L119"},"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 |__arg6|\n __arg6.name == name\nend && ivariables.find do |__arg7|\n __arg7.name == \"@#{name}\"\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L96"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L145"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L30"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L30"},"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"}},{"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
.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L80"},"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 |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L114"},"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?)))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L23"},"def":{"name":"inner_scopes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@inner_scopes"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L17"},"def":{"name":"ivariables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ivariables"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L26"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L11"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"html_id":"references?(variable:Variable,check_inner_scopes=true)-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"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(variable : Variable, check_inner_scopes = true)","args_html":"(variable : Variable, check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":137,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L137"},"def":{"name":"references?","args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variable.references.any? do |reference|\n if reference.scope == self\n return true\n end\n check_inner_scopes && inner_scopes.any?(&.references?(variable))\nend || variable.used_in_macro?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L107"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L150"},"def":{"name":"top_level?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"outer_scope.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L126"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"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":[{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/scope_visitor.cr#L12"},"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/TopLevelNodesVisitor","path":"Ameba/AST/TopLevelNodesVisitor.html","kind":"class","full_name":"Ameba::AST::TopLevelNodesVisitor","name":"TopLevelNodesVisitor","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":[{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"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":"AST Visitor that visits certain nodes at a top level, which\ncan characterize the source (i.e. require statements, modules etc.)","summary":"AST Visitor that visits certain nodes at a top level, which can characterize the source (i.e.
","class_methods":[],"constructors":[{"html_id":"new(scope:Crystal::ASTNode)-class-method","name":"new","doc":"Creates a new instance of visitor","summary":"Creates a new instance of 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/top_level_nodes_visitor.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"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":[{"html_id":"require_nodes:Array(Crystal::Require)-instance-method","name":"require_nodes","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Crystal::Require)","args_html":" : Array(Crystal::Require)","location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is Crystal::Expressions traverse the children.","summary":"If a top level node is Crystal::Expressions traverse the children.
","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/top_level_nodes_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L18"},"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":"true"}},{"html_id":"visit(node:Crystal::ASTNode)-instance-method","name":"visit","doc":"A general visit method for rest of the nodes.\nReturns false meaning all child nodes will not be traversed.","summary":"A general visit method for rest of the nodes.
","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/top_level_nodes_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L24"},"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":"false"}}],"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":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L2"}],"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/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","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":[{"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.
Returns true if node represents exit
method call.
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":67,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L67"},"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"}},{"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).","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":105,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L105"},"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"}},{"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.
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":151,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L151"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L33"},"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\nsource_between(loc, end_loc, code_lines)\n"}},{"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.
Returns the source code from loc to end_loc (inclusive).
","abstract":false,"args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String?","args_html":"(loc, end_loc, code_lines) : String?","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L42"},"def":{"name":"source_between","args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","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":"String | ::Nil","visibility":"Public","body":"line, 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.join('\\n')\n"}}],"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":[{"filename":"src/ameba/ast/variabling/variable.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L4"}],"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":[{"html_id":"new(node,scope)-class-method","name":"new","doc":"Creates a new variable(in the scope).\n\n```\nVariable.new(node, scope)\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":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L30"},"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":[{"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```","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L47"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@assignments"}},{"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":111,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L111"},"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, check_inner_scopes: false))\n return true\n end\n if captured_by_block?(inner_scope)\n return true\n end\nend\nfalse\n"}},{"html_id":"declared_before?(node)-instance-method","name":"declared_before?","doc":"Returns true if the variable is declared before the `node`.","summary":"Returns true if the variable is declared before the #node
.
Returns true if the #node
represents exactly the same Crystal node as @node
.
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":145,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L145"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L20"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var","visibility":"Public","body":"@node"}},{"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```","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":70,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L70"},"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"}},{"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":84,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L84"},"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 branch = assignment.branch\n else\n break\n end\n consumed_branches << branch\nend\n"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L60"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!references.empty?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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 $?
.
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":133,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L133"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L23"},"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"}},{"html_id":"used_in_macro?(scope=@scope)-instance-method","name":"used_in_macro?","doc":"Returns true if current variable potentially referenced in a macro,\nfalse if not.","summary":"Returns true if current variable potentially referenced in a macro, 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":122,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L122"},"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 (MacroReferenceFinder.new(inner_scope.node, node.name)).references\n return true\n end\nend\nif (MacroReferenceFinder.new(scope.node, node.name)).references\n return true\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":[{"filename":"src/ameba/config.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L15"}],"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
.
Loads YAML configuration file by path
.
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":55,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L55"},"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@excluded"}},{"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":55,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L55"},"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"}},{"html_id":"formatter:Formatter::BaseFormatter-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":" : Formatter::BaseFormatter","args_html":" : Formatter::BaseFormatter","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L113"},"def":{"name":"formatter","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Formatter::BaseFormatter","visibility":"Public","body":"if (value = @formatter).nil?\n @formatter = (Formatter::DotFormatter.new)\nelse\n value\nend"}},{"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```","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":123,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L123"},"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"}},{"html_id":"formatter=(formatter:Formatter::BaseFormatter)-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":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L113"},"def":{"name":"formatter=","args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter = formatter"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L46"},"def":{"name":"globs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@globs"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L46"},"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L34"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L35"},"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L35"},"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"}},{"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```","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":99,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L99"},"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"}},{"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```","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":137,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L137"},"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":"rule = @rules.find do |__arg2|\n __arg2.name == name\nend\nif rule\nelse\n raise(ArgumentError.new(\"Rule `#{name}` does not exist\"))\nend\nrule.tap(&.enabled = enabled).tap(&.excluded = excluded)\n"}},{"html_id":"update_rules(names,enabled=true,excluded=nil)-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```","summary":"Updates rules properties.
","abstract":false,"args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"(names, enabled = true, excluded = nil)","args_html":"(names, enabled = true, excluded = nil)","location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L158"},"def":{"name":"update_rules","args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"names.try(&.each do |name|\n if rules = @rule_groups[name]?\n rules.each do |rule|\n rule.enabled = enabled\n rule.excluded = excluded\n end\n else\n update_rule(name, enabled, excluded)\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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L4"},{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/disabled_formatter.cr#L1"},{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L3"},{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L3"},{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/flycheck_formatter.cr#L1"},{"filename":"src/ameba/formatter/json_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L3"},{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L1"}],"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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L8"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L13"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L30"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L10"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L22"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L26"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L18"},"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":[{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/disabled_formatter.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/disabled_formatter.cr#L4"},"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":[{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L6"}],"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":[{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L27"},"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.puts(location.colorize(:cyan))\n output.puts(\"[#{issue.rule.severity.symbol}] #{issue.rule.name}: #{issue.message}\".colorize(:red))\n if show_affected_code && (code = affected_code(source, location, issue.end_location))\n output << (code.colorize(:default))\n end\n output.puts\n end\nend\noutput.puts(finished_in_message(@started_at, Time.monotonic))\noutput.puts(final_message(sources, failed_sources))\n"}},{"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":21,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L21"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L13"},"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.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\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":[{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L6"}],"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":"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":[{"html_id":"new(output,location)-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```","summary":"Creates a new instance of ExplainFormatter.
","abstract":false,"args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"args_string":"(output, location)","args_html":"(output, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L23"},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output, location)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L28"},"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 |__arg0|\n __arg0.path == @location.filename\nend\nif source\nelse\n return\nend\nissue = source.issues.find do |__arg1|\n __arg1.location == @location\nend\nif issue\nelse\n return\nend\nexplain(source, issue)\n"}},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L12"},"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":[{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/flycheck_formatter.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/flycheck_formatter.cr#L5"},"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":[{"filename":"src/ameba/formatter/json_formatter.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L66"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L67"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L87"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L75"},"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_46 = @result.summary\n __temp_46.issues_count = __temp_46.issues_count + 1\nend\n@result.sources << json_source\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L71"},"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":[{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L5"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L6"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L9"},"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.flat_map(&.issues)\nif issues.any? do |issue|\n !issue.disabled?\nend\nelse\n @output.puts(\"No issues found. File is not generated.\")\n return\nend\nif issues.any?(&.syntax?)\n @output.puts(\"Unable to generate TODO file. Please fix syntax issues.\")\n return\nend\nfile = generate_todo_config(issues)\n@output.puts(\"Created #{file.path}\")\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":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L2"}],"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":[{"html_id":"affected_code(source,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L43"},"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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","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":"lines = source.lines\nlineno, column = location.line_number, location.column_number\nif affected_line = lines[lineno - 1]?.presence\nelse\n return\nend\nif column < max_length\n affected_line = trim(affected_line, max_length, ellipsis)\nend\nshow_context = context_lines > 0\nif show_context\n pre_context, post_context = context(lines, lineno, context_lines)\n position = prompt.size + column\n position = position - 1\nelse\n affected_line_size, affected_line = affected_line.size, affected_line.lstrip\n position = (column - (affected_line_size - affected_line.size)) + prompt.size\n position = position - 1\nend\nString.build do |str|\n if show_context\n pre_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\n str << prompt\n str.puts(affected_line.colorize(:white))\n str << (\" \" * position)\n str << (\"^\".colorize(:yellow))\n if end_location\n end_lineno = end_location.line_number\n end_column = end_location.column_number\n if (end_lineno == lineno) && end_column > column\n end_position = end_column - column\n end_position = end_position - 1\n str << ((\"-\" * end_position).colorize(:dark_gray))\n str << (\"^\".colorize(:yellow))\n end\n end\n str.puts\n if show_context\n post_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\nend\n"}},{"html_id":"context(lines,lineno,context_lines=3,remove_empty=true)-instance-method","name":"context","doc":null,"summary":null,"abstract":false,"args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"args_string":"(lines, lineno, context_lines = 3, remove_empty = true)","args_html":"(lines, lineno, context_lines = 3, remove_empty = true)","location":{"filename":"src/ameba/formatter/util.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L17"},"def":{"name":"context","args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"pre_context, post_context = [] of ::String, [] of ::String\nlines.each_with_index do |line, i|\n case i + 1\n when (lineno - context_lines)...lineno\n pre_context << line\n when (lineno + 1)..(lineno + context_lines)\n post_context << line\n end\nend\nif remove_empty\n while pre_context.first?.try(&.blank?)\n pre_context.shift\n end\n while post_context.last?.try(&.blank?)\n post_context.pop\n end\nend\n{pre_context, post_context}\n"}},{"html_id":"deansify(message:String?):String?-instance-method","name":"deansify","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String?) : String?","args_html":"(message : String?) : String?","location":{"filename":"src/ameba/formatter/util.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L3"},"def":{"name":"deansify","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"message.try do |__arg0|\n (__arg0.gsub(/\\x1b[^m]*m/, \"\")).presence\nend"}},{"html_id":"trim(str,max_length=120,ellipsis=\"...\")-instance-method","name":"trim","doc":null,"summary":null,"abstract":false,"args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"args_string":"(str, max_length = 120, ellipsis = \" ...\")","args_html":"(str, max_length = 120, ellipsis = " ...")","location":{"filename":"src/ameba/formatter/util.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L7"},"def":{"name":"trim","args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (str.size - ellipsis.size) > max_length\n str = str[0, max_length]\n if str.size > ellipsis.size\n str = str[0...(-ellipsis.size)] + ellipsis\n end\nend\nstr\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":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L3"}],"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":[{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L22"},"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.flat_map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.uniq!"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L10"},"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!(&.[](1..-1))))\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":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L3"}],"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:(?A module that utilizes inline comments parsing and processing logic.
","class_methods":[],"constructors":[],"instance_methods":[{"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.
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":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L39"},"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.name.in?(Rule::SPECIAL)\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"}},{"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```","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":67,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L67"},"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":[{"filename":"src/ameba/inline_comments.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L8"},"def":{"name":"disable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disable"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L9"},"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":[{"filename":"src/ameba/issue.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L3"}],"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":[{"html_id":"new(rule,location,end_location,message,status:Status?=nil)-class-method","name":"new","doc":null,"summary":null,"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":"Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Status? = nil)","args_html":"(rule, location, end_location, message, status : Status? = nil)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L27"},"def":{"name":"new","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":"Status | ::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":[{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location?-instance-method","name":"end_location","doc":"End location of the issue.","summary":"End location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L16"},"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"}},{"html_id":"location:Crystal::Location?-instance-method","name":"location","doc":"Location of the issue.","summary":"Location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@location"}},{"html_id":"message:String-instance-method","name":"message","doc":"Issue message.","summary":"Issue message.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L19"},"def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"html_id":"rule:Rule::Base-instance-method","name":"rule","doc":"A rule that triggers this issue.","summary":"A rule that triggers this issue.
","abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L10"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"Issue status.
","abstract":false,"args":[],"args_string":" : Status","args_html":" : Status","location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L22"},"def":{"name":"status","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Status","visibility":"Public","body":"@status"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L31"},"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/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","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":[{"filename":"src/ameba/issue.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0","doc":null,"summary":null},{"id":"Disabled","name":"Disabled","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"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":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Enabled"}}],"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":[{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L3"}],"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":[{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L28"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status?=nil):Issue-instance-method","name":"add_issue","doc":"Adds a new issue for Crystal AST *node*.","summary":"Adds a new issue for Crystal 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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L18"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node.location, node.end_location, message, status)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L23"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L36"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nend_location = Crystal::Location.new(path, *end_location)\nadd_issue(rule, location, end_location, message, status)\n"}},{"html_id":"add_issue(rule,location,end_location,message,status:Issue::Status?=nil):Issue-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":"Issue::Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L8"},"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":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(rule, location, end_location, message, status)).tap do |issue|\n issues << issue\nend\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L5"},"def":{"name":"issues","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@issues"}},{"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.
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":[{"html_id":"rules-class-method","name":"rules","doc":"Returns a list of all available rules.\n\n```\nAmeba::Rule.rules # => [Rule1, Rule2, ....]\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":200,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L200"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Base.inherited_rules"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Base","path":"Ameba/Rule/Base.html","kind":"class","full_name":"Ameba::Rule::Base","name":"Base","abstract":true,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/base.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L29"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement"},{"html_id":"ameba/Ameba/Rule/Lint/DuplicatedRequire","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","kind":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays"},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar"},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","kind":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber"},{"html_id":"ameba/Ameba/Rule/Lint/SpecFocus","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus"},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax"},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","kind":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","kind":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign"},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","kind":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen"},{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","kind":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","kind":"class","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter"},{"html_id":"ameba/Ameba/Rule/Style/IsANil","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil"},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers"},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","kind":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext"},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","kind":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn"},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","kind":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","kind":"class","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Style/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","kind":"class","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```\nclass 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.","summary":"Represents a base of all rules.
","class_methods":[{"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 class 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":161,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L161"},"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":[],"instance_methods":[{"html_id":"==(other)-instance-method","name":"==","doc":"Returns `false` (other can only be a `Value` here).","summary":"Returns false
(other can only be a Value
here).
A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
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":90,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L90"},"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)"}},{"html_id":"group-instance-method","name":"group","doc":"Returns a group this rule belong to.\n\n```\nclass MyGroup::MyRule < Ameba::Rule::Base\n # ...\nend\n\nMyGroup::MyRule.new.group # => \"MyGroup\"\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":79,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L79"},"def":{"name":"group","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).group_name"}},{"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.
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":66,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L66"},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).rule_name"}},{"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```","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":103,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L103"},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.in?(SPECIAL)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L41"},"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":""}},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L37"},"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":[{"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)","args_html":"(*args)","location":{"filename":"src/ameba/rule/base.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L115"},"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":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/line_length.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_blank_lines.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/line_length.cr#L11"}],"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```","summary":"A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows trailing blank lines at the end of the source file.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"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_empty = last_source_line.empty?\nif source_lines_size >= 1 && ((source_lines.last(2)).join.blank? || (!last_line_empty))\n issue_for({source_lines_size - 1, 1}, last_line_empty ? MSG : MSG_FINAL_NEWLINE)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","path":"Ameba/Rule/Layout/TrailingWhitespace.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"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```","summary":"A rule that disallows trailing whitespaces.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":17,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"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 issue_for({index + 1, line.size}, MSG)\n end\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":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L1"},{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L1"},{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L1"},{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L1"},{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L1"},{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L1"},{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L1"},{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/rand_zero.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_string_coercion.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_with_index.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_with_object.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L1"},{"filename":"src/ameba/rule/lint/syntax.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L1"},{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L1"},{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L1"},{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"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/AmbiguousAssignment","path":"Ameba/Rule/Lint/AmbiguousAssignment.html","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\" => \"-=\", \"=+\" => \"+=\", \"=!\" => \"!=\"}","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\"","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":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand assignments.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand 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/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/lint/ambiguous_assignment.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L35"},"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 op_end_location = node.value.location\nelse\n return\nend\nop_location = Crystal::Location.new(op_end_location.filename, op_end_location.line_number, op_end_location.column_number - 1)\nop_text = source_between(op_location, op_end_location, source.lines)\nif op_text\nelse\n return\nend\nif MISTAKES.has_key?(op_text)\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % MISTAKES[op_text])\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","path":"Ameba/Rule/Lint/BadDirective.html","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L20"}],"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```","summary":"A rule that reports incorrect comment directives for Ameba.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L29"},"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":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"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},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] 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/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```","summary":"A rule that disallows comparison to booleans.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L31"},"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 = node.name.in?(OP_NAMES)\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\n issue_for(node, MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","path":"Ameba/Rule/Lint/DebuggerStatement.html","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L13"}],"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```","summary":"A rule that disallows calls to debugger.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L13"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L20"},"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/DuplicatedRequire","path":"Ameba/Rule/Lint/DuplicatedRequire.html","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require 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 duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","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/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L16"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/duplicated_require.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L23"},"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":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if processed_require_strings.includes?(node.string)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","path":"Ameba/Rule/Lint/EmptyEnsure.html","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L41"}],"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```","summary":"A rule that disallows empty ensure statement.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L41"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L30"}],"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```","summary":"A rule that disallows empty expressions.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L41"},"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)\nif exp.in?(nil, \"nil\")\n return\nend\nissue_for(node, MSG % exp)\n"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L40"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L49"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L55"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L59"},"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":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"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```","summary":"A rule that disallows duplicated keys in hash literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"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)).empty?\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":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L22"}],"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```","summary":"A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L22"},"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":[{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L32"},"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)\n issue_for(node, MSG)\nend"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L36"},"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)"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L40"},"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)"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L44"},"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":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"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```","summary":"A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L26"}],"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```","summary":"A rule that disallows some unwanted symbols in percent array literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L26"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L36"},"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 end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","path":"Ameba/Rule/Lint/RandZero.html","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/rand_zero.cr#L25"}],"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```","summary":"A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows string conversion in string interpolation, which is redundant.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"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":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_with_index.cr#L29"}],"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```","summary":"A rule that disallows redundant with_index
calls.
A rule that disallows redundant with_index
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows shadowed arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":38,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L38"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L49"},"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L45"},"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":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"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```","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":[{"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)"}},{"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```","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":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L36"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L43"},"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.try(&.map(&.types))\nelse\n return\nend\nif (excs = shadowed(excs)).empty?\n return\nend\nissue_for(node, MSG % (excs.join(\", \")))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","path":"Ameba/Rule/Lint/ShadowingOuterLocalVar.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"}],"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```","summary":"A rule that disallows the usage of the same name as outer local variables for block or proc arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L45"},"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)"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L49"},"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)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L41"},"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":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"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```","summary":"A rule that disallows using shared variables in fibers, which are mutated during iterations.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":52,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":63,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"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"}},{"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":59,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"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/SpecFocus","path":"Ameba/Rule/Lint/SpecFocus.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\"","doc":null,"summary":null},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] 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/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","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/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L47"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/spec_focus.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L61"},"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.in?(SPEC_ITEM_NAMES)\nelse\n return\nend\nif node.block\nelse\n return\nend\narg = node.named_args.try(&.find() do |__arg1|\n __arg1.name == \"focus\"\nend)\nif arg\n issue_for(arg, MSG)\nend\n"}},{"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/spec_focus.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L55"},"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":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","path":"Ameba/Rule/Lint/Syntax.html","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/syntax.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L21"}],"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```","summary":"A rule that reports invalid Crystal syntax.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":21,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L21"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"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```","summary":"A rule that reports unneeded disable directives.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"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.empty?\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":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L44"}],"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```","summary":"A rule that reports unreachable code.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L44"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":57,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L57"},"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"}},{"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":53,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L53"},"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":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L27"}],"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```","summary":"A rule that reports unused arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L43"},"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))"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L47"},"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))"}},{"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":51,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L51"},"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))"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L39"},"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":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L28"}],"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```","summary":"A rule that disallows useless assignments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L28"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L39"},"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.ignored? || var.used_in_macro?) || var.captured_by_block?\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"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L35"},"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":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"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```","summary":"A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"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":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"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```","summary":"A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
A general base class for performance rules.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A general base class for performance rules.","summary":"A general base class for performance rules.
","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/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/base.cr#L5"},"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":[{"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```","summary":"A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
All these methods are allocating a new object
"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\"","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 chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","class_methods":[],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"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":[{"html_id":"call_names:Array(String)-instance-method","name":"call_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"call_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","location":null,"def":{"name":"call_names=","args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@call_names = call_names"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/chained_call_with_no_bang.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/chained_call_with_no_bang.cr#L68"},"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 (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif node.name.in?(call_names)\nelse\n return\nend\nif (obj.name.in?(call_names)) || (obj.name.in?(ALLOCATING_METHOD_NAMES))\nelse\n return\nend\nissue_for(node.name_location, node.name_end_location, MSG % {node.name, obj.name})\n"}},{"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/chained_call_with_no_bang.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/chained_call_with_no_bang.cr#L59"},"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/CompactAfterMap","path":"Ameba/Rule/Performance/CompactAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"COMPACT_NAME","name":"COMPACT_NAME","value":"\"compact\"","doc":null,"summary":null},{"id":"MAP_NAME","name":"MAP_NAME","value":"\"map\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\"","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 `compact` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.match(/^A./)).compact\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].compact_map(&.match(/^A./))\n```\n\nYAML configuration example:\n\n```\nPerformance/CompactAfterMap:\n Enabled: true\n```","summary":"This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
A rule that enforces constant names to be in screaming case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/constant_names.cr#L24"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/constant_names.cr#L31"},"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 name.in?(expected, name.camelcase)\n return\n end\n issue_for(target, MSG % {expected, name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","path":"Ameba/Rule/Style/IsAFilter.html","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s(%s)` instead 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/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"This rule is used to identify usage of `is_a?/nil?` calls within filters.\n\nFor example, this is considered invalid:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(&.is_a?(Regex::MatchData)) # => true\nmatches.one?(&.nil?) # => true\n\ntypeof(matches.reject(&.nil?)) # => Array(Regex::MatchData | Nil)\ntypeof(matches.select(&.is_a?(Regex::MatchData))) # => Array(Regex::MatchData | Nil)\n```\n\nAnd it should be written as this:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(Regex::MatchData) # => true\nmatches.one?(Nil) # => true\n\ntypeof(matches.reject(Nil)) # => Array(Regex::MatchData)\ntypeof(matches.select(Regex::MatchData)) # => Array(Regex::MatchData)\n```\n\nYAML configuration example:\n\n```\nStyle/IsAFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n - any?\n - all?\n - none?\n - one?\n```","summary":"This rule is used to identify usage of is_a?/nil?
calls within filters.
This rule is used to identify usage of is_a?/nil?
calls within filters.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows usage of large numbers without underscore.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/large_numbers.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/large_numbers.cr#L38"},"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":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/method_names.cr#L40"}],"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```","summary":"A rule that enforces method names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/method_names.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/method_names.cr#L47"},"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 && column_number\nelse\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":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"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```","summary":"A rule that disallows negated conditions in unless.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","path":"Ameba/Rule/Style/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/predicate_name.cr#L31"}],"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```","summary":"A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows redundant begin blocks.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":58,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_begin.cr#L58"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_begin.cr#L67"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","path":"Ameba/Rule/Style/RedundantNext.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L99"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L99"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L113"},"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"}},{"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":109,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L109"},"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":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L96"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L96"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":110,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L110"},"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"}},{"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":106,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L106"},"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":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L54"}],"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```","summary":"A rule that enforces type names in camelcase manner.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":54,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L54"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":69,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L69"},"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)"}},{"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":73,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L73"},"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)"}},{"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":77,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L77"},"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)"}},{"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":81,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L81"},"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)"}},{"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":85,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L85"},"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":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/unless_else.cr#L45"}],"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```","summary":"A rule that disallows the use of an else
block with the unless
.
A rule that disallows the use of an else
block with the unless
.
A rule that enforces variable names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":25,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L25"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L38"},"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)"}},{"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":42,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L42"},"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)"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L46"},"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/VerboseBlock","path":"Ameba/Rule/Style/VerboseBlock.html","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%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":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","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/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/verbose_block.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"html_id":"exclude_calls_with_block:Bool-instance-method","name":"exclude_calls_with_block","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_calls_with_block","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","location":null,"def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks:Bool-instance-method","name":"exclude_multiple_line_blocks","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_multiple_line_blocks","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","location":null,"def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_operators:Bool-instance-method","name":"exclude_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","location":null,"def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_prefix_operators:Bool-instance-method","name":"exclude_prefix_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_prefix_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","location":null,"def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_setters:Bool-instance-method","name":"exclude_setters","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_setters","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","location":null,"def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"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"}},{"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"}},{"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 | ::Nil","visibility":"Public","body":"@max_length"}},{"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 | ::Nil"}],"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 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Int32?-instance-method","name":"max_line_length","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32?","args_html":" : Int32?","location":null,"def":{"name":"max_line_length","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32 | ::Nil","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Int32?)-instance-method","name":"max_line_length=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"args_string":"(max_line_length : Int32?)","args_html":"(max_line_length : Int32?)","location":null,"def":{"name":"max_line_length=","args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_line_length = max_line_length"}},{"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"}},{"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"}},{"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/style/verbose_block.cr","line_number":189,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/verbose_block.cr#L189"},"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 (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\nif arg.name.starts_with?(\"__arg\")\n return\nend\nif (body = block.body).is_a?(Crystal::Call)\nelse\n return\nend\nobj = body.obj\nwhile obj.is_a?(Crystal::Call)\n obj = obj.obj\nend\nif obj == arg\nelse\n return\nend\nif (reference_count(body, arg)) > 1\n return\nend\nissue_for_valid(source, node, body)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","path":"Ameba/Rule/Style/WhileTrue.html","kind":"class","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/while_true.cr#L28"}],"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```","summary":"A rule that disallows the use of while true
instead of using the idiomatic loop
A rule that disallows the use of while true
instead of using the idiomatic loop
Represents a runner for inspecting sources files.
","class_methods":[],"constructors":[{"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```","summary":"Instantiates a runner using a config
.
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":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L113"},"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)"}},{"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```","summary":"Performs the inspection.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L66"},"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 |chan|\n chan.receive.try do |e|\n raise(e)\n end\n end\n self\nensure\n @formatter.finished(@sources)\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L18"},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Source)","visibility":"Public","body":"@sources"}},{"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```","summary":"Indicates whether the last inspection successful or not.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":125,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L125"},"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 |__arg4|\n __arg4.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":[{"filename":"src/ameba/severity.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L2"}],"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":[{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L26"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L5"},"def":{"name":"convention?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Convention"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L3"},"def":{"name":"error?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Error"}},{"html_id":"symbol:Char-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":" : Char","args_html":" : Char","location":{"filename":"src/ameba/severity.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L12"},"def":{"name":"symbol","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Char","visibility":"Public","body":"case self\nin Error\n 'E'\nin Warning\n 'W'\nin Convention\n 'C'\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L4"},"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":[{"filename":"src/ameba/severity.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L34"}],"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.
An entity that represents a Crystal source file.
","class_methods":[],"constructors":[{"html_id":"new(code:String,path=\"\",normalize=true)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""}],"args_string":"(code : String, path = \"\", normalize = true)","args_html":"(code : String, path = "", normalize = true)","location":{"filename":"src/ameba/spec/support.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/support.cr#L11"},"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":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(code, path, normalize)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(code,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```","summary":"Creates a new source by #code
and #path
.
Returns AST nodes constructed by Crystal::Parser
.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L12"},"def":{"name":"code","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L52"},"def":{"name":"fullpath","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"if (value = @fullpath).nil?\n @fullpath = (File.expand_path(path))\nelse\n value\nend"}},{"html_id":"lines:Array(String)-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":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/source.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L36"},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"if (value = @lines).nil?\n @lines = (code.split('\\n'))\nelse\n value\nend"}},{"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.
Path to the source file.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L9"},"def":{"name":"path","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"spec?-instance-method","name":"spec?","doc":"Returns `true` if the source is a spec file, `false` otherwise.","summary":"Returns true
if the source is a spec file, false
otherwise.
Parsed representation of code annotated with the # ^^^ error: Message
style
Separates annotation lines from code lines.
","abstract":false,"args":[{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":""}],"args_string":"(annotated_code)","args_html":"(annotated_code)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L15"},"def":{"name":"parse","args":[{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"lines = [] of String\nannotations = [] of ::Tuple(Int32, String, String)\nannotated_code.each_line do |code_line|\n if ( annotation_match = ANNOTATION_PATTERN_1.match(code_line))\n message_index = annotation_match.end\n prefix = code_line[0...message_index]\n message = code_line[message_index...]\n annotations << {lines.size, prefix, message}\n else\n if ( annotation_index = code_line.index(ANNOTATION_PATTERN_2))\n lines << code_line[...annotation_index]\n message_index = annotation_index + ANNOTATION_PATTERN_2.size\n message = code_line[message_index...]\n annotations << {lines.size, \"\", message}\n else\n lines << code_line\n end\n end\nend\nif lines.empty?\n annotations.map! do |_, prefix, message|\n {1, prefix, message}\n end\nend\nnew(lines, annotations)\n"}}],"constructors":[{"html_id":"new(lines,annotations:Enumerable(Tuple(Int32,String,String)))-class-method","name":"new","doc":"NOTE: Annotations are sorted so that reconstructing the annotation\n text via `#to_s` is deterministic.","summary":"NOTE Annotations are sorted so that reconstructing the annotation text via #to_s
is deterministic.
Annotates the source code with the Ameba issues provided.
","abstract":false,"args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"issues","doc":null,"default_value":"","external_name":"issues","restriction":"Enumerable(Issue)"}],"args_string":"(lines, issues : Enumerable(Issue))","args_html":"(lines, issues : Enumerable(Issue))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L47"},"def":{"name":"new","args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"issues","doc":null,"default_value":"","external_name":"issues","restriction":"Enumerable(Issue)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(lines, issues)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(other)-instance-method","name":"==","doc":"Returns `false` (other can only be a `Value` here).","summary":"Returns false
(other can only be a Value
here).
Each entry is the line number, annotation prefix, and message.
","abstract":false,"args":[],"args_string":" : Array(Tuple(Int32, String, String))","args_html":" : Array(Tuple(Int32, String, String))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L11"},"def":{"name":"annotations","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(::Tuple(Int32, String, String))","visibility":"Public","body":"@annotations"}},{"html_id":"lines:Array(String)-instance-method","name":"lines","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L7"},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@lines"}},{"html_id":"to_s(io)-instance-method","name":"to_s","doc":"Constructs an annotated source string (like what we parse).\n\nReconstructs a deterministic annotated source string. This is\nuseful for eliminating semantically irrelevant annotation\nordering differences.\n\n source1 = AnnotatedSource.parse(<<-CRYSTAL)\n line1\n ^ Annotation 1\n ^^ Annotation 2\n CRYSTAL\n\n source2 = AnnotatedSource.parse(<<-CRYSTAL)\n line1\n ^^ Annotation 2\n ^ Annotation 1\n CRYSTAL\n\n source1.to_s == source2.to_s # => true","summary":"Constructs an annotated source string (like what we parse).
","abstract":false,"args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L102"},"def":{"name":"to_s","args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"reconstructed = lines.dup\nannotations.reverse_each do |line_number, prefix, message|\n if prefix.empty?\n __temp_52 = line_number - 1\n reconstructed[__temp_52] = reconstructed[__temp_52] + \"#{ANNOTATION_PATTERN_2}#{message}\"\n else\n if lines.empty?\n line_number = 0\n end\n reconstructed.insert(line_number, \"#{prefix}#{message}\")\n end\nend\nio << (reconstructed.join('\\n'))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/BeValid","path":"Ameba/Spec/BeValid.html","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"src/ameba/spec/be_valid.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L2"}],"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/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"html_id":"be_valid-instance-method","name":"be_valid","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/spec/be_valid.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L3"},"def":{"name":"be_valid","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"BeValidExpectation.new"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/BeValidExpectation","path":"Ameba/Spec/BeValidExpectation.html","kind":"struct","full_name":"Ameba::Spec::BeValidExpectation","name":"BeValidExpectation","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":[{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L8"}],"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/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"html_id":"new-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L8"},"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":[{"html_id":"failure_message(source)-instance-method","name":"failure_message","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/spec/be_valid.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L13"},"def":{"name":"failure_message","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":"String.build do |str|\n str << \"Source expected to be valid, but there are issues: \\n\\n\"\n source.issues.reject(&.disabled?).each do |e|\n str << \" * #{e.rule.name}: #{e.message}\\n\"\n end\nend"}},{"html_id":"match(source)-instance-method","name":"match","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/spec/be_valid.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L9"},"def":{"name":"match","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.valid?"}},{"html_id":"negative_failure_message(source)-instance-method","name":"negative_failure_message","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/spec/be_valid.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L22"},"def":{"name":"negative_failure_message","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 expected to be invalid, but it is valid.\""}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/ExpectIssue","path":"Ameba/Spec/ExpectIssue.html","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue","abstract":false,"superclass":null,"ancestors":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"locations":[{"filename":"src/ameba/spec/expect_issue.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/expect_issue.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"This mixin makes it easier to specify strict issue expectations\nin a declarative and visual fashion. Just type out the code that\nshould generate an issue, annotate code by writing '^'s\nunderneath each character that should be highlighted, and follow\nthe carets with a string (separated by a space) that is the\nmessage of the issue. You can include multiple issues in\none code snippet.\n\nUsage:\n\n expect_issue subject, %(\n def foo\n a do\n b\n end.c\n # ^^^^^ error: Avoid chaining a method call on a do...end block.\n end\n )\n\nEquivalent assertion without `expect_issue`:\n\n source = Source.new %(\n def foo\n a do\n b\n end.c\n end\n ), \"source.cr\"\n subject.catch(source).should_not be_valid\n source.issues.size.should be(1)\n\n issue = source.issues.first\n issue.location.to_s.should eq \"source.cr:4:3\"\n issue.end_location.to_s.should eq \"source.cr:4:7\"\n issue.message.should eq(\n \"Avoid chaining a method call on a do...end block.\"\n )\n\nIf you do not want to specify an issue then use the\ncompanion method `expect_no_issues`. This method is a much\nsimpler assertion since it just inspects the code and checks\nthat there were no issues. The `expect_issue` method has\nto do more work by parsing out lines that contain carets.","summary":"This mixin makes it easier to specify strict issue expectations in a declarative and visual fashion.
","class_methods":[],"constructors":[],"instance_methods":[{"html_id":"expect_issue(rules:Rule::Base|Enumerable(Rule::Base),annotated_code:String,path=\"\",normalize=true,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_issue","doc":null,"summary":null,"abstract":false,"args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = \"\", normalize = true, *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = "", normalize = true, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/expect_issue.cr#L50"},"def":{"name":"expect_issue","args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":null,"splat_index":4,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if normalize\n annotated_code = normalize_code(annotated_code)\nend\nexpected_annotations = AnnotatedSource.parse(annotated_code)\nlines = expected_annotations.lines\ncode = lines.join('\\n')\nif code == annotated_code\n raise(\"Use `report_no_issues` to assert that no issues are found\")\nend\nactual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations == expected_annotations\nelse\n fail(\"Expected:\\n\\n#{expected_annotations}\\n\\nGot:\\n\\n#{actual_annotations}\", file, line)\nend\n"}},{"html_id":"expect_no_issues(rules:Rule::Base|Enumerable(Rule::Base),code:String,path=\"\",normalize=true,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_issues","doc":null,"summary":null,"abstract":false,"args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = \"\", normalize = true, *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = "", normalize = true, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/expect_issue.cr#L80"},"def":{"name":"expect_no_issues","args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":null,"splat_index":4,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if normalize\n code = normalize_code(code)\nend\nlines = code.lines\nactual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations.to_s == code\nelse\n fail(\"Expected no issues, but got:\\n\\n#{actual_annotations}\", file, line)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/Util","path":"Ameba/Spec/Util.html","kind":"module","full_name":"Ameba::Spec::Util","name":"Util","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"src/ameba/spec/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/util.cr#L1"}],"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"},{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"html_id":"normalize_code(code,separator='\\n')-instance-method","name":"normalize_code","doc":null,"summary":null,"abstract":false,"args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":""},{"name":"separator","doc":null,"default_value":"'\\n'","external_name":"separator","restriction":""}],"args_string":"(code, separator = '\\n')","args_html":"(code, separator = '\\n')","location":{"filename":"src/ameba/spec/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/util.cr#L2"},"def":{"name":"normalize_code","args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":""},{"name":"separator","doc":null,"default_value":"'\\n'","external_name":"separator","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"lines = code.split(separator)\nif lines[0].blank? && lines.size > 1\n lines.shift\nend\nmin_indent = lines.min_of do |line|\n line.blank? ? code.size : line.size - line.lstrip.size\nend\nlines.join(separator) do |line|\n line.blank? ? line : line[min_indent..]\nend\n"}}],"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":[{"filename":"src/ameba/tokenizer.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/tokenizer.cr#L14"}],"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
.
Instantiates Tokenizer using a lexer
.
Instantiates Tokenizer using a source
.
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":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/tokenizer.cr#L45"},"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/search-index.js b/search-index.js index 7c795c85..9e1bcacb 100644 --- a/search-index.js +++ b/search-index.js @@ -1 +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 * [Watch a tutorial](#watch-a-tutorial)\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/reference/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\n129 inspected, 2 failures\n```\n\n### Watch a tutorial\n\n\n\n[🎬 Watch the LuckyCast showing how to use Ameba](https://luckycasts.com/videos/ameba)\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":[{"filename":"src/ameba.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba.cr#L23"},{"filename":"src/ameba/glob_utils.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/glob_utils.cr#L1"},{"filename":"src/ameba/inline_comments.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L1"},{"filename":"src/ameba/issue.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L1"},{"filename":"src/ameba/reportable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L1"},{"filename":"src/ameba/runner.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L1"},{"filename":"src/ameba/severity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L1"},{"filename":"src/ameba/source.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L1"},{"filename":"src/ameba/tokenizer.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/tokenizer.cr#L3"}],"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/runner/work/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```","summary":"Ameba's entry module.
","class_methods":[],"constructors":[],"instance_methods":[{"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```","summary":"Initializes Ameba::Runner
and runs it.
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
.
Represents the argument of some node.
","class_methods":[],"constructors":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L35"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L40"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L17"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L24"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/argument.cr#L20"},"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":[{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L7"}],"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":[{"html_id":"new(node,variable,scope)-class-method","name":"new","doc":"Creates a new assignment.\n\n```\nAssignment.new(node, variable, scope)\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":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L24"},"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"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L60"},"def":{"name":"in_branch?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!branch.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L50"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L40"},"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?)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L65"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L22"},"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"}},{"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```","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":97,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L97"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/assignment.cr#L14"},"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":[{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/base_visitor.cr#L6"}],"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":[{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/base_visitor.cr#L18"},"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":[{"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
.
Represents the branch in Crystal code.
","class_methods":[{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L65"},"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"}},{"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":56,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L56"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L33"},"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":[{"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.
See Object#hash(hasher)
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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L47"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.loop?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L17"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L20"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branch.cr#L22"},"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":[{"filename":"src/ameba/ast/branchable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L15"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L35"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L18"},"def":{"name":"branches","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@branches"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L39"},"def":{"name":"loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((loop?(node)) || parent.try(&.loop?)) || false"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L21"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L24"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L26"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/branchable.cr#L26"},"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":[{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L8"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L5"},"def":{"name":"macro_condition","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/counting_visitor.cr#L44"},"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":[{"filename":"src/ameba/ast/flow_expression.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L18"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L36"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/flow_expression.cr#L50"},"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\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":[{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/flow_expression_visitor.cr#L12"},"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":[{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L10"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L6"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L6"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L5"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L5"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L7"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L7"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L8"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/ivariable.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/node_visitor.cr#L39"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/node_visitor.cr#L42"},"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":[{"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.
A visit callback for Crystal::IsA
node.
A visit callback for Crystal::Assign
node.
A visit callback for Crystal::Call
node.
A visit callback for Crystal::Block
node.
A visit callback for Crystal::Case
node.
A visit callback for Crystal::ClassDef
node.
A visit callback for Crystal::ClassVar
node.
A visit callback for Crystal::Def
node.
A visit callback for Crystal::EnumDef
node.
A visit callback for Crystal::ExceptionHandler
node.
A visit callback for Crystal::Expressions
node.
A visit callback for Crystal::HashLiteral
node.
A visit callback for Crystal::If
node.
A visit callback for Crystal::InstanceVar
node.
A visit callback for Crystal::LibDef
node.
A visit callback for Crystal::ModuleDef
node.
A visit callback for Crystal::NilLiteral
node.
A visit callback for Crystal::StringInterpolation
node.
A visit callback for Crystal::Unless
node.
A visit callback for Crystal::Var
node.
A visit callback for Crystal::When
node.
A visit callback for Crystal::While
node.
A visit callback for Crystal::Until
node.
A class that utilizes a logic to traverse AST nodes and fire a source test callback if a redundant Crystal::ControlExpression
is reached.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"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":[{"filename":"src/ameba/ast/variabling/reference.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/reference.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/reference.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/reference.cr#L8"},"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":[{"filename":"src/ameba/ast/scope.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L39"},"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":[{"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.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L59"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L70"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L49"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L155"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L14"},"def":{"name":"arguments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@arguments"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L90"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L119"},"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 |__arg6|\n __arg6.name == name\nend && ivariables.find do |__arg7|\n __arg7.name == \"@#{name}\"\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L96"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L145"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L30"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L30"},"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"}},{"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
.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L80"},"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 |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L114"},"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?)))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L23"},"def":{"name":"inner_scopes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@inner_scopes"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L17"},"def":{"name":"ivariables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ivariables"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L26"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L11"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"html_id":"references?(variable:Variable,check_inner_scopes=true)-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"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(variable : Variable, check_inner_scopes = true)","args_html":"(variable : Variable, check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":137,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L137"},"def":{"name":"references?","args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variable.references.any? do |reference|\n if reference.scope == self\n return true\n end\n check_inner_scopes && inner_scopes.any?(&.references?(variable))\nend || variable.used_in_macro?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L107"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L150"},"def":{"name":"top_level?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"outer_scope.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L126"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/scope.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"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":[{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/scope_visitor.cr#L12"},"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/TopLevelNodesVisitor","path":"Ameba/AST/TopLevelNodesVisitor.html","kind":"class","full_name":"Ameba::AST::TopLevelNodesVisitor","name":"TopLevelNodesVisitor","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":[{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"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":"AST Visitor that visits certain nodes at a top level, which\ncan characterize the source (i.e. require statements, modules etc.)","summary":"AST Visitor that visits certain nodes at a top level, which can characterize the source (i.e.
","class_methods":[],"constructors":[{"html_id":"new(scope:Crystal::ASTNode)-class-method","name":"new","doc":"Creates a new instance of visitor","summary":"Creates a new instance of 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/top_level_nodes_visitor.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"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":[{"html_id":"require_nodes:Array(Crystal::Require)-instance-method","name":"require_nodes","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Crystal::Require)","args_html":" : Array(Crystal::Require)","location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is Crystal::Expressions traverse the children.","summary":"If a top level node is Crystal::Expressions traverse the children.
","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/top_level_nodes_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L18"},"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":"true"}},{"html_id":"visit(node:Crystal::ASTNode)-instance-method","name":"visit","doc":"A general visit method for rest of the nodes.\nReturns false meaning all child nodes will not be traversed.","summary":"A general visit method for rest of the nodes.
","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/top_level_nodes_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L24"},"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":"false"}}],"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":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L2"}],"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/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","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":[{"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.
Returns true if node represents exit
method call.
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":67,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L67"},"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"}},{"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).","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":105,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L105"},"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"}},{"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.
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":151,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L151"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L33"},"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\nsource_between(loc, end_loc, code_lines)\n"}},{"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.
Returns the source code from loc to end_loc (inclusive).
","abstract":false,"args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String?","args_html":"(loc, end_loc, code_lines) : String?","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/util.cr#L42"},"def":{"name":"source_between","args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","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":"String | ::Nil","visibility":"Public","body":"line, 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.join('\\n')\n"}}],"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":[{"filename":"src/ameba/ast/variabling/variable.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L4"}],"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":[{"html_id":"new(node,scope)-class-method","name":"new","doc":"Creates a new variable(in the scope).\n\n```\nVariable.new(node, scope)\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":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L30"},"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":[{"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```","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L47"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@assignments"}},{"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":111,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L111"},"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, check_inner_scopes: false))\n return true\n end\n if captured_by_block?(inner_scope)\n return true\n end\nend\nfalse\n"}},{"html_id":"declared_before?(node)-instance-method","name":"declared_before?","doc":"Returns true if the variable is declared before the `node`.","summary":"Returns true if the variable is declared before the #node
.
Returns true if the #node
represents exactly the same Crystal node as @node
.
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":145,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L145"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L20"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var","visibility":"Public","body":"@node"}},{"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```","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":70,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L70"},"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"}},{"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":84,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L84"},"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 branch = assignment.branch\n else\n break\n end\n consumed_branches << branch\nend\n"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L60"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!references.empty?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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 $?
.
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":133,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L133"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L23"},"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"}},{"html_id":"used_in_macro?(scope=@scope)-instance-method","name":"used_in_macro?","doc":"Returns true if current variable potentially referenced in a macro,\nfalse if not.","summary":"Returns true if current variable potentially referenced in a macro, 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":122,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/ast/variabling/variable.cr#L122"},"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 (MacroReferenceFinder.new(inner_scope.node, node.name)).references\n return true\n end\nend\nif (MacroReferenceFinder.new(scope.node, node.name)).references\n return true\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":[{"filename":"src/ameba/config.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L15"}],"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
.
Loads YAML configuration file by path
.
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":55,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L55"},"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@excluded"}},{"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":55,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L55"},"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"}},{"html_id":"formatter:Formatter::BaseFormatter-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":" : Formatter::BaseFormatter","args_html":" : Formatter::BaseFormatter","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L113"},"def":{"name":"formatter","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Formatter::BaseFormatter","visibility":"Public","body":"if (value = @formatter).nil?\n @formatter = (Formatter::DotFormatter.new)\nelse\n value\nend"}},{"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```","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":123,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L123"},"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"}},{"html_id":"formatter=(formatter:Formatter::BaseFormatter)-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":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L113"},"def":{"name":"formatter=","args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter = formatter"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L46"},"def":{"name":"globs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@globs"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L46"},"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L34"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L35"},"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L35"},"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"}},{"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```","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":99,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L99"},"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"}},{"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```","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":137,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L137"},"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":"rule = @rules.find do |__arg2|\n __arg2.name == name\nend\nif rule\nelse\n raise(ArgumentError.new(\"Rule `#{name}` does not exist\"))\nend\nrule.tap(&.enabled = enabled).tap(&.excluded = excluded)\n"}},{"html_id":"update_rules(names,enabled=true,excluded=nil)-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```","summary":"Updates rules properties.
","abstract":false,"args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"(names, enabled = true, excluded = nil)","args_html":"(names, enabled = true, excluded = nil)","location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/config.cr#L158"},"def":{"name":"update_rules","args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"names.try(&.each do |name|\n if rules = @rule_groups[name]?\n rules.each do |rule|\n rule.enabled = enabled\n rule.excluded = excluded\n end\n else\n update_rule(name, enabled, excluded)\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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L4"},{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/disabled_formatter.cr#L1"},{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L3"},{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L3"},{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/flycheck_formatter.cr#L1"},{"filename":"src/ameba/formatter/json_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L3"},{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L1"}],"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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L8"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L13"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L30"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L10"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L22"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L26"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/base_formatter.cr#L18"},"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":[{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/disabled_formatter.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/disabled_formatter.cr#L4"},"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":[{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L6"}],"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":[{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L27"},"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.puts(location.colorize(:cyan))\n output.puts(\"[#{issue.rule.severity.symbol}] #{issue.rule.name}: #{issue.message}\".colorize(:red))\n if show_affected_code && (code = affected_code(source, location, issue.end_location))\n output << (code.colorize(:default))\n end\n output.puts\n end\nend\noutput.puts(finished_in_message(@started_at, Time.monotonic))\noutput.puts(final_message(sources, failed_sources))\n"}},{"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":21,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L21"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/dot_formatter.cr#L13"},"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.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\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":[{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L6"}],"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":"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":[{"html_id":"new(output,location)-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```","summary":"Creates a new instance of ExplainFormatter.
","abstract":false,"args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"args_string":"(output, location)","args_html":"(output, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L23"},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output, location)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L28"},"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 |__arg0|\n __arg0.path == @location.filename\nend\nif source\nelse\n return\nend\nissue = source.issues.find do |__arg1|\n __arg1.location == @location\nend\nif issue\nelse\n return\nend\nexplain(source, issue)\n"}},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/explain_formatter.cr#L12"},"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":[{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/flycheck_formatter.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/flycheck_formatter.cr#L5"},"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":[{"filename":"src/ameba/formatter/json_formatter.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L66"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L67"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L87"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L75"},"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_46 = @result.summary\n __temp_46.issues_count = __temp_46.issues_count + 1\nend\n@result.sources << json_source\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/json_formatter.cr#L71"},"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":[{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L5"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L6"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/todo_formatter.cr#L9"},"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.flat_map(&.issues)\nif issues.any? do |issue|\n !issue.disabled?\nend\nelse\n @output.puts(\"No issues found. File is not generated.\")\n return\nend\nif issues.any?(&.syntax?)\n @output.puts(\"Unable to generate TODO file. Please fix syntax issues.\")\n return\nend\nfile = generate_todo_config(issues)\n@output.puts(\"Created #{file.path}\")\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":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L2"}],"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":[{"html_id":"affected_code(source,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L43"},"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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","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":"lines = source.lines\nlineno, column = location.line_number, location.column_number\nif affected_line = lines[lineno - 1]?.presence\nelse\n return\nend\nif column < max_length\n affected_line = trim(affected_line, max_length, ellipsis)\nend\nshow_context = context_lines > 0\nif show_context\n pre_context, post_context = context(lines, lineno, context_lines)\n position = prompt.size + column\n position = position - 1\nelse\n affected_line_size, affected_line = affected_line.size, affected_line.lstrip\n position = (column - (affected_line_size - affected_line.size)) + prompt.size\n position = position - 1\nend\nString.build do |str|\n if show_context\n pre_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\n str << prompt\n str.puts(affected_line.colorize(:white))\n str << (\" \" * position)\n str << (\"^\".colorize(:yellow))\n if end_location\n end_lineno = end_location.line_number\n end_column = end_location.column_number\n if (end_lineno == lineno) && end_column > column\n end_position = end_column - column\n end_position = end_position - 1\n str << ((\"-\" * end_position).colorize(:dark_gray))\n str << (\"^\".colorize(:yellow))\n end\n end\n str.puts\n if show_context\n post_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\nend\n"}},{"html_id":"context(lines,lineno,context_lines=3,remove_empty=true)-instance-method","name":"context","doc":null,"summary":null,"abstract":false,"args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"args_string":"(lines, lineno, context_lines = 3, remove_empty = true)","args_html":"(lines, lineno, context_lines = 3, remove_empty = true)","location":{"filename":"src/ameba/formatter/util.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L17"},"def":{"name":"context","args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"pre_context, post_context = [] of ::String, [] of ::String\nlines.each_with_index do |line, i|\n case i + 1\n when (lineno - context_lines)...lineno\n pre_context << line\n when (lineno + 1)..(lineno + context_lines)\n post_context << line\n end\nend\nif remove_empty\n while pre_context.first?.try(&.blank?)\n pre_context.shift\n end\n while post_context.last?.try(&.blank?)\n post_context.pop\n end\nend\n{pre_context, post_context}\n"}},{"html_id":"deansify(message:String?):String?-instance-method","name":"deansify","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String?) : String?","args_html":"(message : String?) : String?","location":{"filename":"src/ameba/formatter/util.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L3"},"def":{"name":"deansify","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"message.try do |__arg0|\n (__arg0.gsub(/\\x1b[^m]*m/, \"\")).presence\nend"}},{"html_id":"trim(str,max_length=120,ellipsis=\"...\")-instance-method","name":"trim","doc":null,"summary":null,"abstract":false,"args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"args_string":"(str, max_length = 120, ellipsis = \" ...\")","args_html":"(str, max_length = 120, ellipsis = " ...")","location":{"filename":"src/ameba/formatter/util.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/formatter/util.cr#L7"},"def":{"name":"trim","args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (str.size - ellipsis.size) > max_length\n str = str[0, max_length]\n if str.size > ellipsis.size\n str = str[0...(-ellipsis.size)] + ellipsis\n end\nend\nstr\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":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/glob_utils.cr#L3"}],"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":[{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/glob_utils.cr#L22"},"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.flat_map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.uniq!"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/glob_utils.cr#L10"},"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!(&.[](1..-1))))\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":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L3"}],"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:(?A module that utilizes inline comments parsing and processing logic.
","class_methods":[],"constructors":[],"instance_methods":[{"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.
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":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L39"},"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.name.in?(Rule::SPECIAL)\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"}},{"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```","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":67,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L67"},"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":[{"filename":"src/ameba/inline_comments.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L8"},"def":{"name":"disable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disable"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/inline_comments.cr#L9"},"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":[{"filename":"src/ameba/issue.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L3"}],"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":[{"html_id":"new(rule,location,end_location,message,status:Status?=nil)-class-method","name":"new","doc":null,"summary":null,"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":"Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Status? = nil)","args_html":"(rule, location, end_location, message, status : Status? = nil)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L27"},"def":{"name":"new","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":"Status | ::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":[{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location?-instance-method","name":"end_location","doc":"End location of the issue.","summary":"End location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L16"},"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"}},{"html_id":"location:Crystal::Location?-instance-method","name":"location","doc":"Location of the issue.","summary":"Location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@location"}},{"html_id":"message:String-instance-method","name":"message","doc":"Issue message.","summary":"Issue message.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L19"},"def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"html_id":"rule:Rule::Base-instance-method","name":"rule","doc":"A rule that triggers this issue.","summary":"A rule that triggers this issue.
","abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L10"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"Issue status.
","abstract":false,"args":[],"args_string":" : Status","args_html":" : Status","location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L22"},"def":{"name":"status","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Status","visibility":"Public","body":"@status"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L31"},"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/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","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":[{"filename":"src/ameba/issue.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0","doc":null,"summary":null},{"id":"Disabled","name":"Disabled","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"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":6,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Enabled"}}],"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":[{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L3"}],"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":[{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L28"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status?=nil):Issue-instance-method","name":"add_issue","doc":"Adds a new issue for Crystal AST *node*.","summary":"Adds a new issue for Crystal 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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L18"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node.location, node.end_location, message, status)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L23"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L36"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nend_location = Crystal::Location.new(path, *end_location)\nadd_issue(rule, location, end_location, message, status)\n"}},{"html_id":"add_issue(rule,location,end_location,message,status:Issue::Status?=nil):Issue-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":"Issue::Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L8"},"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":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(rule, location, end_location, message, status)).tap do |issue|\n issues << issue\nend\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/reportable.cr#L5"},"def":{"name":"issues","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@issues"}},{"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.
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":[{"html_id":"rules-class-method","name":"rules","doc":"Returns a list of all available rules.\n\n```\nAmeba::Rule.rules # => [Rule1, Rule2, ....]\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":200,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L200"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Base.inherited_rules"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Base","path":"Ameba/Rule/Base.html","kind":"class","full_name":"Ameba::Rule::Base","name":"Base","abstract":true,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/base.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L29"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement"},{"html_id":"ameba/Ameba/Rule/Lint/DuplicatedRequire","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","kind":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays"},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar"},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","kind":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber"},{"html_id":"ameba/Ameba/Rule/Lint/SpecFocus","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus"},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax"},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","kind":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","kind":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign"},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","kind":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen"},{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","kind":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","kind":"class","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter"},{"html_id":"ameba/Ameba/Rule/Style/IsANil","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil"},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers"},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","kind":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext"},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","kind":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn"},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","kind":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","kind":"class","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Style/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","kind":"class","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```\nclass 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.","summary":"Represents a base of all rules.
","class_methods":[{"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 class 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":161,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L161"},"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":[],"instance_methods":[{"html_id":"==(other)-instance-method","name":"==","doc":"Returns `false` (other can only be a `Value` here).","summary":"Returns false
(other can only be a Value
here).
A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
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":90,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L90"},"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)"}},{"html_id":"group-instance-method","name":"group","doc":"Returns a group this rule belong to.\n\n```\nclass MyGroup::MyRule < Ameba::Rule::Base\n # ...\nend\n\nMyGroup::MyRule.new.group # => \"MyGroup\"\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":79,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L79"},"def":{"name":"group","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).group_name"}},{"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.
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":66,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L66"},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).rule_name"}},{"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```","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":103,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L103"},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.in?(SPECIAL)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L41"},"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":""}},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L37"},"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":[{"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)","args_html":"(*args)","location":{"filename":"src/ameba/rule/base.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/base.cr#L115"},"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":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/line_length.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_blank_lines.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/line_length.cr#L11"}],"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```","summary":"A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows trailing blank lines at the end of the source file.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"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_empty = last_source_line.empty?\nif source_lines_size >= 1 && ((source_lines.last(2)).join.blank? || (!last_line_empty))\n issue_for({source_lines_size - 1, 1}, last_line_empty ? MSG : MSG_FINAL_NEWLINE)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","path":"Ameba/Rule/Layout/TrailingWhitespace.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"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```","summary":"A rule that disallows trailing whitespaces.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":17,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"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 issue_for({index + 1, line.size}, MSG)\n end\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":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L1"},{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L1"},{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L1"},{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L1"},{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L1"},{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L1"},{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L1"},{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/rand_zero.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_string_coercion.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_with_index.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_with_object.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L1"},{"filename":"src/ameba/rule/lint/syntax.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L1"},{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L1"},{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L1"},{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"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/AmbiguousAssignment","path":"Ameba/Rule/Lint/AmbiguousAssignment.html","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\" => \"-=\", \"=+\" => \"+=\", \"=!\" => \"!=\"}","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\"","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":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand assignments.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand 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/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/lint/ambiguous_assignment.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/ambiguous_assignment.cr#L35"},"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 op_end_location = node.value.location\nelse\n return\nend\nop_location = Crystal::Location.new(op_end_location.filename, op_end_location.line_number, op_end_location.column_number - 1)\nop_text = source_between(op_location, op_end_location, source.lines)\nif op_text\nelse\n return\nend\nif MISTAKES.has_key?(op_text)\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % MISTAKES[op_text])\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","path":"Ameba/Rule/Lint/BadDirective.html","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L20"}],"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```","summary":"A rule that reports incorrect comment directives for Ameba.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/bad_directive.cr#L29"},"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":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"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},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] 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/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```","summary":"A rule that disallows comparison to booleans.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/comparison_to_boolean.cr#L31"},"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 = node.name.in?(OP_NAMES)\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\n issue_for(node, MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","path":"Ameba/Rule/Lint/DebuggerStatement.html","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L13"}],"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```","summary":"A rule that disallows calls to debugger.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":13,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L13"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":20,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/debugger_statement.cr#L20"},"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/DuplicatedRequire","path":"Ameba/Rule/Lint/DuplicatedRequire.html","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require 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 duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","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/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L16"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/duplicated_require.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/duplicated_require.cr#L23"},"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":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if processed_require_strings.includes?(node.string)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","path":"Ameba/Rule/Lint/EmptyEnsure.html","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L41"}],"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```","summary":"A rule that disallows empty ensure statement.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L41"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_ensure.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L30"}],"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```","summary":"A rule that disallows empty expressions.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L41"},"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)\nif exp.in?(nil, \"nil\")\n return\nend\nissue_for(node, MSG % exp)\n"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_expression.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L40"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L49"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L55"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/empty_loop.cr#L59"},"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":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"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```","summary":"A rule that disallows duplicated keys in hash literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"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)).empty?\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":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L22"}],"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```","summary":"A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L22"},"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":[{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L32"},"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)\n issue_for(node, MSG)\nend"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L36"},"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)"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L40"},"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)"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_condition.cr#L44"},"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":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"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```","summary":"A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L26"}],"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```","summary":"A rule that disallows some unwanted symbols in percent array literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L26"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/percent_array.cr#L36"},"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 end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","path":"Ameba/Rule/Lint/RandZero.html","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/rand_zero.cr#L25"}],"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```","summary":"A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows string conversion in string interpolation, which is redundant.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":23,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"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":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/redundant_with_index.cr#L29"}],"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```","summary":"A rule that disallows redundant with_index
calls.
A rule that disallows redundant with_index
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows shadowed arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":38,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L38"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L49"},"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_argument.cr#L45"},"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":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"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```","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":[{"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)"}},{"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```","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":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L36"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowed_exception.cr#L43"},"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.try(&.map(&.types))\nelse\n return\nend\nif (excs = shadowed(excs)).empty?\n return\nend\nissue_for(node, MSG % (excs.join(\", \")))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","path":"Ameba/Rule/Lint/ShadowingOuterLocalVar.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"}],"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```","summary":"A rule that disallows the usage of the same name as outer local variables for block or proc arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L45"},"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)"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L49"},"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)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shadowing_local_outer_var.cr#L41"},"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":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"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```","summary":"A rule that disallows using shared variables in fibers, which are mutated during iterations.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":52,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":63,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"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"}},{"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":59,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"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/SpecFocus","path":"Ameba/Rule/Lint/SpecFocus.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\"","doc":null,"summary":null},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] 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/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","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/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L47"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/spec_focus.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L61"},"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.in?(SPEC_ITEM_NAMES)\nelse\n return\nend\nif node.block\nelse\n return\nend\narg = node.named_args.try(&.find() do |__arg1|\n __arg1.name == \"focus\"\nend)\nif arg\n issue_for(arg, MSG)\nend\n"}},{"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/spec_focus.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/spec_focus.cr#L55"},"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":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","path":"Ameba/Rule/Lint/Syntax.html","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/syntax.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L21"}],"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```","summary":"A rule that reports invalid Crystal syntax.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":21,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L21"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/syntax.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"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```","summary":"A rule that reports unneeded disable directives.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"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.empty?\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":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L44"}],"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```","summary":"A rule that reports unreachable code.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":44,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L44"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":57,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L57"},"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"}},{"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":53,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unreachable_code.cr#L53"},"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":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L27"}],"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```","summary":"A rule that reports unused arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L43"},"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))"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L47"},"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))"}},{"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":51,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L51"},"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))"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/unused_argument.cr#L39"},"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":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L28"}],"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```","summary":"A rule that disallows useless assignments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L28"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L39"},"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.ignored? || var.used_in_macro?) || var.captured_by_block?\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"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_assign.cr#L35"},"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":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"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```","summary":"A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"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":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"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```","summary":"A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
A general base class for performance rules.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A general base class for performance rules.","summary":"A general base class for performance rules.
","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/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/base.cr#L5"},"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":[{"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```","summary":"A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
All these methods are allocating a new object
"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\"","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 chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","class_methods":[],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"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":[{"html_id":"call_names:Array(String)-instance-method","name":"call_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"call_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","location":null,"def":{"name":"call_names=","args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@call_names = call_names"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/chained_call_with_no_bang.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/chained_call_with_no_bang.cr#L68"},"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 (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif node.name.in?(call_names)\nelse\n return\nend\nif (obj.name.in?(call_names)) || (obj.name.in?(ALLOCATING_METHOD_NAMES))\nelse\n return\nend\nissue_for(node.name_location, node.name_end_location, MSG % {node.name, obj.name})\n"}},{"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/chained_call_with_no_bang.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/chained_call_with_no_bang.cr#L59"},"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/CompactAfterMap","path":"Ameba/Rule/Performance/CompactAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"COMPACT_NAME","name":"COMPACT_NAME","value":"\"compact\"","doc":null,"summary":null},{"id":"MAP_NAME","name":"MAP_NAME","value":"\"map\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\"","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 `compact` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.match(/^A./)).compact\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].compact_map(&.match(/^A./))\n```\n\nYAML configuration example:\n\n```\nPerformance/CompactAfterMap:\n Enabled: true\n```","summary":"This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
A rule that enforces constant names to be in screaming case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":24,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/constant_names.cr#L24"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/constant_names.cr#L31"},"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 name.in?(expected, name.camelcase)\n return\n end\n issue_for(target, MSG % {expected, name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","path":"Ameba/Rule/Style/IsAFilter.html","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s(%s)` instead 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/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"This rule is used to identify usage of `is_a?/nil?` calls within filters.\n\nFor example, this is considered invalid:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(&.is_a?(Regex::MatchData)) # => true\nmatches.one?(&.nil?) # => true\n\ntypeof(matches.reject(&.nil?)) # => Array(Regex::MatchData | Nil)\ntypeof(matches.select(&.is_a?(Regex::MatchData))) # => Array(Regex::MatchData | Nil)\n```\n\nAnd it should be written as this:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(Regex::MatchData) # => true\nmatches.one?(Nil) # => true\n\ntypeof(matches.reject(Nil)) # => Array(Regex::MatchData)\ntypeof(matches.select(Regex::MatchData)) # => Array(Regex::MatchData)\n```\n\nYAML configuration example:\n\n```\nStyle/IsAFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n - any?\n - all?\n - none?\n - one?\n```","summary":"This rule is used to identify usage of is_a?/nil?
calls within filters.
This rule is used to identify usage of is_a?/nil?
calls within filters.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows usage of large numbers without underscore.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/large_numbers.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/large_numbers.cr#L38"},"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":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L40"}],"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```","summary":"A rule that enforces method names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L47"},"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 && column_number\nelse\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":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"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```","summary":"A rule that disallows negated conditions in unless.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","path":"Ameba/Rule/Style/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/predicate_name.cr#L31"}],"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```","summary":"A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows redundant begin blocks.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":58,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_begin.cr#L58"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_begin.cr#L67"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","path":"Ameba/Rule/Style/RedundantNext.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L99"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L99"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L113"},"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"}},{"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":109,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L109"},"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":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L96"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L96"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":110,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L110"},"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"}},{"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":106,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L106"},"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":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L54"}],"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```","summary":"A rule that enforces type names in camelcase manner.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":54,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L54"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":69,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L69"},"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)"}},{"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":73,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L73"},"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)"}},{"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":77,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L77"},"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)"}},{"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":81,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L81"},"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)"}},{"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":85,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L85"},"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":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/unless_else.cr#L45"}],"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```","summary":"A rule that disallows the use of an else
block with the unless
.
A rule that disallows the use of an else
block with the unless
.
A rule that enforces variable names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":25,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L25"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L38"},"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)"}},{"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":42,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L42"},"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)"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L46"},"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/VerboseBlock","path":"Ameba/Rule/Style/VerboseBlock.html","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%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":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","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/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"html_id":"exclude_calls_with_block:Bool-instance-method","name":"exclude_calls_with_block","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_calls_with_block","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","location":null,"def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks:Bool-instance-method","name":"exclude_multiple_line_blocks","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_multiple_line_blocks","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","location":null,"def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_operators:Bool-instance-method","name":"exclude_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","location":null,"def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_prefix_operators:Bool-instance-method","name":"exclude_prefix_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_prefix_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","location":null,"def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_setters:Bool-instance-method","name":"exclude_setters","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_setters","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","location":null,"def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"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"}},{"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"}},{"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 | ::Nil","visibility":"Public","body":"@max_length"}},{"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 | ::Nil"}],"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 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Int32?-instance-method","name":"max_line_length","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32?","args_html":" : Int32?","location":null,"def":{"name":"max_line_length","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32 | ::Nil","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Int32?)-instance-method","name":"max_line_length=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"args_string":"(max_line_length : Int32?)","args_html":"(max_line_length : Int32?)","location":null,"def":{"name":"max_line_length=","args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_line_length = max_line_length"}},{"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"}},{"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"}},{"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/style/verbose_block.cr","line_number":189,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L189"},"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 (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\nif arg.name.starts_with?(\"__arg\")\n return\nend\nif (body = block.body).is_a?(Crystal::Call)\nelse\n return\nend\nobj = body.obj\nwhile obj.is_a?(Crystal::Call)\n obj = obj.obj\nend\nif obj == arg\nelse\n return\nend\nif (reference_count(body, arg)) > 1\n return\nend\nissue_for_valid(source, node, body)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","path":"Ameba/Rule/Style/WhileTrue.html","kind":"class","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/while_true.cr#L28"}],"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```","summary":"A rule that disallows the use of while true
instead of using the idiomatic loop
A rule that disallows the use of while true
instead of using the idiomatic loop
Represents a runner for inspecting sources files.
","class_methods":[],"constructors":[{"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```","summary":"Instantiates a runner using a config
.
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":113,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L113"},"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)"}},{"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```","summary":"Performs the inspection.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L66"},"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 |chan|\n chan.receive.try do |e|\n raise(e)\n end\n end\n self\nensure\n @formatter.finished(@sources)\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L18"},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Source)","visibility":"Public","body":"@sources"}},{"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```","summary":"Indicates whether the last inspection successful or not.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":125,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/runner.cr#L125"},"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 |__arg4|\n __arg4.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":[{"filename":"src/ameba/severity.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L2"}],"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":[{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L26"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L5"},"def":{"name":"convention?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Convention"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L3"},"def":{"name":"error?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Error"}},{"html_id":"symbol:Char-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":" : Char","args_html":" : Char","location":{"filename":"src/ameba/severity.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L12"},"def":{"name":"symbol","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Char","visibility":"Public","body":"case self\nin Error\n 'E'\nin Warning\n 'W'\nin Convention\n 'C'\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L4"},"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":[{"filename":"src/ameba/severity.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/severity.cr#L34"}],"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.
An entity that represents a Crystal source file.
","class_methods":[],"constructors":[{"html_id":"new(code,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```","summary":"Creates a new source by #code
and #path
.
Returns AST nodes constructed by Crystal::Parser
.
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":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L12"},"def":{"name":"code","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L52"},"def":{"name":"fullpath","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"if (value = @fullpath).nil?\n @fullpath = (File.expand_path(path))\nelse\n value\nend"}},{"html_id":"lines:Array(String)-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":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/source.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L36"},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"if (value = @lines).nil?\n @lines = (code.split('\\n'))\nelse\n value\nend"}},{"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.
Path to the source file.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/source.cr#L9"},"def":{"name":"path","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"spec?-instance-method","name":"spec?","doc":"Returns `true` if the source is a spec file, `false` otherwise.","summary":"Returns true
if the source is a spec file, false
otherwise.
Represents Crystal syntax tokenizer based on Crystal::Lexer
.
Instantiates Tokenizer using a lexer
.
Instantiates Tokenizer using a source
.
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":45,"url":"https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/tokenizer.cr#L45"},"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 +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 * [Watch a tutorial](#watch-a-tutorial)\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/reference/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\n129 inspected, 2 failures\n```\n\n### Watch a tutorial\n\n\n\n[🎬 Watch the LuckyCast showing how to use Ameba](https://luckycasts.com/videos/ameba)\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":[{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"},{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"},{"html_id":"ameba/Ameba/Spec/BeValid","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid"}],"locations":[],"repository_name":"ameba","program":true,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Spec/BeValid","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid"},{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"}],"extended_modules":[{"html_id":"ameba/Ameba/Spec/BeValid","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid"},{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"}],"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":[{"filename":"src/ameba.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba.cr#L23"},{"filename":"src/ameba/glob_utils.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L1"},{"filename":"src/ameba/inline_comments.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L1"},{"filename":"src/ameba/issue.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L1"},{"filename":"src/ameba/reportable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L1"},{"filename":"src/ameba/runner.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L1"},{"filename":"src/ameba/severity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L1"},{"filename":"src/ameba/source.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/support.cr#L7"},{"filename":"src/ameba/tokenizer.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/tokenizer.cr#L3"}],"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/runner/work/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```","summary":"Ameba's entry module.
","class_methods":[],"constructors":[],"instance_methods":[{"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```","summary":"Initializes Ameba::Runner
and runs it.
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
.
Represents the argument of some node.
","class_methods":[],"constructors":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L35"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L40"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L17"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L24"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/argument.cr#L20"},"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":[{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L7"}],"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":[{"html_id":"new(node,variable,scope)-class-method","name":"new","doc":"Creates a new assignment.\n\n```\nAssignment.new(node, variable, scope)\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":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L31"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L24"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L24"},"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"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L60"},"def":{"name":"in_branch?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!branch.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L50"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@referenced"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L40"},"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?)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L65"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L22"},"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"}},{"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```","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":97,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L97"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/assignment.cr#L14"},"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":[{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/base_visitor.cr#L6"}],"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":[{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/base_visitor.cr#L18"},"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":[{"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
.
Represents the branch in Crystal code.
","class_methods":[{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L65"},"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"}},{"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":56,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L56"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L33"},"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":[{"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.
See Object#hash(hasher)
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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L47"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.loop?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L23"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L17"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L20"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branch.cr#L22"},"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":[{"filename":"src/ameba/ast/branchable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L15"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L35"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L18"},"def":{"name":"branches","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@branches"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L39"},"def":{"name":"loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((loop?(node)) || parent.try(&.loop?)) || false"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L21"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L24"},"def":{"name":"parent","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L26"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/branchable.cr#L26"},"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":[{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L8"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L5"},"def":{"name":"macro_condition","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@macro_condition"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/counting_visitor.cr#L44"},"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":[{"filename":"src/ameba/ast/flow_expression.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L18"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L36"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L27"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L27"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/flow_expression.cr#L50"},"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\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":[{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/flow_expression_visitor.cr#L12"},"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":[{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L10"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L6"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L6"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L5"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L5"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L7"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L7"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L8"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/ivariable.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/node_visitor.cr#L39"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/node_visitor.cr#L42"},"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":[{"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.
A visit callback for Crystal::IsA
node.
A visit callback for Crystal::Assign
node.
A visit callback for Crystal::Call
node.
A visit callback for Crystal::Block
node.
A visit callback for Crystal::Case
node.
A visit callback for Crystal::ClassDef
node.
A visit callback for Crystal::ClassVar
node.
A visit callback for Crystal::Def
node.
A visit callback for Crystal::EnumDef
node.
A visit callback for Crystal::ExceptionHandler
node.
A visit callback for Crystal::Expressions
node.
A visit callback for Crystal::HashLiteral
node.
A visit callback for Crystal::If
node.
A visit callback for Crystal::InstanceVar
node.
A visit callback for Crystal::LibDef
node.
A visit callback for Crystal::ModuleDef
node.
A visit callback for Crystal::NilLiteral
node.
A visit callback for Crystal::StringInterpolation
node.
A visit callback for Crystal::Unless
node.
A visit callback for Crystal::Var
node.
A visit callback for Crystal::When
node.
A visit callback for Crystal::While
node.
A visit callback for Crystal::Until
node.
A class that utilizes a logic to traverse AST nodes and fire a source test callback if a redundant Crystal::ControlExpression
is reached.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"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":[{"filename":"src/ameba/ast/variabling/reference.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/reference.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/reference.cr#L8"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/reference.cr#L8"},"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":[{"filename":"src/ameba/ast/scope.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L6"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L39"},"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":[{"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.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L59"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L70"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L49"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L155"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L14"},"def":{"name":"arguments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@arguments"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L90"},"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))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L119"},"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 |__arg6|\n __arg6.name == name\nend && ivariables.find do |__arg7|\n __arg7.name == \"@#{name}\"\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L96"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L145"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L30"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L30"},"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"}},{"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
.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L80"},"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 |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L114"},"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?)))"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L23"},"def":{"name":"inner_scopes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@inner_scopes"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L17"},"def":{"name":"ivariables","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@ivariables"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L29"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L29"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L26"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L11"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"html_id":"references?(variable:Variable,check_inner_scopes=true)-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"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(variable : Variable, check_inner_scopes = true)","args_html":"(variable : Variable, check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":137,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L137"},"def":{"name":"references?","args":[{"name":"variable","doc":null,"default_value":"","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","doc":null,"default_value":"true","external_name":"check_inner_scopes","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"variable.references.any? do |reference|\n if reference.scope == self\n return true\n end\n check_inner_scopes && inner_scopes.any?(&.references?(variable))\nend || variable.used_in_macro?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L107"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L28"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L28"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L150"},"def":{"name":"top_level?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"outer_scope.nil?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L126"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/scope.cr#L8"},"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":[{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"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":[{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/scope_visitor.cr#L12"},"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/TopLevelNodesVisitor","path":"Ameba/AST/TopLevelNodesVisitor.html","kind":"class","full_name":"Ameba::AST::TopLevelNodesVisitor","name":"TopLevelNodesVisitor","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":[{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"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":"AST Visitor that visits certain nodes at a top level, which\ncan characterize the source (i.e. require statements, modules etc.)","summary":"AST Visitor that visits certain nodes at a top level, which can characterize the source (i.e.
","class_methods":[],"constructors":[{"html_id":"new(scope:Crystal::ASTNode)-class-method","name":"new","doc":"Creates a new instance of visitor","summary":"Creates a new instance of 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/top_level_nodes_visitor.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"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":[{"html_id":"require_nodes:Array(Crystal::Require)-instance-method","name":"require_nodes","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Crystal::Require)","args_html":" : Array(Crystal::Require)","location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is Crystal::Expressions traverse the children.","summary":"If a top level node is Crystal::Expressions traverse the children.
","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/top_level_nodes_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L18"},"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":"true"}},{"html_id":"visit(node:Crystal::ASTNode)-instance-method","name":"visit","doc":"A general visit method for rest of the nodes.\nReturns false meaning all child nodes will not be traversed.","summary":"A general visit method for rest of the nodes.
","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/top_level_nodes_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L24"},"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":"false"}}],"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":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L2"}],"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/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","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":[{"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.
Returns true if node represents exit
method call.
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":67,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L67"},"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"}},{"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).","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":105,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L105"},"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"}},{"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.
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":151,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L151"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L33"},"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\nsource_between(loc, end_loc, code_lines)\n"}},{"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.
Returns the source code from loc to end_loc (inclusive).
","abstract":false,"args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","restriction":""},{"name":"code_lines","doc":null,"default_value":"","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String?","args_html":"(loc, end_loc, code_lines) : String?","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/util.cr#L42"},"def":{"name":"source_between","args":[{"name":"loc","doc":null,"default_value":"","external_name":"loc","restriction":""},{"name":"end_loc","doc":null,"default_value":"","external_name":"end_loc","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":"String | ::Nil","visibility":"Public","body":"line, 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.join('\\n')\n"}}],"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":[{"filename":"src/ameba/ast/variabling/variable.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L4"}],"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":[{"html_id":"new(node,scope)-class-method","name":"new","doc":"Creates a new variable(in the scope).\n\n```\nVariable.new(node, scope)\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":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L30"},"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":[{"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```","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L47"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L18"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@assignments"}},{"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":111,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L111"},"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, check_inner_scopes: false))\n return true\n end\n if captured_by_block?(inner_scope)\n return true\n end\nend\nfalse\n"}},{"html_id":"declared_before?(node)-instance-method","name":"declared_before?","doc":"Returns true if the variable is declared before the `node`.","summary":"Returns true if the variable is declared before the #node
.
Returns true if the #node
represents exactly the same Crystal node as @node
.
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":145,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L145"},"def":{"name":"ignored?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.starts_with?('_')"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L20"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L20"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L22"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L22"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Var","visibility":"Public","body":"@node"}},{"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```","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":70,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L70"},"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"}},{"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":84,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L84"},"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 branch = assignment.branch\n else\n break\n end\n consumed_branches << branch\nend\n"}},{"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":60,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L60"},"def":{"name":"referenced?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"!references.empty?"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@references"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Scope","visibility":"Public","body":"@scope"}},{"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 $?
.
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":133,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L133"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L23"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L23"},"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"}},{"html_id":"used_in_macro?(scope=@scope)-instance-method","name":"used_in_macro?","doc":"Returns true if current variable potentially referenced in a macro,\nfalse if not.","summary":"Returns true if current variable potentially referenced in a macro, 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":122,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/ast/variabling/variable.cr#L122"},"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 (MacroReferenceFinder.new(inner_scope.node, node.name)).references\n return true\n end\nend\nif (MacroReferenceFinder.new(scope.node, node.name)).references\n return true\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":[{"filename":"src/ameba/config.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L15"}],"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
.
Loads YAML configuration file by path
.
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":55,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L55"},"def":{"name":"excluded","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@excluded"}},{"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":55,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L55"},"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"}},{"html_id":"formatter:Formatter::BaseFormatter-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":" : Formatter::BaseFormatter","args_html":" : Formatter::BaseFormatter","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L113"},"def":{"name":"formatter","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Formatter::BaseFormatter","visibility":"Public","body":"if (value = @formatter).nil?\n @formatter = (Formatter::DotFormatter.new)\nelse\n value\nend"}},{"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```","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":123,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L123"},"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"}},{"html_id":"formatter=(formatter:Formatter::BaseFormatter)-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":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L113"},"def":{"name":"formatter=","args":[{"name":"formatter","doc":null,"default_value":"","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@formatter = formatter"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L46"},"def":{"name":"globs","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@globs"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L46"},"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L34"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L35"},"def":{"name":"severity","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@severity"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L35"},"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"}},{"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```","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":99,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L99"},"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"}},{"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```","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":137,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L137"},"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":"rule = @rules.find do |__arg2|\n __arg2.name == name\nend\nif rule\nelse\n raise(ArgumentError.new(\"Rule `#{name}` does not exist\"))\nend\nrule.tap(&.enabled = enabled).tap(&.excluded = excluded)\n"}},{"html_id":"update_rules(names,enabled=true,excluded=nil)-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```","summary":"Updates rules properties.
","abstract":false,"args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"(names, enabled = true, excluded = nil)","args_html":"(names, enabled = true, excluded = nil)","location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/config.cr#L158"},"def":{"name":"update_rules","args":[{"name":"names","doc":null,"default_value":"","external_name":"names","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":"names.try(&.each do |name|\n if rules = @rule_groups[name]?\n rules.each do |rule|\n rule.enabled = enabled\n rule.excluded = excluded\n end\n else\n update_rule(name, enabled, excluded)\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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L4"},{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/disabled_formatter.cr#L1"},{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L3"},{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L3"},{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/flycheck_formatter.cr#L1"},{"filename":"src/ameba/formatter/json_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L3"},{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L1"}],"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":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L8"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L13"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L30"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L10"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L22"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L26"},"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":""}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/base_formatter.cr#L18"},"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":[{"filename":"src/ameba/formatter/disabled_formatter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/disabled_formatter.cr#L3"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/disabled_formatter.cr#L4"},"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":[{"filename":"src/ameba/formatter/dot_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L6"}],"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":[{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L27"},"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.puts(location.colorize(:cyan))\n output.puts(\"[#{issue.rule.severity.symbol}] #{issue.rule.name}: #{issue.message}\".colorize(:red))\n if show_affected_code && (code = affected_code(source, location, issue.end_location))\n output << (code.colorize(:default))\n end\n output.puts\n end\nend\noutput.puts(finished_in_message(@started_at, Time.monotonic))\noutput.puts(final_message(sources, failed_sources))\n"}},{"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":21,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L21"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/dot_formatter.cr#L13"},"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.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\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":[{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L6"}],"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":"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":[{"html_id":"new(output,location)-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```","summary":"Creates a new instance of ExplainFormatter.
","abstract":false,"args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"args_string":"(output, location)","args_html":"(output, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L23"},"def":{"name":"new","args":[{"name":"output","doc":null,"default_value":"","external_name":"output","restriction":""},{"name":"location","doc":null,"default_value":"","external_name":"location","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(output, location)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L28"},"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 |__arg0|\n __arg0.path == @location.filename\nend\nif source\nelse\n return\nend\nissue = source.issues.find do |__arg1|\n __arg1.location == @location\nend\nif issue\nelse\n return\nend\nexplain(source, issue)\n"}},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"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":12,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/explain_formatter.cr#L12"},"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":[{"filename":"src/ameba/formatter/flycheck_formatter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/flycheck_formatter.cr#L2"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/flycheck_formatter.cr#L5"},"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":[{"filename":"src/ameba/formatter/json_formatter.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L66"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L67"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L87"},"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L75"},"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_46 = @result.summary\n __temp_46.issues_count = __temp_46.issues_count + 1\nend\n@result.sources << json_source\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/json_formatter.cr#L71"},"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":[{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L5"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L6"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/todo_formatter.cr#L9"},"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.flat_map(&.issues)\nif issues.any? do |issue|\n !issue.disabled?\nend\nelse\n @output.puts(\"No issues found. File is not generated.\")\n return\nend\nif issues.any?(&.syntax?)\n @output.puts(\"Unable to generate TODO file. Please fix syntax issues.\")\n return\nend\nfile = generate_todo_config(issues)\n@output.puts(\"Created #{file.path}\")\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":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L2"}],"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":[{"html_id":"affected_code(source,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","doc":null,"default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(source, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L43"},"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":"end_location","doc":null,"default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","doc":null,"default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","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":"lines = source.lines\nlineno, column = location.line_number, location.column_number\nif affected_line = lines[lineno - 1]?.presence\nelse\n return\nend\nif column < max_length\n affected_line = trim(affected_line, max_length, ellipsis)\nend\nshow_context = context_lines > 0\nif show_context\n pre_context, post_context = context(lines, lineno, context_lines)\n position = prompt.size + column\n position = position - 1\nelse\n affected_line_size, affected_line = affected_line.size, affected_line.lstrip\n position = (column - (affected_line_size - affected_line.size)) + prompt.size\n position = position - 1\nend\nString.build do |str|\n if show_context\n pre_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\n str << prompt\n str.puts(affected_line.colorize(:white))\n str << (\" \" * position)\n str << (\"^\".colorize(:yellow))\n if end_location\n end_lineno = end_location.line_number\n end_column = end_location.column_number\n if (end_lineno == lineno) && end_column > column\n end_position = end_column - column\n end_position = end_position - 1\n str << ((\"-\" * end_position).colorize(:dark_gray))\n str << (\"^\".colorize(:yellow))\n end\n end\n str.puts\n if show_context\n post_context.try(&.each do |line|\n line = trim(line, max_length, ellipsis)\n str << prompt\n str.puts(line.colorize(:dark_gray))\n end)\n end\nend\n"}},{"html_id":"context(lines,lineno,context_lines=3,remove_empty=true)-instance-method","name":"context","doc":null,"summary":null,"abstract":false,"args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"args_string":"(lines, lineno, context_lines = 3, remove_empty = true)","args_html":"(lines, lineno, context_lines = 3, remove_empty = true)","location":{"filename":"src/ameba/formatter/util.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L17"},"def":{"name":"context","args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"lineno","doc":null,"default_value":"","external_name":"lineno","restriction":""},{"name":"context_lines","doc":null,"default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","doc":null,"default_value":"true","external_name":"remove_empty","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"pre_context, post_context = [] of ::String, [] of ::String\nlines.each_with_index do |line, i|\n case i + 1\n when (lineno - context_lines)...lineno\n pre_context << line\n when (lineno + 1)..(lineno + context_lines)\n post_context << line\n end\nend\nif remove_empty\n while pre_context.first?.try(&.blank?)\n pre_context.shift\n end\n while post_context.last?.try(&.blank?)\n post_context.pop\n end\nend\n{pre_context, post_context}\n"}},{"html_id":"deansify(message:String?):String?-instance-method","name":"deansify","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String?) : String?","args_html":"(message : String?) : String?","location":{"filename":"src/ameba/formatter/util.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L3"},"def":{"name":"deansify","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"message.try do |__arg0|\n (__arg0.gsub(/\\x1b[^m]*m/, \"\")).presence\nend"}},{"html_id":"trim(str,max_length=120,ellipsis=\"...\")-instance-method","name":"trim","doc":null,"summary":null,"abstract":false,"args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"args_string":"(str, max_length = 120, ellipsis = \" ...\")","args_html":"(str, max_length = 120, ellipsis = " ...")","location":{"filename":"src/ameba/formatter/util.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/formatter/util.cr#L7"},"def":{"name":"trim","args":[{"name":"str","doc":null,"default_value":"","external_name":"str","restriction":""},{"name":"max_length","doc":null,"default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","doc":null,"default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if (str.size - ellipsis.size) > max_length\n str = str[0, max_length]\n if str.size > ellipsis.size\n str = str[0...(-ellipsis.size)] + ellipsis\n end\nend\nstr\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":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L3"}],"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":[{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L22"},"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.flat_map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.uniq!"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/glob_utils.cr#L10"},"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!(&.[](1..-1))))\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":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L3"}],"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:(?A module that utilizes inline comments parsing and processing logic.
","class_methods":[],"constructors":[],"instance_methods":[{"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.
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":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L39"},"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.name.in?(Rule::SPECIAL)\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"}},{"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```","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":67,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L67"},"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":[{"filename":"src/ameba/inline_comments.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L7"}],"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L8"},"def":{"name":"disable?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disable"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/inline_comments.cr#L9"},"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":[{"filename":"src/ameba/issue.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L3"}],"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":[{"html_id":"new(rule,location,end_location,message,status:Status?=nil)-class-method","name":"new","doc":null,"summary":null,"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":"Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Status? = nil)","args_html":"(rule, location, end_location, message, status : Status? = nil)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L27"},"def":{"name":"new","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":"Status | ::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":[{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"disabled?","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":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","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/issue.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L24"},"def":{"name":"enabled?","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":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location?-instance-method","name":"end_location","doc":"End location of the issue.","summary":"End location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L16"},"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"}},{"html_id":"location:Crystal::Location?-instance-method","name":"location","doc":"Location of the issue.","summary":"Location of the issue.
","abstract":false,"args":[],"args_string":" : Crystal::Location?","args_html":" : Crystal::Location?","location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L13"},"def":{"name":"location","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@location"}},{"html_id":"message:String-instance-method","name":"message","doc":"Issue message.","summary":"Issue message.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L19"},"def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"html_id":"rule:Rule::Base-instance-method","name":"rule","doc":"A rule that triggers this issue.","summary":"A rule that triggers this issue.
","abstract":false,"args":[],"args_string":" : Rule::Base","args_html":" : Rule::Base","location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L10"},"def":{"name":"rule","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"Issue status.
","abstract":false,"args":[],"args_string":" : Status","args_html":" : Status","location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L22"},"def":{"name":"status","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Status","visibility":"Public","body":"@status"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L31"},"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/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","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":[{"filename":"src/ameba/issue.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0","doc":null,"summary":null},{"id":"Disabled","name":"Disabled","value":"1","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"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":6,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Enabled"}}],"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":[{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L3"}],"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":[{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L28"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status?=nil):Issue-instance-method","name":"add_issue","doc":"Adds a new issue for Crystal AST *node*.","summary":"Adds a new issue for Crystal 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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L18"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node.location, node.end_location, message, status)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L23"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status?=nil):Issue-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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L36"},"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":""},{"name":"status","doc":null,"default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nend_location = Crystal::Location.new(path, *end_location)\nadd_issue(rule, location, end_location, message, status)\n"}},{"html_id":"add_issue(rule,location,end_location,message,status:Issue::Status?=nil):Issue-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":"Issue::Status | ::Nil"}],"args_string":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","args_html":"(rule, location, end_location, message, status : Issue::Status? = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L8"},"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":"Issue::Status | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(rule, location, end_location, message, status)).tap do |issue|\n issues << issue\nend\n"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/reportable.cr#L5"},"def":{"name":"issues","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@issues"}},{"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.
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":[{"html_id":"rules-class-method","name":"rules","doc":"Returns a list of all available rules.\n\n```\nAmeba::Rule.rules # => [Rule1, Rule2, ....]\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":200,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L200"},"def":{"name":"rules","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Base.inherited_rules"}}],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"ameba/Ameba/Rule/Base","path":"Ameba/Rule/Base.html","kind":"class","full_name":"Ameba::Rule::Base","name":"Base","abstract":true,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/base.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L29"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines"},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement"},{"html_id":"ameba/Ameba/Rule/Lint/DuplicatedRequire","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyExpression","kind":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInCondition","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralInInterpolation","kind":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation"},{"html_id":"ameba/Ameba/Rule/Lint/PercentArrays","kind":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays"},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithIndex","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedException","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException"},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar"},{"html_id":"ameba/Ameba/Rule/Lint/SharedVarInFiber","kind":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber"},{"html_id":"ameba/Ameba/Rule/Lint/SpecFocus","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus"},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax"},{"html_id":"ameba/Ameba/Rule/Lint/UnneededDisableDirective","kind":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective"},{"html_id":"ameba/Ameba/Rule/Lint/UnreachableCode","kind":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode"},{"html_id":"ameba/Ameba/Rule/Lint/UnusedArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument"},{"html_id":"ameba/Ameba/Rule/Lint/UselessAssign","kind":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign"},{"html_id":"ameba/Ameba/Rule/Lint/UselessConditionInWhen","kind":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen"},{"html_id":"ameba/Ameba/Rule/Metrics/CyclomaticComplexity","kind":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/ConstantNames","kind":"class","full_name":"Ameba::Rule::Style::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter"},{"html_id":"ameba/Ameba/Rule/Style/IsANil","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil"},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers"},{"html_id":"ameba/Ameba/Rule/Style/MethodNames","kind":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Style/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin"},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext"},{"html_id":"ameba/Ameba/Rule/Style/RedundantReturn","kind":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn"},{"html_id":"ameba/Ameba/Rule/Style/TypeNames","kind":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Style/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"html_id":"ameba/Ameba/Rule/Style/VariableNames","kind":"class","full_name":"Ameba::Rule::Style::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Style/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","kind":"class","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```\nclass 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.","summary":"Represents a base of all rules.
","class_methods":[{"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 class 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":161,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L161"},"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":[],"instance_methods":[{"html_id":"==(other)-instance-method","name":"==","doc":"Returns `false` (other can only be a `Value` here).","summary":"Returns false
(other can only be a Value
here).
A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
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":90,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L90"},"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)"}},{"html_id":"group-instance-method","name":"group","doc":"Returns a group this rule belong to.\n\n```\nclass MyGroup::MyRule < Ameba::Rule::Base\n # ...\nend\n\nMyGroup::MyRule.new.group # => \"MyGroup\"\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":79,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L79"},"def":{"name":"group","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).group_name"}},{"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.
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":66,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L66"},"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"({{ @type }}).rule_name"}},{"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```","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":103,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L103"},"def":{"name":"special?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"name.in?(SPECIAL)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L41"},"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":""}},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L37"},"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":[{"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)","args_html":"(*args)","location":{"filename":"src/ameba/rule/base.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/base.cr#L115"},"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":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/line_length.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_blank_lines.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_blank_lines.cr#L1"},{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Layout::LineLength","name":"LineLength","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/line_length.cr#L11"}],"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```","summary":"A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows lines longer than #max_length
number of symbols.
A rule that disallows trailing blank lines at the end of the source file.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"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_empty = last_source_line.empty?\nif source_lines_size >= 1 && ((source_lines.last(2)).join.blank? || (!last_line_empty))\n issue_for({source_lines_size - 1, 1}, last_line_empty ? MSG : MSG_FINAL_NEWLINE)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingWhitespace","path":"Ameba/Rule/Layout/TrailingWhitespace.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingWhitespace","name":"TrailingWhitespace","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/layout/trailing_whitespace.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"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```","summary":"A rule that disallows trailing whitespaces.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":10,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":17,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"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 issue_for({index + 1, line.size}, MSG)\n end\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":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L1"},{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L1"},{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L1"},{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L1"},{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L1"},{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L1"},{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L1"},{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/rand_zero.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_string_coercion.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_string_coercion.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_with_index.cr#L1"},{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_with_object.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L1"},{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L1"},{"filename":"src/ameba/rule/lint/syntax.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L1"},{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L1"},{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L1"},{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"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/AmbiguousAssignment","path":"Ameba/Rule/Lint/AmbiguousAssignment.html","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\" => \"-=\", \"=+\" => \"+=\", \"=!\" => \"!=\"}","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\"","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":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand assignments.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule checks for mistyped shorthand assignments.\n\n # bad\n x =- y\n x =+ y\n x =! y\n\n # good\n x -= y # or x = -y\n x += y # or x = +y\n x != y # or x = !y\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"This rule checks for mistyped shorthand 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/ambiguous_assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/lint/ambiguous_assignment.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/ambiguous_assignment.cr#L35"},"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 op_end_location = node.value.location\nelse\n return\nend\nop_location = Crystal::Location.new(op_end_location.filename, op_end_location.line_number, op_end_location.column_number - 1)\nop_text = source_between(op_location, op_end_location, source.lines)\nif op_text\nelse\n return\nend\nif MISTAKES.has_key?(op_text)\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % MISTAKES[op_text])\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/BadDirective","path":"Ameba/Rule/Lint/BadDirective.html","kind":"class","full_name":"Ameba::Rule::Lint::BadDirective","name":"BadDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/bad_directive.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L20"}],"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```","summary":"A rule that reports incorrect comment directives for Ameba.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L20"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/bad_directive.cr#L29"},"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":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"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},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] 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/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```","summary":"A rule that disallows comparison to booleans.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/comparison_to_boolean.cr#L31"},"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 = node.name.in?(OP_NAMES)\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\n issue_for(node, MSG)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/DebuggerStatement","path":"Ameba/Rule/Lint/DebuggerStatement.html","kind":"class","full_name":"Ameba::Rule::Lint::DebuggerStatement","name":"DebuggerStatement","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L13"}],"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```","summary":"A rule that disallows calls to debugger.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L13"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":20,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/debugger_statement.cr#L20"},"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/DuplicatedRequire","path":"Ameba/Rule/Lint/DuplicatedRequire.html","kind":"class","full_name":"Ameba::Rule::Lint::DuplicatedRequire","name":"DuplicatedRequire","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require 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 duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports duplicated require statements.\n\n```\nrequire \"./thing\"\nrequire \"./stuff\"\nrequire \"./thing\" # duplicated require\n```\n\nYAML configuration example:\n\n```\nLint/DuplicatedRequire:\n Enabled: true\n```","summary":"A rule that reports duplicated require statements.
","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/duplicated_require.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L16"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/duplicated_require.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/duplicated_require.cr#L23"},"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":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if processed_require_strings.includes?(node.string)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/EmptyEnsure","path":"Ameba/Rule/Lint/EmptyEnsure.html","kind":"class","full_name":"Ameba::Rule::Lint::EmptyEnsure","name":"EmptyEnsure","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_ensure.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L41"}],"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```","summary":"A rule that disallows empty ensure statement.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L41"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_ensure.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyExpression","name":"EmptyExpression","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_expression.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L30"}],"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```","summary":"A rule that disallows empty expressions.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L41"},"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)\nif exp.in?(nil, \"nil\")\n return\nend\nissue_for(node, MSG % exp)\n"}},{"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":48,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_expression.cr#L48"},"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":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L40"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L49"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L55"},"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/empty_loop.cr#L59"},"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":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"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```","summary":"A rule that disallows duplicated keys in hash literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"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)).empty?\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":"class","full_name":"Ameba::Rule::Lint::LiteralInCondition","name":"LiteralInCondition","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L22"}],"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```","summary":"A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L22"},"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":[{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L32"},"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)\n issue_for(node, MSG)\nend"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L36"},"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)"}},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L40"},"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)"}},{"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":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_condition.cr#L44"},"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":"class","full_name":"Ameba::Rule::Lint::LiteralInInterpolation","name":"LiteralInInterpolation","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/literal_in_interpolation.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"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```","summary":"A rule that disallows useless string interpolations that contain a literal value instead of a variable or function.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":18,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::PercentArrays","name":"PercentArrays","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L26"}],"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```","summary":"A rule that disallows some unwanted symbols in percent array literals.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L26"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/percent_array.cr#L36"},"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 end\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/RandZero","path":"Ameba/Rule/Lint/RandZero.html","kind":"class","full_name":"Ameba::Rule::Lint::RandZero","name":"RandZero","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/rand_zero.cr#L25"}],"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```","summary":"A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows rand(0)
and rand(1)
calls.
A rule that disallows string conversion in string interpolation, which is redundant.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":23,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":32,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"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":"class","full_name":"Ameba::Rule::Lint::RedundantWithIndex","name":"RedundantWithIndex","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/redundant_with_index.cr#L29"}],"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```","summary":"A rule that disallows redundant with_index
calls.
A rule that disallows redundant with_index
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows redundant each_with_object
calls.
A rule that disallows shadowed arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":38,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L38"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L49"},"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_argument.cr#L45"},"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":"class","full_name":"Ameba::Rule::Lint::ShadowedException","name":"ShadowedException","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowed_exception.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"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```","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":[{"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)"}},{"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```","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":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L36"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowed_exception.cr#L43"},"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.try(&.map(&.types))\nelse\n return\nend\nif (excs = shadowed(excs)).empty?\n return\nend\nissue_for(node, MSG % (excs.join(\", \")))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowingOuterLocalVar","path":"Ameba/Rule/Lint/ShadowingOuterLocalVar.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowingOuterLocalVar","name":"ShadowingOuterLocalVar","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shadowing_local_outer_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"}],"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```","summary":"A rule that disallows the usage of the same name as outer local variables for block or proc arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L45"},"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)"}},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L49"},"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)"}},{"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":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shadowing_local_outer_var.cr#L41"},"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":"class","full_name":"Ameba::Rule::Lint::SharedVarInFiber","name":"SharedVarInFiber","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"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```","summary":"A rule that disallows using shared variables in fibers, which are mutated during iterations.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":52,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":63,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"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"}},{"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":59,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"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/SpecFocus","path":"Ameba/Rule/Lint/SpecFocus.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFocus","name":"SpecFocus","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\"","doc":null,"summary":null},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] 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/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Checks if specs are focused.\n\nIn specs `focus: true` is mainly used to focus on a spec\nitem locally during development. However, if such change\nis committed, it silently runs only focused spec on all\nother environment, which is undesired.\n\nThis is considered bad:\n\n```\ndescribe MyClass, focus: true do\nend\n\ndescribe \".new\", focus: true do\nend\n\ncontext \"my context\", focus: true do\nend\n\nit \"works\", focus: true do\nend\n```\n\nAnd it should be written as the following:\n\n```\ndescribe MyClass do\nend\n\ndescribe \".new\" do\nend\n\ncontext \"my context\" do\nend\n\nit \"works\" do\nend\n```\n\nYAML configuration example:\n\n```\nLint/SpecFocus:\n Enabled: true\n```","summary":"Checks if specs are focused.
","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/spec_focus.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L47"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/spec_focus.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L61"},"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.in?(SPEC_ITEM_NAMES)\nelse\n return\nend\nif node.block\nelse\n return\nend\narg = node.named_args.try(&.find() do |__arg1|\n __arg1.name == \"focus\"\nend)\nif arg\n issue_for(arg, MSG)\nend\n"}},{"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/spec_focus.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/spec_focus.cr#L55"},"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":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Lint/Syntax","path":"Ameba/Rule/Lint/Syntax.html","kind":"class","full_name":"Ameba::Rule::Lint::Syntax","name":"Syntax","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/syntax.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L21"}],"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```","summary":"A rule that reports invalid Crystal syntax.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":21,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L21"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/syntax.cr#L27"},"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":"class","full_name":"Ameba::Rule::Lint::UnneededDisableDirective","name":"UnneededDisableDirective","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"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```","summary":"A rule that reports unneeded disable directives.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":34,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"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.empty?\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":"class","full_name":"Ameba::Rule::Lint::UnreachableCode","name":"UnreachableCode","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L44"}],"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```","summary":"A rule that reports unreachable code.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":44,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L44"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":57,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L57"},"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"}},{"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":53,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unreachable_code.cr#L53"},"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":"class","full_name":"Ameba::Rule::Lint::UnusedArgument","name":"UnusedArgument","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L27"}],"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```","summary":"A rule that reports unused arguments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":27,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L27"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":43,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L43"},"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))"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L47"},"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))"}},{"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":51,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L51"},"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))"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/unused_argument.cr#L39"},"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":"class","full_name":"Ameba::Rule::Lint::UselessAssign","name":"UselessAssign","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L28"}],"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```","summary":"A rule that disallows useless assignments.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L28"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L39"},"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.ignored? || var.used_in_macro?) || var.captured_by_block?\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"}},{"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":35,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_assign.cr#L35"},"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":"class","full_name":"Ameba::Rule::Lint::UselessConditionInWhen","name":"UselessConditionInWhen","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/lint/useless_condition_in_when.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"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```","summary":"A rule that disallows useless conditions in when clause where it is guaranteed to always return the same result.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":50,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"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":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"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":"class","full_name":"Ameba::Rule::Metrics::CyclomaticComplexity","name":"CyclomaticComplexity","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"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```","summary":"A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
A rule that disallows methods with a cyclomatic complexity higher than MaxComplexity
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of any?
calls that follow filters.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
This rule is used to identify usage of arg-less Enumerable#any?
calls.
A general base class for performance rules.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A general base class for performance rules.","summary":"A general base class for performance rules.
","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/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/base.cr#L5"},"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":[{"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```","summary":"A convenient addition to #test
method that does the same but returns a passed in source
as an addition.
All these methods are allocating a new object
"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\"","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 chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","class_methods":[],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of chained calls not utilizing\nthe bang method variants.\n\nFor example, this is considered inefficient:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq\n .sort\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nchars = names\n .flat_map(&.chars)\n .uniq!\n .sort!\n```\n\nYAML configuration example:\n\n```\nPerformance/ChainedCallWithNoBang:\n Enabled: true\n CallNames:\n - uniq\n - sort\n - sort_by\n - shuffle\n - reverse\n```","summary":"This rule is used to identify usage of chained calls not utilizing the bang method variants.
","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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"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":[{"html_id":"call_names:Array(String)-instance-method","name":"call_names","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":null,"def":{"name":"call_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","doc":null,"summary":null,"abstract":false,"args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","location":null,"def":{"name":"call_names=","args":[{"name":"call_names","doc":null,"default_value":"","external_name":"call_names","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@call_names = call_names"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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/chained_call_with_no_bang.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/chained_call_with_no_bang.cr#L68"},"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 (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif node.name.in?(call_names)\nelse\n return\nend\nif (obj.name.in?(call_names)) || (obj.name.in?(ALLOCATING_METHOD_NAMES))\nelse\n return\nend\nissue_for(node.name_location, node.name_end_location, MSG % {node.name, obj.name})\n"}},{"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/chained_call_with_no_bang.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/chained_call_with_no_bang.cr#L59"},"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/CompactAfterMap","path":"Ameba/Rule/Performance/CompactAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"COMPACT_NAME","name":"COMPACT_NAME","value":"\"compact\"","doc":null,"summary":null},{"id":"MAP_NAME","name":"MAP_NAME","value":"\"map\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\"","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 `compact` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.match(/^A./)).compact\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].compact_map(&.match(/^A./))\n```\n\nYAML configuration example:\n\n```\nPerformance/CompactAfterMap:\n Enabled: true\n```","summary":"This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of compact
calls that follow map
.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of first/last/first?/last?
calls that follow filters.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of flatten
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of sum/product
calls that follow map
.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
This rule is used to identify usage of size
calls that follow filter.
A rule that enforces constant names to be in screaming case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":24,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/constant_names.cr#L24"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/constant_names.cr#L31"},"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 name.in?(expected, name.camelcase)\n return\n end\n issue_for(target, MSG % {expected, name})\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/IsAFilter","path":"Ameba/Rule/Style/IsAFilter.html","kind":"class","full_name":"Ameba::Rule::Style::IsAFilter","name":"IsAFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s(%s)` instead 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/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"This rule is used to identify usage of `is_a?/nil?` calls within filters.\n\nFor example, this is considered invalid:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(&.is_a?(Regex::MatchData)) # => true\nmatches.one?(&.nil?) # => true\n\ntypeof(matches.reject(&.nil?)) # => Array(Regex::MatchData | Nil)\ntypeof(matches.select(&.is_a?(Regex::MatchData))) # => Array(Regex::MatchData | Nil)\n```\n\nAnd it should be written as this:\n\n```\nmatches = %w[Alice Bob].map(&.match(/^A./))\n\nmatches.any?(Regex::MatchData) # => true\nmatches.one?(Nil) # => true\n\ntypeof(matches.reject(Nil)) # => Array(Regex::MatchData)\ntypeof(matches.select(Regex::MatchData)) # => Array(Regex::MatchData)\n```\n\nYAML configuration example:\n\n```\nStyle/IsAFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n - any?\n - all?\n - none?\n - one?\n```","summary":"This rule is used to identify usage of is_a?/nil?
calls within filters.
This rule is used to identify usage of is_a?/nil?
calls within filters.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows calls to is_a?(Nil)
in favor of nil?
.
A rule that disallows usage of large numbers without underscore.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/large_numbers.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/large_numbers.cr#L38"},"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":"class","full_name":"Ameba::Rule::Style::MethodNames","name":"MethodNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/method_names.cr#L40"}],"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```","summary":"A rule that enforces method names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/method_names.cr#L40"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/method_names.cr#L47"},"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 && column_number\nelse\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":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"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```","summary":"A rule that disallows negated conditions in unless.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":29,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/PredicateName","path":"Ameba/Rule/Style/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Style::PredicateName","name":"PredicateName","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/predicate_name.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/predicate_name.cr#L31"}],"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```","summary":"A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows tautological predicate names, meaning those that start with the prefix has_
or the prefix is_
.
A rule that disallows redundant begin blocks.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":58,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_begin.cr#L58"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_begin.cr#L67"},"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)\n issue_for(node, MSG)\nend"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/RedundantNext","path":"Ameba/Rule/Style/RedundantNext.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantNext","name":"RedundantNext","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L99"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L99"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L113"},"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"}},{"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":109,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_next.cr#L109"},"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":"class","full_name":"Ameba::Rule::Style::RedundantReturn","name":"RedundantReturn","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L96"}],"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":[{"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)"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L96"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":110,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L110"},"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"}},{"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":106,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/redundant_return.cr#L106"},"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":"class","full_name":"Ameba::Rule::Style::TypeNames","name":"TypeNames","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L54"}],"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```","summary":"A rule that enforces type names in camelcase manner.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":54,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L54"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":69,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L69"},"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)"}},{"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":73,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L73"},"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)"}},{"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":77,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L77"},"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)"}},{"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":81,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L81"},"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)"}},{"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":85,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/type_names.cr#L85"},"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":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/unless_else.cr#L45"}],"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```","summary":"A rule that disallows the use of an else
block with the unless
.
A rule that disallows the use of an else
block with the unless
.
A rule that enforces variable names to be in underscored case.
","class_methods":[],"constructors":[{"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)"}},{"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```","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":25,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L25"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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"}},{"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":38,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L38"},"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)"}},{"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":42,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L42"},"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)"}},{"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":46,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/variable_names.cr#L46"},"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/VerboseBlock","path":"Ameba/Rule/Style/VerboseBlock.html","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\"","doc":null,"summary":null},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%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":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","class_methods":[],"constructors":[{"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)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"This rule is used to identify usage of single expression blocks with\nargument as a receiver, that can be collapsed into a short form.\n\nFor example, this is considered invalid:\n\n```\n(1..3).any? { |i| i.odd? }\n```\n\nAnd it should be written as this:\n\n```\n(1..3).any?(&.odd?)\n```\n\nYAML configuration example:\n\n```\nStyle/VerboseBlock:\n Enabled: true\n ExcludeMultipleLineBlocks: true\n ExcludeCallsWithBlocks: true\n ExcludePrefixOperators: true\n ExcludeOperators: true\n ExcludeSetters: false\n MaxLineLength: ~\n MaxLength: 50 # use ~ to disable\n```","summary":"This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.
","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/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/verbose_block.cr#L30"},"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":[{"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"}},{"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"}},{"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"}},{"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"}},{"html_id":"exclude_calls_with_block:Bool-instance-method","name":"exclude_calls_with_block","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_calls_with_block","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","location":null,"def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","doc":null,"default_value":"","external_name":"exclude_calls_with_block","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks:Bool-instance-method","name":"exclude_multiple_line_blocks","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_multiple_line_blocks","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","location":null,"def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","doc":null,"default_value":"","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_operators:Bool-instance-method","name":"exclude_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","location":null,"def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","doc":null,"default_value":"","external_name":"exclude_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_prefix_operators:Bool-instance-method","name":"exclude_prefix_operators","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_prefix_operators","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","location":null,"def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","doc":null,"default_value":"","external_name":"exclude_prefix_operators","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_setters:Bool-instance-method","name":"exclude_setters","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","args_html":" : Bool","location":null,"def":{"name":"exclude_setters","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","doc":null,"summary":null,"abstract":false,"args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","location":null,"def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","doc":null,"default_value":"","external_name":"exclude_setters","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"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"}},{"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"}},{"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 | ::Nil","visibility":"Public","body":"@max_length"}},{"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 | ::Nil"}],"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 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Int32?-instance-method","name":"max_line_length","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32?","args_html":" : Int32?","location":null,"def":{"name":"max_line_length","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32 | ::Nil","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Int32?)-instance-method","name":"max_line_length=","doc":null,"summary":null,"abstract":false,"args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"args_string":"(max_line_length : Int32?)","args_html":"(max_line_length : Int32?)","location":null,"def":{"name":"max_line_length=","args":[{"name":"max_line_length","doc":null,"default_value":"","external_name":"max_line_length","restriction":"Int32 | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@max_line_length = max_line_length"}},{"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"}},{"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"}},{"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/style/verbose_block.cr","line_number":189,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/verbose_block.cr#L189"},"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 (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\nif arg.name.starts_with?(\"__arg\")\n return\nend\nif (body = block.body).is_a?(Crystal::Call)\nelse\n return\nend\nobj = body.obj\nwhile obj.is_a?(Crystal::Call)\n obj = obj.obj\nend\nif obj == arg\nelse\n return\nend\nif (reference_count(body, arg)) > 1\n return\nend\nissue_for_valid(source, node, body)\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Rule/Style/WhileTrue","path":"Ameba/Rule/Style/WhileTrue.html","kind":"class","full_name":"Ameba::Rule::Style::WhileTrue","name":"WhileTrue","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Base","kind":"class","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":"class","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/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/rule/style/while_true.cr#L28"}],"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```","summary":"A rule that disallows the use of while true
instead of using the idiomatic loop
A rule that disallows the use of while true
instead of using the idiomatic loop
Represents a runner for inspecting sources files.
","class_methods":[],"constructors":[{"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```","summary":"Instantiates a runner using a config
.
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":113,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L113"},"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)"}},{"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```","summary":"Performs the inspection.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L66"},"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 |chan|\n chan.receive.try do |e|\n raise(e)\n end\n end\n self\nensure\n @formatter.finished(@sources)\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L18"},"def":{"name":"sources","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Source)","visibility":"Public","body":"@sources"}},{"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```","summary":"Indicates whether the last inspection successful or not.
","abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/runner.cr","line_number":125,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/runner.cr#L125"},"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 |__arg4|\n __arg4.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":[{"filename":"src/ameba/severity.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L2"}],"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":[{"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```","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L26"},"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":[{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L5"},"def":{"name":"convention?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Convention"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L3"},"def":{"name":"error?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self == Error"}},{"html_id":"symbol:Char-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":" : Char","args_html":" : Char","location":{"filename":"src/ameba/severity.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L12"},"def":{"name":"symbol","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Char","visibility":"Public","body":"case self\nin Error\n 'E'\nin Warning\n 'W'\nin Convention\n 'C'\nend"}},{"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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L4"},"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":[{"filename":"src/ameba/severity.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/severity.cr#L34"}],"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.
An entity that represents a Crystal source file.
","class_methods":[],"constructors":[{"html_id":"new(code:String,path=\"\",normalize=true)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""}],"args_string":"(code : String, path = \"\", normalize = true)","args_html":"(code : String, path = "", normalize = true)","location":{"filename":"src/ameba/spec/support.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/support.cr#L11"},"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":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(code, path, normalize)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(code,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```","summary":"Creates a new source by #code
and #path
.
Returns AST nodes constructed by Crystal::Parser
.
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":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L12"},"def":{"name":"code","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L52"},"def":{"name":"fullpath","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"if (value = @fullpath).nil?\n @fullpath = (File.expand_path(path))\nelse\n value\nend"}},{"html_id":"lines:Array(String)-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":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/source.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L36"},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"if (value = @lines).nil?\n @lines = (code.split('\\n'))\nelse\n value\nend"}},{"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.
Path to the source file.
","abstract":false,"args":[],"args_string":" : String","args_html":" : String","location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/source.cr#L9"},"def":{"name":"path","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"spec?-instance-method","name":"spec?","doc":"Returns `true` if the source is a spec file, `false` otherwise.","summary":"Returns true
if the source is a spec file, false
otherwise.
Parsed representation of code annotated with the # ^^^ error: Message
style
Separates annotation lines from code lines.
","abstract":false,"args":[{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":""}],"args_string":"(annotated_code)","args_html":"(annotated_code)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L15"},"def":{"name":"parse","args":[{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"lines = [] of String\nannotations = [] of ::Tuple(Int32, String, String)\nannotated_code.each_line do |code_line|\n if ( annotation_match = ANNOTATION_PATTERN_1.match(code_line))\n message_index = annotation_match.end\n prefix = code_line[0...message_index]\n message = code_line[message_index...]\n annotations << {lines.size, prefix, message}\n else\n if ( annotation_index = code_line.index(ANNOTATION_PATTERN_2))\n lines << code_line[...annotation_index]\n message_index = annotation_index + ANNOTATION_PATTERN_2.size\n message = code_line[message_index...]\n annotations << {lines.size, \"\", message}\n else\n lines << code_line\n end\n end\nend\nif lines.empty?\n annotations.map! do |_, prefix, message|\n {1, prefix, message}\n end\nend\nnew(lines, annotations)\n"}}],"constructors":[{"html_id":"new(lines,annotations:Enumerable(Tuple(Int32,String,String)))-class-method","name":"new","doc":"NOTE: Annotations are sorted so that reconstructing the annotation\n text via `#to_s` is deterministic.","summary":"NOTE Annotations are sorted so that reconstructing the annotation text via #to_s
is deterministic.
Annotates the source code with the Ameba issues provided.
","abstract":false,"args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"issues","doc":null,"default_value":"","external_name":"issues","restriction":"Enumerable(Issue)"}],"args_string":"(lines, issues : Enumerable(Issue))","args_html":"(lines, issues : Enumerable(Issue))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L47"},"def":{"name":"new","args":[{"name":"lines","doc":null,"default_value":"","external_name":"lines","restriction":""},{"name":"issues","doc":null,"default_value":"","external_name":"issues","restriction":"Enumerable(Issue)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(lines, issues)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(other)-instance-method","name":"==","doc":"Returns `false` (other can only be a `Value` here).","summary":"Returns false
(other can only be a Value
here).
Each entry is the line number, annotation prefix, and message.
","abstract":false,"args":[],"args_string":" : Array(Tuple(Int32, String, String))","args_html":" : Array(Tuple(Int32, String, String))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L11"},"def":{"name":"annotations","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(::Tuple(Int32, String, String))","visibility":"Public","body":"@annotations"}},{"html_id":"lines:Array(String)-instance-method","name":"lines","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","args_html":" : Array(String)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L7"},"def":{"name":"lines","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@lines"}},{"html_id":"to_s(io)-instance-method","name":"to_s","doc":"Constructs an annotated source string (like what we parse).\n\nReconstructs a deterministic annotated source string. This is\nuseful for eliminating semantically irrelevant annotation\nordering differences.\n\n source1 = AnnotatedSource.parse(<<-CRYSTAL)\n line1\n ^ Annotation 1\n ^^ Annotation 2\n CRYSTAL\n\n source2 = AnnotatedSource.parse(<<-CRYSTAL)\n line1\n ^^ Annotation 2\n ^ Annotation 1\n CRYSTAL\n\n source1.to_s == source2.to_s # => true","summary":"Constructs an annotated source string (like what we parse).
","abstract":false,"args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/annotated_source.cr#L102"},"def":{"name":"to_s","args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"reconstructed = lines.dup\nannotations.reverse_each do |line_number, prefix, message|\n if prefix.empty?\n __temp_52 = line_number - 1\n reconstructed[__temp_52] = reconstructed[__temp_52] + \"#{ANNOTATION_PATTERN_2}#{message}\"\n else\n if lines.empty?\n line_number = 0\n end\n reconstructed.insert(line_number, \"#{prefix}#{message}\")\n end\nend\nio << (reconstructed.join('\\n'))\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/BeValid","path":"Ameba/Spec/BeValid.html","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"src/ameba/spec/be_valid.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L2"}],"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/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"html_id":"be_valid-instance-method","name":"be_valid","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/spec/be_valid.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L3"},"def":{"name":"be_valid","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"BeValidExpectation.new"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/BeValidExpectation","path":"Ameba/Spec/BeValidExpectation.html","kind":"struct","full_name":"Ameba::Spec::BeValidExpectation","name":"BeValidExpectation","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":[{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L8"}],"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/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"html_id":"new-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","args_html":"","location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L8"},"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":[{"html_id":"failure_message(source)-instance-method","name":"failure_message","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/spec/be_valid.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L13"},"def":{"name":"failure_message","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":"String.build do |str|\n str << \"Source expected to be valid, but there are issues: \\n\\n\"\n source.issues.reject(&.disabled?).each do |e|\n str << \" * #{e.rule.name}: #{e.message}\\n\"\n end\nend"}},{"html_id":"match(source)-instance-method","name":"match","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/spec/be_valid.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L9"},"def":{"name":"match","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.valid?"}},{"html_id":"negative_failure_message(source)-instance-method","name":"negative_failure_message","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/spec/be_valid.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/be_valid.cr#L22"},"def":{"name":"negative_failure_message","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 expected to be invalid, but it is valid.\""}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/ExpectIssue","path":"Ameba/Spec/ExpectIssue.html","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue","abstract":false,"superclass":null,"ancestors":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"locations":[{"filename":"src/ameba/spec/expect_issue.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/expect_issue.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"aliased":null,"aliased_html":null,"const":false,"constants":[],"included_modules":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"This mixin makes it easier to specify strict issue expectations\nin a declarative and visual fashion. Just type out the code that\nshould generate an issue, annotate code by writing '^'s\nunderneath each character that should be highlighted, and follow\nthe carets with a string (separated by a space) that is the\nmessage of the issue. You can include multiple issues in\none code snippet.\n\nUsage:\n\n expect_issue subject, %(\n def foo\n a do\n b\n end.c\n # ^^^^^ error: Avoid chaining a method call on a do...end block.\n end\n )\n\nEquivalent assertion without `expect_issue`:\n\n source = Source.new %(\n def foo\n a do\n b\n end.c\n end\n ), \"source.cr\"\n subject.catch(source).should_not be_valid\n source.issues.size.should be(1)\n\n issue = source.issues.first\n issue.location.to_s.should eq \"source.cr:4:3\"\n issue.end_location.to_s.should eq \"source.cr:4:7\"\n issue.message.should eq(\n \"Avoid chaining a method call on a do...end block.\"\n )\n\nIf you do not want to specify an issue then use the\ncompanion method `expect_no_issues`. This method is a much\nsimpler assertion since it just inspects the code and checks\nthat there were no issues. The `expect_issue` method has\nto do more work by parsing out lines that contain carets.","summary":"This mixin makes it easier to specify strict issue expectations in a declarative and visual fashion.
","class_methods":[],"constructors":[],"instance_methods":[{"html_id":"expect_issue(rules:Rule::Base|Enumerable(Rule::Base),annotated_code:String,path=\"\",normalize=true,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_issue","doc":null,"summary":null,"abstract":false,"args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = \"\", normalize = true, *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = "", normalize = true, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/expect_issue.cr#L50"},"def":{"name":"expect_issue","args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","doc":null,"default_value":"","external_name":"annotated_code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":null,"splat_index":4,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if normalize\n annotated_code = normalize_code(annotated_code)\nend\nexpected_annotations = AnnotatedSource.parse(annotated_code)\nlines = expected_annotations.lines\ncode = lines.join('\\n')\nif code == annotated_code\n raise(\"Use `report_no_issues` to assert that no issues are found\")\nend\nactual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations == expected_annotations\nelse\n fail(\"Expected:\\n\\n#{expected_annotations}\\n\\nGot:\\n\\n#{actual_annotations}\", file, line)\nend\n"}},{"html_id":"expect_no_issues(rules:Rule::Base|Enumerable(Rule::Base),code:String,path=\"\",normalize=true,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_issues","doc":null,"summary":null,"abstract":false,"args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = \"\", normalize = true, *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = "", normalize = true, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/expect_issue.cr#L80"},"def":{"name":"expect_no_issues","args":[{"name":"rules","doc":null,"default_value":"","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":"String"},{"name":"path","doc":null,"default_value":"\"\"","external_name":"path","restriction":""},{"name":"normalize","doc":null,"default_value":"true","external_name":"normalize","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":null,"splat_index":4,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if normalize\n code = normalize_code(code)\nend\nlines = code.lines\nactual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations.to_s == code\nelse\n fail(\"Expected no issues, but got:\\n\\n#{actual_annotations}\", file, line)\nend\n"}}],"macros":[],"types":[]},{"html_id":"ameba/Ameba/Spec/Util","path":"Ameba/Spec/Util.html","kind":"module","full_name":"Ameba::Spec::Util","name":"Util","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"src/ameba/spec/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/util.cr#L1"}],"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"},{"html_id":"ameba/Ameba/Spec/ExpectIssue","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue"}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"html_id":"normalize_code(code,separator='\\n')-instance-method","name":"normalize_code","doc":null,"summary":null,"abstract":false,"args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":""},{"name":"separator","doc":null,"default_value":"'\\n'","external_name":"separator","restriction":""}],"args_string":"(code, separator = '\\n')","args_html":"(code, separator = '\\n')","location":{"filename":"src/ameba/spec/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/spec/util.cr#L2"},"def":{"name":"normalize_code","args":[{"name":"code","doc":null,"default_value":"","external_name":"code","restriction":""},{"name":"separator","doc":null,"default_value":"'\\n'","external_name":"separator","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"lines = code.split(separator)\nif lines[0].blank? && lines.size > 1\n lines.shift\nend\nmin_indent = lines.min_of do |line|\n line.blank? ? code.size : line.size - line.lstrip.size\nend\nlines.join(separator) do |line|\n line.blank? ? line : line[min_indent..]\nend\n"}}],"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":[{"filename":"src/ameba/tokenizer.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/tokenizer.cr#L14"}],"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
.
Instantiates Tokenizer using a lexer
.
Instantiates Tokenizer using a source
.
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":45,"url":"https://github.com/crystal-ameba/ameba/blob/3d432fde/src/ameba/tokenizer.cr#L45"},"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